sync_vouchers_to_sql
Pull voucher headers for a date range into an in-memory SQL cache so reports can aggregate data without re-fetching from Tally. Call per chunk to build full history for the open company.
Instructions
Pull voucher HEADERS (date, type, number, party ledger, amount, narration — not line items) for one date range into this session's SQL cache (in-memory, gone when the session ends), so query_sql can aggregate/report on them (e.g. sales by customer by month) without re-fetching from Tally. Call this once per chunk to build up full multi-year history for the CURRENTLY OPEN company within this session — re-running for the SAME range just refreshes it (safe to re-run), and each call only touches vouchers within its own date range, so calling it for 2024 then 2025 gives you both, not just the latest. Checks which company is actually open in Tally first and clears the whole cache if it's changed since the last sync/query — however that happened, not just via set_company — so a prior company's vouchers never silently mix into this one's results. IMPORTANT: pick a chunk size that won't time out — a full year (~7,500 vouchers here) took ~6s against the 10s request timeout; prefer quarterly or monthly chunks for a busy company, and back off further if a call times out. Does not include stock item / ledger line detail (see get_ledger_vouchers/get_vouchers for that).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | End date in DD-MM-YYYY format | |
| from | Yes | Start date in DD-MM-YYYY format |