Skip to main content

Function: fetchLedgerInvoices()

fetchLedgerInvoices(svc, companyId): Promise<SectionRead<LedgerInvoice>>

Defined in: src/db/queries/ar.ts:149

Every invoice the company ever raised — voided and soft-deleted included, because DEAD money is exactly those rows (report-scope §1). Ordered by id so the page boundaries are stable.

A failed read reports failure rather than degrading: reading the write-off flag as "not written off" would silently reclassify written-off debt as chaseable, with nothing on screen to say so. A visible "couldn't load" beats a confident wrong number.

Parameters

svc

SupabaseClient

companyId

string

Returns

Promise<SectionRead<LedgerInvoice>>