Skip to main content

Function: pickAssignmentsPerContractor()

pickAssignmentsPerContractor(rows): Map<string, PayAssignmentRow[]>

Defined in: src/lib/payroll/index.ts:136

Choose the active assignment per (contractor, facility) and group them by contractor — so a contractor working at MORE THAN ONE facility yields one assignment per facility. Each is paid as its own line (separate hours, rate, and proration) and the lines are combined into a single payout per contractor (see combineLinesIntoPayments). Versioning is per facility: the latest effective_date wins (then is_primary, then lowest id), so a rate change for the same facility is never double-counted. Deterministic for the preview/close to agree.

Parameters

rows

readonly PayAssignmentRow[]

Returns

Map<string, PayAssignmentRow[]>