Function: generateDraftInvoice()
generateDraftInvoice(
facilityId,weekStartIso,opts?):Promise<{invoiceNumber:string;ok:true; } | {error:string;needsConfirm?:boolean;ok:false; }>
Defined in: src/server/actions/invoicing.ts:138
Owner-only: create the draft invoice for a facility's week from the cockpit (contracted-hours engine; no number/lock/send yet). Thin wrapper over generateAndStoreInvoice so the run table can turn a "ready" facility into a sendable draft in one click.
Parameters
facilityId
string
weekStartIso
string
opts?
confirmUnderContracted?
boolean
Returns
Promise<{ invoiceNumber: string; ok: true; } | { error: string; needsConfirm?: boolean; ok: false; }>