Function: mergeHistory()
mergeHistory(
payments,entries,ctx):HistoryRow[]
Defined in: src/lib/payroll/insights.ts:409
Merge a contractor's saved payments and payable time entries by pay period. The row set is the UNION of both sides, newest first — periods with time but no statement surface too (a worked-but-never-paid gap detector), as do statements with no time entries.
Entry membership is by payPeriodForDate, NOT the calendar period: outsourced pay settles
by ISO-week Sunday (ADR-0044), so a period's tail days belong to the NEXT period's run.
Parameters
payments
readonly HistoryPaymentInput[]
entries
readonly object[]