Overview
SushiGo maintains a complete history of employee wages using effective-dated records. This allows the system to track wage changes over time, apply the correct wage for payroll calculations in any period, and maintain an audit trail of compensation changes.Why Effective-Dated History?
Traditional systems might simply update an employee’s current wage, losing historical data. Effective-dated history solves several business problems:Historical Accuracy
Calculate past payroll periods with the wages that were actually in effect at that time
Future Planning
Schedule wage increases in advance with a future effective date
Audit Trail
Complete record of all wage changes for compliance and review
Retroactive Corrections
Close previous wage records and create new ones if errors are discovered
Data Model
WageHistory Fields
Key Concepts
Hourly Rate
Hourly Rate
The amount paid per hour worked. Must be strictly greater than zero.Examples:
125.00- $125.00 per hour85.50- $85.50 per hour
Weekly Scheduled Hours
Weekly Scheduled Hours
The standard number of hours the employee is scheduled to work per week. Used to calculate full-time equivalency and proportional benefits.Examples:
48.00- Standard full-time (6 days × 8 hours)40.00- 5-day work week24.00- Part-time employee
Effective From
Effective From
The date when this wage becomes effective. Can be:
- Past date: Retroactive wage (e.g., correcting historical records)
- Current date: Immediate wage change
- Future date: Scheduled wage increase
System uses this date to determine which wage applies for payroll calculations
Effective To
Effective To
The last date this wage is valid. After this date, the next wage record takes effect.
- NULL: Currently active wage (open-ended)
- Date value: Wage was replaced or closed on this date
Only one wage record should have
effective_to = NULL per employee (the current wage)Validation Rules
The validation rules are defined as constants inWageHistory.php:22:
Field Requirements
| Field | Required | Type | Constraints |
|---|---|---|---|
hourly_rate | Yes | Numeric | Must be > 0 |
weekly_scheduled_hours | Yes | Numeric | Must be > 0 |
effective_from | Yes | Date | ISO 8601 format |
effective_to | No | Date | Must be ≥ effective_from if provided |
Creating Wage Records
Initial Wage
When an employee is created, you’ll typically create their initial wage record:effective_to is null, indicating this is the current active wageWage Increase
To give an employee a raise, create a new wage record:Create new wage record
Create a new
WageHistory record with the increased rate and new effective_from dateSystem closes previous wage
The system automatically sets
effective_to on the previous wage record to the day before the new wage’s effective_fromThis automation may be implementation-specific. Check your actual API behavior.
Querying Wage History
Get Current Wage
To find the wage effective on a specific date, use theeffective() scope:
effective() scope is defined in WageHistory.php:64:
Logic Explanation
A wage is effective on a date when:- effective_from ≤ date: The wage has started
- AND either:
- effective_to IS NULL: The wage is currently active, OR
- effective_to ≥ date: The wage hasn’t ended yet
Example: Wage Effective Date Logic
Example: Wage Effective Date Logic
Wage Records:Query Results:
effective('2026-02-15')→ $100.00/hr (first record)effective('2026-03-15')→ $110.00/hr (second record)effective('2026-04-15')→ $120.00/hr (third record, current)effective('2026-05-15')→ $120.00/hr (third record, still current)
Get All Wage History
To retrieve complete wage history for an employee:Employee.php:94:
Calculations
Per-Minute Rate
TheWageHistory model provides a helper to calculate the per-minute rate:
This is used for calculating pay deductions when employees are late or take unpaid partial leave (RF-15b, RF-25b).
Weekly Base Pay
To calculate weekly base pay:Daily Rate (Proportional)
For daily wage calculations:Common Scenarios
Scenario 1: New Employee Initial Wage
Scenario 2: Scheduled Future Raise
Scenario 3: Retroactive Wage Correction
Scenario 4: Change from Full-Time to Part-Time
Payroll Integration
Pay Period Calculation
When calculating pay for a period:Calculate daily pay
Use the effective wage’s
hourly_rate and weekly_scheduled_hours for that day’s calculationsIf wage changes mid-period, the system automatically uses the correct wage for each portion of the period.
Example: Wage Change Mid-Period
Pay Period: March 27 - April 2, 2026 (Thu-Wed) Wages:- $100/hr until March 31
- $110/hr starting April 1
| Date | Wage | Hours | Pay |
|---|---|---|---|
| Mar 27 | $100/hr | 8 | $800 |
| Mar 28 | $100/hr | 8 | $800 |
| Mar 29 | $100/hr | 8 | $800 |
| Mar 30 | $100/hr | 8 | $800 |
| Mar 31 | $100/hr | 8 | $800 |
| Apr 1 | $110/hr | 8 | $880 |
| Apr 2 | $110/hr | 8 | $880 |
| Total | 56 hrs | $5,760 |
System automatically applies correct wage for each day without manual intervention
Validation Errors
Best Practices
Never Delete Wages
Always close wage records with
effective_to instead of deleting. Maintains complete audit trail.Schedule in Advance
Create future wage records to automate raises. System applies automatically on effective date.
Document Changes
Use
meta field or notes to record reason for wage changes (promotion, cost of living, etc.)Validate Before Close
Verify wage calculations are correct before closing a pay period
Related Documentation
Creating Employees
Learn how to create employees and set initial wages
Attendance Tracking
How wages integrate with attendance and payroll
Payroll Calculation
Detailed payroll calculation logic using wage history
API Reference
Complete API documentation for wage management