# Payslip gross and net reconciliation ## Confirmed issue For employee 10844, the payroll list calculates total earnings as: | Component | Amount | | --- | ---: | | Applied base pay | PHP 5,968.75 | | Holiday pay | PHP 500.00 | | Leave pay | PHP 500.00 | | Allowances | PHP 250.00 | | Total earnings | PHP 7,218.75 | The printed payslip displayed the same holiday and leave rows but calculated its gross total without both values. Its displayed gross was PHP 6,218.75 and its net was PHP 1,000.00 too low. ## Calculation rule All payroll views use `calculatePayrollTotals`: ```text Gross pay = base pay + overtime pay + holiday pay + leave pay Total earnings = gross pay + other income Net pay = total earnings - government deductions - tax - loan deduction - attendance deductions - other deductions ``` `printPayrollPayslip.jsx` must pass holiday and leave pay to every call that calculates the printed gross, deductions, or net. The list, print summary, export, and payslip must therefore reconcile from the same source fields. ### Retroactive pay Retroactive pay is income. The payslip adds it to other income and prints a **Retroactive Pay** earning row when the amount is non-zero. The source precedence must match the payroll list: 1. `total_retro_applied` 2. `retro_amount_cached` 3. `retro_total` or `total_retro` 4. Sum of `retro_entries` The print template previously skipped `retro_amount_cached`, so a cached retro amount could appear in review but be missing from the printed total. ### Printed gross separator The apparent erasure line under the earnings rows is the template's 2px `thick` divider before **GROSS TOTAL**. It is a styling artifact, not payroll data. Replace it with normal spacing so it cannot resemble a crossed-out earnings row on a physical print. ### Print-safe edge inset The print stylesheet removed body padding and relied on a 4 mm page margin. On some printers that leaves the first grid payslip too close to the non-printable left edge, which can clip or weaken its border. Grid printing reserves 8 mm from every paper edge: a 5 mm `@page` margin plus a 3 mm grid inset. POS printing remains unchanged. ## Impact and safety - Affected client module: `printPayrollPayslip.jsx`. - No database schema, migration, API, or stored payroll data changes. - The fix changes only derived display values for printing. Finalized payroll continues to use the server net amount when supplied. - Main compatibility risk: a print row with missing holiday/leave fields remains unchanged because both values default to zero. ## Acceptance criteria - A payslip with PHP 500 holiday pay and PHP 500 leave pay includes PHP 1,000.00 in its gross and net. - Printed total deduction remains unchanged for the same deduction fields. - The printed gross, total deductions, and net reconcile with the payroll list for live payroll.