# Static Statutory Matrix Sync ## Goal Description The client is employing manually calculated, explicitly fixed **Monthly Statutory Deductions** across different employee brackets instead of letting the engine strictly compute dynamic percentage tiers (e.g., locking PhilHealth firmly at `₱250.00/mo` and Pag-IBIG at `₱200.00/mo`). Because `PayrollService.php` is currently configured to calculate aggressive exact tax brackets according to 2026 Philippine strict tables, it causes minor deduction drift compared to what the client physically expects here. Our goal is to structurally add "Fixed Statutory Overrides" so the engine uses the client's manually assigned values if they exist, but falls back to standard strict math if not. ## User Review Required > [!IMPORTANT] > Since standard tax components are usually mathematically derived, this plan will inject explicit Override columns onto the `employee_salaries` table. This guarantees the exact numeric values the client requested are preserved accurately across cutoffs. Do you approve of this architecture? ## Proposed Changes ### Phase 1: Database Migration #### [NEW] database/migrations/..._add_fixed_statutory_to_salaries_table.php Add `decimal('sss_fixed', 8, 2)->nullable()`, `philhealth_fixed`, and `pagibig_fixed` to the `employee_salaries` table scheme. ### Phase 2: Model Configuration #### [MODIFY] app/Models/EmployeeSalary.php Expose the new override columns to the `$fillable` array so they can be injected into the system. ### Phase 3: Payroll Engine Realignment #### [MODIFY] app/Services/PayrollService.php Adjust the `calculateForPeriod` engine to mathematically respect the fixed assignment. If it detects a fixed value on the profile, use it. Otherwise, calculate strictly. ```php $sssMonthly = $salaryData->sss_fixed ?? ($msc * 0.045); $philhealthMonthly = $salaryData->philhealth_fixed ?? ($grossMonthly * 0.025); $pagibigMonthly = $salaryData->pagibig_fixed ?? 200; ``` ### Phase 4: Data Synchronization Run a quick injection mapping mapping the client's explicit targets: - **Ana/Paul:** SSS: 585 | PHIC: 250 | Pag-IBIG: 200 - **Princess/Dinh:** SSS: 450 | PHIC: 250 | Pag-IBIG: 200 ## Verification Plan We will completely wipe the generated slips again natively and re-run `payroll:simulate`. Once complete, Ana's cutoff deductions will evaluate strictly to: - SSS: 292.50 - PHIC: 125.00 - HDMF: 100.00 Producing a flawless Net Pay.