Function: fetchDraftSendDetails()
fetchDraftSendDetails(
companyId,invoiceIds):Promise<DraftSendDetail[]>
Defined in: src/server/services/invoice/weeklyRun.ts:641
Per-draft confirmation details for the Review & send dialog: who the invoice is actually addressed to (billing contact, else admin), its due date, and an advisory anomaly flag comparing the draft's amount to the facility's recent issued invoices. Read-only, company-scoped.
Recipient selection mirrors the send path: billing-role contact emails if any exist, otherwise admin-role emails. The anomaly baseline is the mean of up to the RECENT_INVOICE_WINDOW most recent ISSUED (non-draft, non-void) totals for that facility — see flagAmountAnomaly.
Parameters
companyId
string
Tenant scope; every query is filtered by it (signed-in admin's company).
invoiceIds
string[]
Draft invoice ids to confirm. Duplicates are de-duped and empty values dropped;
only invoices currently in draft status for this company are considered.
Returns
Promise<DraftSendDetail[]>
One DraftSendDetail per matching draft (money in integer cents). Resolves to an empty array when no ids are given or none match a draft for this company; it does not throw on a query failure.