Skip to main content

Function: regenerateInvoicePdf()

regenerateInvoicePdf(companyId, invoiceId): Promise<{ ok: true; } | { error: string; }>

Defined in: src/server/services/invoice/generate.ts:650

Re-render and store the PDF for an existing invoice (recovery when the original render/upload failed). Rebuilds line descriptions and amounts from the persisted invoice_line_items — it does NOT recompute hours or totals, so the figures are unchanged. A line stored with null hours/rate (a corrected total) is printed non-itemized (total only). Owner-gated upstream.

Parameters

companyId

string

Tenant scope.

invoiceId

string

The invoice to regenerate the PDF for.

Returns

Promise<{ ok: true; } | { error: string; }>

{ ok: true } once the PDF is rendered and linked; otherwise { error } (invoice not found, invoice is void, the facility was not found, it has no line items, or the render/upload failed).