sync_voucher_ledger_entries_to_sql
Sync voucher ledger lines for a date range into the SQL cache to break down ledger balances by voucher, including ledger, signed amount, cost centre, and bill allocation.
Instructions
Pull voucher LEDGER LINES (which ledger each voucher posted to, the amount, cost centre, and bill allocation — one row per ledger line per bill allocation) for one date range into this session's SQL cache. This is the piece get_vouchers/sync_vouchers_to_sql can't give you — those return only each voucher's single overall total, not which ledgers it actually posted to and for how much. Use this whenever a ledger's balance needs to be broken down by the vouchers that make it up — e.g. a combined VAT ledger split into Output vs Input (GROUP BY ledger, voucher_type), or reconciling a party ledger's movements voucher by voucher. amount is SIGNED (negative for a debit line, positive for a credit line — confirmed live: a Sales invoice's party ledger line comes back negative while its Sales/VAT lines come back positive, summing to zero across the voucher) — sum it directly. Same chunked, additive-by-date-range model and same timeout caution as sync_vouchers_to_sql/sync_voucher_items_to_sql — quarterly/monthly chunks for a busy company. If you switch companies (set_company), the cache is cleared automatically, so re-sync before querying again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | End date in DD-MM-YYYY format | |
| from | Yes | Start date in DD-MM-YYYY format |