This commit is contained in:
seb
2026-10-16 22:09:12 +02:00
parent 796f6a3272
commit 7635821dad
38 changed files with 6191 additions and 3350 deletions

View File

@@ -6,7 +6,7 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
*Source: `src/store/ledger/add.js`*
Appends a new append-only entry to the ledger table.
Appends new append-only entry/entries to the ledger table according to manifest rules: - quote / order: no bookings possible (throws error) - delivery: acceptance entry (warehouse_id=null) + warehouse entry (if tracked) in one transaction - shipment: shipment entry (warehouse_id=null, negative amount) + warehouse entry (if tracked) in one transaction - adjustment: single warehouse inventory movement
**Parameters**
@@ -23,23 +23,7 @@ Appends a new append-only entry to the ledger table.
**Returns**
`Promise<{id: number, manifestarticle_id: number, warehouse_id: number|null, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>` — The created ledger row.
**Throws**
`Error` — If user not authorized, company not selected, manifest article not found, or input invalid.
**Example**
```js
const entry = await store.ledger.add(googleAuthId, {
manifestarticle_id: 1,
warehouse_id: 1,
transaction_type: 'DELIVERY',
amount: 100.5,
transaction_text: 'Invoice paid',
});
```
`Promise<{id: number, manifestarticle_id: number, warehouse_id: number|null, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>` — The primary ledger row.
## `ledger.listByManifestarticleId`