This commit is contained in:
seb
2026-10-18 03:15:20 +02:00
parent fda895f75a
commit c687553eea
6 changed files with 402 additions and 0 deletions

View File

@@ -84,3 +84,26 @@ Lists ledger entries for a given article SKU, optionally filtered by transaction
const entries = await store.ledger.listBySku(googleAuthId, 'SKU-001', 'DELIVERY');
// => [{ id, manifestarticle_id, warehouse_id, sku, transaction_type, amount, transaction_text, hash_version, prev_hash, created_at }]
```
## `ledger.listHistory`
*Source: `src/store/ledger/listHistory.js`*
Lists ledger entries for the user's selected company across all articles, supporting pagination, date cutoff via seekMonths, and search.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `provider` | `import('../../providers/provider.js').Provider` | |
**Returns**
`(googleAuthId: number, opts?: {offset?: number, limit?: number, search?: string, seekMonths?: number}, tx?: object) => Promise<{ledger: Array<{id: number, date: string, sku: string|null, name: string|null, transaction_type: string, transaction_text: string, amount: number}>, total: number, unfilteredTotal: number, offset: number, limit: number}>`
**Example**
```js
const res = await store.ledger.listHistory(googleAuthId, { offset: 0, limit: 50, search: 'kjh', seekMonths: -1 });
// => { ledger: [...], total, unfilteredTotal, offset, limit }
```