Overview
SushiGo’s attendance tracking system captures employee work time with precision, including check-in/check-out times, lunch breaks, lateness tracking, and day status classification. This data feeds into payroll calculations, punctuality bonuses, and overtime management.Core Concepts
Attendance Record
Each Attendance record represents one employee’s work for one calendar date:Day Status Types
Defined inDayStatus enum:
| Status | Code | Description |
|---|---|---|
| Worked | WORKED | Normal working day with check-in/check-out |
| Day Off | DAY_OFF | Scheduled day off (no work expected) |
| Leave | LEAVE | Approved leave (paid or unpaid) |
| Vacation | VACATION | Approved vacation day |
| Holiday | HOLIDAY | Public/company holiday |
| Absence | ABSENCE | Unexcused absence |
| Extra | EXTRA | Negotiated extra day (special pay) |
Day status determines how the day is treated in payroll calculations, particularly for bonuses and rest day calculations.
Daily Attendance Flow
Manager’s “Today” View
The primary interface for attendance is the Today View, which shows all employees for a branch:Manager opens Today view
GET
/api/v1/attendances/today?branch_id={branch_id}Returns all active employees for the branch with their attendance record for today (null if not yet recorded)Manager records lunch breaks
When employees take lunch, manager records start and end times (optional)
Manager records check-outs
At end of day, manager records departure time and authorizes overtime if applicable
Today View API Response
- Employees with
attendance: nullhave not checked in yet today - List ordered by
last_name,first_nameascending - Only shows employees with active employment period for the specified branch
Lateness Tracking
Entry Lateness (Check-in)
When an employee checks in, the system compares actual arrival time against their scheduled start time:Example: Lateness Calculation
| Expected | Actual | Late Seconds | Late Minutes | Deductible? | Deduction |
|---|---|---|---|---|---|
| 08:00:00 | 08:15:00 | 900 | 15 | No | $0 |
| 08:00:00 | 08:30:00 | 1800 | 30 | No | $0 |
| 08:00:00 | 08:30:01 | 1801 | 30 | Yes | 30 min pay |
| 08:00:00 | 09:00:00 | 3600 | 60 | Yes | 60 min pay |
| 08:00:00 | 10:15:00 | 8100 | 135 | Yes | 135 min pay |
Lunch Return Lateness
Same logic applies to returning from lunch:lunch_end vs scheduled lunch end time from employee’s schedule
Lateness Helpers
The model provides helper methods:Time Calculations
Net Worked Minutes
Total time worked, excluding lunch break:- Check-in: 08:00
- Lunch start: 13:00 (worked 5 hours = 300 min)
- Lunch end: 14:00 (lunch = 1 hour = 60 min)
- Check-out: 18:00 (worked 4 more hours = 240 min)
- Net worked: 300 + 240 = 540 minutes (9 hours)
Overtime Minutes
Minutes worked beyond scheduled hours:Overtime is only calculated when
net_worked_minutes exceeds the scheduled hours from the employee’s schedule for that day.- Scheduled: 8 hours (480 minutes)
- Net worked: 540 minutes
- Overtime: 540 - 480 = 60 minutes
Overtime Authorization
Business Rule (RF-47, RN-11)
Authorization Fields
Authorization Flow
Manager decides
Option A: Authorize for payment → Sets
overtime_authorized = trueOption B: Don’t authorize → Sets overtime_authorized = falseOvertime Valuation (RF-47b, RF-47c, DC-03)
When overtime is authorized for payment, valuation method is determined by employee’s configuration:- Method 1: Proportional to Wage
- Method 2: Agreed Hourly Rate
Overtime valued using LFT (Mexican labor law) criteria:
- Hours 1-9 (first overtime hours): 2× hourly rate
- Hours 10+ (excessive overtime): 3× hourly rate
- Regular: 8 hours × 800
- Overtime (2 hours): 2 hours × 400
- Total pay: $1,200
Valuation configuration is stored per employee with effective-dated history, allowing rates to change over time.
Punctuality Bonus System
SushiGo Punctuality Rules (RF-32, RF-33, RN-01, RN-02)
Punctuality bonus is calculated based on lateness ranges:| Lateness | Bonus Percentage |
|---|---|
| 0:00 to 9:59 min | 100% |
| 10:00 to 14:59 min | 50% |
| 15:00 to 20:59 min | 25% |
| 21:00 to 25:59 min | 10% |
| 26:00+ min | 0% |
Lateness is computed with seconds precision. Arriving at 09:59 is still 100% bonus, but 10:00 drops to 50%.
Weekly Bonus Base Amounts
Configured per employee/group (RF-33):- $110 group: Angela, Adonais, Moni (divided by 6 working days)
- $100 group: Most employees (divided by 6 working days)
- $50 group: Samantha (divided by 3 working days)
Daily Bonus Calculation
Bonus Exclusions (RF-35, RF-40, RN-03, RN-04)
Day Off
Empty cells (DAY_OFF status) do not receive bonus
Negotiated Extra Day
EXTRA status days are paid separately, bonus does not apply
Per-Employee Exceptions
Example: Andrea Tue/Wed/Thu = 0% (configurable)
Partial Leave
Overview (RF-25a, RF-25b, RF-25c)
Partial leave covers situations where an employee:- Arrives late (with permission)
- Leaves early (with permission)
- Takes time during the day (e.g., medical appointment)
Paid vs Unpaid
- Unpaid Partial Leave
- Paid Partial Leave
Rule (RN-00d): Deduct pay for exact time taken, minute by minuteExample:
- Leave: 2 hours (120 minutes)
- Wage: 2.0833/min
- Deduction: 120 min × 250
Partial Leave Fields
Stored inPartialLeave model (AP-020, pending implementation):
Related Models and Relationships
Employee Schedule
Attendance system requires employee schedules to:- Determine expected check-in/check-out times
- Calculate lateness
- Identify overtime
- Prorate punctuality bonuses
See Employee Schedules for complete schedule configuration details.
Wage History
Attendance integrates with wage history for:- Pay deductions (lateness > 30 min)
- Unpaid partial leave calculations
- Overtime valuation
Employment Period
Attendance records are created only for employees with an active employment period at the branch on that date. Query pattern fromTodayAttendanceController.php:76:
Audit and Confirmation
Confirmed By
Theconfirmed_by field tracks who validated/confirmed the attendance record:
- Manager confirms end-of-day attendance
- Admin makes historical corrections
- System tracks accountability
Audit Trail
Attendance records use theAuditable trait (from Attendance.php:16):
The Auditable trait automatically tracks
created_by, updated_by, and timestamps for all changes to attendance records.Future Features (Pending Implementation)
Partial Leaves
Status: AP-020 pendingFull partial leave tracking with type classification and pay impact
Overtime Bank
Status: AP-034 pendingBank system to track earned, used, and paid overtime hours with movements
Employee Self Check-in
Status: FutureMobile app for employees to check in/out themselves
Biometric Integration
Status: FutureIntegration with fingerprint or face recognition systems
Best Practices
Record Times Promptly
Record check-in/check-out as they happen to maintain accuracy
Review Before Close
Managers should review all attendance before closing the pay period
Document Exceptions
Use
meta field to note unusual circumstances or special casesAuthorize Overtime Explicitly
Never leave overtime authorization ambiguous - decide at check-out time
Related Documentation
Employee Schedules
Configure expected work times for lateness and overtime calculations
Wage History
Understand how wages integrate with attendance pay calculations
Payroll Calculation
Complete payroll calculation logic using attendance data
Attendance Module Spec
Full attendance module specification (RF-11 through RF-21)