Skip to main content

Interface: FacilityRunRow

Defined in: src/lib/invoice/run.ts:31

One facility's row in a weekly billing run — a camelCase projection of a single weekly_billing_run() SQL output row. Billing weeks are Sunday-anchored (distinct from the Monday/ISO weeks used by the pay engine).

All monetary fields are integer cents (never floats/dollars). Hour fields are decimal hours. billableAmountCents reflects the billing policy applied in SQL — bill the lesser of logged vs. contracted unless an overage has been approved — so it may be less than loggedHours × rate.

Properties

activeAssignmentCount

activeAssignmentCount: number

Defined in: src/lib/invoice/run.ts:56

Number of currently active assignments at this facility.


approvedHours

approvedHours: number

Defined in: src/lib/invoice/run.ts:45

Logged hours that have been approved. Decimal hours.


billableAmountCents

billableAmountCents: number

Defined in: src/lib/invoice/run.ts:49

Amount to bill this facility this week, in integer cents (post-policy; see interface doc).


contractedHours

contractedHours: number

Defined in: src/lib/invoice/run.ts:41

Contracted hours for the week (the cap for non-overage billing). Decimal hours.


coverageGap

coverageGap: boolean

Defined in: src/lib/invoice/run.ts:65

true when a coverage gap was detected (drives status === 'gap').


existingInvoiceId

existingInvoiceId: string | null

Defined in: src/lib/invoice/run.ts:69

Id of an invoice already raised for this facility/week, or null if none exists yet.


existingInvoiceNumber

existingInvoiceNumber: string | null

Defined in: src/lib/invoice/run.ts:71

Human-facing number of the existing invoice, or null.


existingInvoiceStatus

existingInvoiceStatus: string | null

Defined in: src/lib/invoice/run.ts:73

Status of the existing invoice (e.g. draft/sent/paid), or null.


facilityCity

facilityCity: string | null

Defined in: src/lib/invoice/run.ts:37

Facility city, or null if unknown.


facilityId

facilityId: string

Defined in: src/lib/invoice/run.ts:33

Facility UUID.


facilityName

facilityName: string

Defined in: src/lib/invoice/run.ts:35

Facility display name.


facilityState

facilityState: string | null

Defined in: src/lib/invoice/run.ts:39

Facility state, or null if unknown.


hasBillingContact

hasBillingContact: boolean

Defined in: src/lib/invoice/run.ts:63

true when the facility has a designated billing contact to send the invoice to (active contact with an email and role billing/admin); when false, drives status === 'review'.


loggedHours

loggedHours: number

Defined in: src/lib/invoice/run.ts:43

Total hours logged by assigned people this week. Decimal hours.


missingRate

missingRate: boolean

Defined in: src/lib/invoice/run.ts:58

true when at least one assignment lacks a billing rate (blocks a clean invoice; drives status === 'review').


peopleCount

peopleCount: number

Defined in: src/lib/invoice/run.ts:54

Number of distinct contractors assigned to this facility this week (deduped per contractor across assignments; includes those who logged zero hours).


status

status: RunStatus

Defined in: src/lib/invoice/run.ts:75

Derived per-facility run status computed in SQL. See RunStatus.


unapprovedHours

unapprovedHours: number

Defined in: src/lib/invoice/run.ts:47

Logged hours still awaiting approval. Decimal hours.


varianceFlagged

varianceFlagged: boolean

Defined in: src/lib/invoice/run.ts:67

true when logged-vs-contracted variance exceeded the review threshold (informational only; does not affect status).