Function: loadPayComputeInputs()
loadPayComputeInputs(
svc,companyId,scope,period):Promise<PayComputeInputs|null>
Defined in: src/server/services/payInputs.ts:184
Load the full pay-compute bundle for a scope and period: the chosen assignment versions, the
contractors, the settling-window time entries, approved holiday leave, facility names, approved
overage weeks, and the holidays config — batched, all scoped to companyId.
Parameters
svc
SupabaseClient
companyId
string
scope
period
Returns
Promise<PayComputeInputs | null>
The bundle, or null when the scope has no rate-bearing assignment overlapping the
period (nothing to price).
Remarks
- Settling-week fetch window. Outsourced pay settles WHOLE Mon–Sun weeks by their Sunday
(ADR-0044), so a boundary week's days can precede the period start — entries are read from the
first settling week's Monday. The END stays at the period end (not the last settling Sunday):
in-period TAIL days (in a week that settles next period) must stay visible to in-house pay and
to the period-aligned close TOCTOU. The engine prices only days inside
settlingWeeks(period), so the extra tail entries don't change outsourced pay. - Assignment selection is deterministic (stable query ordering + pickAssignmentsPerContractor), so the separate preview and close runs price the identical rate.
- Leave rows are fetched for every scope contractor; payForAssignment routes them only to an in-house admin's primary assignment.
Read-only: queries but persists nothing.