# DOLE Compliance & HRIS Gap Analysis Document > Strategic approach to bridging the gaps identified between current system capabilities and QA DOLE requirements. --- ## 1. Timekeeping & Attendance Engine **The Gap:** The system fails to process fundamental DOLE timekeeping rules. It lacks grace periods, does not separate tardiness from undertime, and fails to identify Night Differential (ND) hours. **Target State:** Attendance processing accurately reflects grace periods, separates late/undertime penalties, and tags specific hours for Night Differential (10:00 PM to 6:00 AM). **Technical Approach:** - **Refactor `AttendanceRecord::processAttendance()`:** - Fetch the `grace_period` from the assigned `Shift`. If clock-in is within the grace period, `late_minutes = 0`. - Calculate `late_minutes` (Tardiness) and `early_departure_minutes` (Undertime) as two distinct metrics. - Implement a time-check algorithm to identify how many hours of the shift fall between 10:00 PM and 6:00 AM, storing this in a new `night_diff_hours` column. ## 2. Payroll Engine: DOLE Compounding Multipliers **The Gap:** The system acknowledges Holidays and Overtime but fails to apply DOLE's compounding premium multipliers (e.g., Working OT on a Regular Holiday = 260%). **Target State:** The `PayrollService` mathematically applies the correct multiplier based on the overlapping conditions of the day (Rest Day, Holiday, OT, ND). **Technical Approach:** - **Upgrade `App\Services\PayrollService`:** - Build a DOLE Matrix lookup function that calculates the `Effective Multiplier`. - **Logic Flow:** Base Rate (100%) -> Check Holiday (e.g., x 2.00) -> Check Rest Day (e.g., x 1.30) -> Check OT (e.g., x 1.30) -> Check ND (e.g., x 1.10). - Update `PayrollRunController` to display these distinct premium earnings on the payslip. - **Preceding Day Rule:** Add a query to check if the employee was `present` or on `paid_leave` the day before a holiday to determine if they qualify for holiday pay. ## 3. Leave Management & UI Handling **The Gap:** All leaves are treated as unpaid absences. Service Incentive Leave (SIL) and Maternity/Paternity logic are missing. The UI abruptly exits when a user has a zero leave balance, and there is no "Leave Without Pay (LWOP)" option. **Target State:** Paid leaves do not deduct from the salary. LWOP is available. UI gracefully handles zero balances. **Technical Approach:** - **Backend Fixes:** - Modify `LeaveApplication->createAttendanceRecords()` to flag `is_paid` based on the `LeaveType`. - Ensure `PayrollService` ignores `paid_leave` days when calculating `unpaid_leave_deduction`. - Add "Leave Without Pay" (LWOP) to the standard database seeders/Leave Types. - **Frontend Fixes:** - Catch the zero-balance exception in the Vue/Inertia frontend and display a user-friendly toast/modal instead of crashing. - Remove the Calendar view in the Shifts module as requested by QA. ## 4. Statutory Automation (SSS, PhilHealth, Pag-IBIG) **The Gap:** Deductions are mathematically sound but currently require manual entry by HR. **Target State:** Statutory deductions auto-calculate based on the employee's gross basic salary and current Philippine brackets. **Technical Approach:** - **Implement Contribution Tables:** - Create a configuration file or a database table `StatutoryBrackets` that holds the latest 2024/2025 SSS, PhilHealth (e.g., 5%), and HDMF (e.g., ₱200 max) limits. - Update `PayrollService` to calculate the `employee_share` automatically based on their `basic_salary`. --- ## Proposed Execution Roadmap To ensure stability without breaking the current working setup, we will implement these fixes in three controlled phases: - **Phase 1: Timekeeping & Leave Architecture** - Implement Grace Periods, Tardiness vs. Undertime. - Fix the Leave Engine (Paid vs. Unpaid, adding LWOP). - Apply UI fixes (Zero balance handling, remove Shift Calendar). - **Phase 2: The DOLE Payroll Engine** - Integrate the DOLE Multiplier Matrix into `PayrollService`. - Build the Night Differential hour tracker. - Apply the Preceding Day Rule for holidays. - **Phase 3: Statutory Automation** - Implement the SSS, PhilHealth, and Pag-IBIG bracket auto-computation. - Final end-to-end testing against the QA Excel formulas.