Skip to main content

Function: setInvoiceWriteOff()

setInvoiceWriteOff(svc, companyId, invoiceId, writeOff): Promise<{ failure: DbFailure | null; rows: number; }>

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

Set or clear the three write-off columns, compare-and-set on the flag's current state so two owners racing (or a stale dialog) can't double-apply or clear someone else's newer write-off. Returns the number of rows written — 0 means the CAS lost.

Parameters

svc

SupabaseClient

companyId

string

invoiceId

string

writeOff

{ at: string; by: string; reason: string; } | null

Returns

Promise<{ failure: DbFailure | null; rows: number; }>