Award Matrix Overview
Award Matrix Overview
The award matrix is the broader payroll/billing rules engine. It is implemented as a calculation snapshot layer beside live payroll and invoice workflows.
Main files:
AwardTimesheetCalculator.phpAwardTimesheetCalculationManager.phpTimesheetAwardCalculationSubscriber.phpTimesheetCalculation.phpTimesheetCalculationLine.php
Calculation flow
AwardTimesheetCalculator::calculate() builds a new TimesheetCalculation from a timesheet:
- Resolve ordinary-hours rule.
- Resolve employee classification.
- Resolve rate matrix.
- Resolve event rates.
- Build break preview.
- Split ordinary vs overtime hours.
- Calculate minimum shift top-up.
- Split overtime into buckets.
- Build special day preview lines.
- Build shift loading lines.
- Build travel lines.
- Build callout lines.
- Add ordinary, minimum shift, overtime, special day, shift loading, travel, callout, allowance, and expense/billing lines as applicable.
- Store source snapshots and totals.
Snapshot manager
AwardTimesheetCalculationManager::recalculate() supersedes existing draft/current calculations, creates a new calculation from the calculator, sets it to current, attaches it to the timesheet, and persists it.
Subscriber lifecycle
TimesheetAwardCalculationSubscriber listens on flush and post-flush. It queues timesheets when changes include:
TimesheetTimeEntryTimesheetAllowanceLineClientAllowance
Then after flush, it recalculates submitted, accepted, and approved timesheets. This post-flush pattern avoids trying to persist a full new calculation inside the same flush cycle.