Files
HRM-System/docs/PLAN-payroll-parallel-2.md

29 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Project Plan: Payroll Parallel 2 Fixes
## Context & Recommendations
1. **Daily Wage Configuration Recommendation:**
- **Pay Frequency:** `daily`
- **Payroll Type:** `automatic`
- **Statutory Contributions:** Encode their **Full Monthly Amount** in the Salary Components tab. Our new logic will automatically divide this by the Payroll Run frequency (e.g., divide by 2 for semi-monthly runs). This prevents double-deductions.
2. **Overtime Logic:** Overtime will be strictly tied to an approved record in `overtime_applications`. Automatic calculation from late clock-outs will be disabled for payroll generation.
3. **Night Differential:** ND will revert to standard computation (10% of the employee's standard hourly rate) without being inflated by phantom OT.
## Phase 1: Statutory Deductions Divisor (Double Deductions Fix)
- Modify `PayrollService.php` to derive the `$divisor` from `$payrollRun->payroll_frequency` instead of `$employee->pay_frequency`.
- Ensure a `semi-monthly` payroll run correctly applies a divisor of `2` regardless of whether the employee is `daily` or `monthly`.
## Phase 2: Overtime Approval Enforcement
- Update `PayrollService.php` to fetch `overtime_applications` for the date range where `status = 'approved'`.
- Calculate Overtime Earnings *only* using the `approved_hours` from these explicit applications.
- Ignore the raw `overtime_hours` tally stored in `AttendanceRecord`.
## Phase 3: Night Differential & Leave Reflection Fix
- Verify Night Differential multiplier correctly targets the base hourly rate.
- Update UI template or API responses if necessary to ensure the custom `Paid Leaves` earnings array item correctly displays on the payslip PDF.
## Phase X: Verification
- Regenerate a test payroll run for Dinh Chavez and verify SSS/PH/PI deduct exactly half of the encoded monthly amount.
- Verify Dinh Chavez receives 0 Overtime pay since no approved application exists.
- Verify Night Differential calculates perfectly at `(Hourly Rate × 10%) × ND Hours`.
- Verify Birthday/Vacation leave appears explicitly in Earnings.