diff --git a/app/Services/PayrollService.php b/app/Services/PayrollService.php index e6887c6cb..7e87f7321 100644 --- a/app/Services/PayrollService.php +++ b/app/Services/PayrollService.php @@ -58,7 +58,7 @@ class PayrollService $earnedBasicSalary = 0; $holidayPay = 0; - $restDayPremium = 0; + $holidayDaysNotWorked = 0; $regularOtTotal = 0; $nightDiffAmount = 0; $paidLeavesCount = 0; @@ -183,9 +183,8 @@ class PayrollService $premium = ($earnedDaily - $actualDailyRate); if ($isRegularHoliday || $isSpecialHoliday) { $holidayPay += $premium; - } else { - $restDayPremium += $premium; } + // Rest Day Premium removed per client request } // 2. Overtime Calculation (Compounded) @@ -233,12 +232,9 @@ class PayrollService $daysWorked++; // Treat as paid day $paidLeavesCount++; } elseif ($isRegularHoliday) { - if ($isDailyWage) { - // Daily/Rank & File: DOLE requires 100% holiday pay even if not worked - $holidayPay += $actualDailyRate; - } - // Monthly employees: their fixed cut-off salary already covers this day. - // No additional holiday pay needed. Don't count as absence. + // All employees: extract holiday as separate earning line + $holidayPay += $actualDailyRate; + $holidayDaysNotWorked++; } else { // Only count as absent if NOT a rest day AND NOT a special holiday // Monthly employees' fixed salary covers special holidays automatically. @@ -267,8 +263,10 @@ class PayrollService // they get their exact fixed cut-off pay (Monthly / Divisor) $cutOffSalary = $grossMonthly / $divisor; - // Extract paid leaves from their basic salary to show it explicitly in the earnings - $earnedBasicSalary = max(0, $cutOffSalary - $paidLeavesAmount); + // Extract paid leaves AND holiday pay from basic to show them as separate line items + // This matches the client's expected payslip format: + // Basic = CutOff - Leaves - Holidays, then add them back as separate earning lines + $earnedBasicSalary = max(0, $cutOffSalary - $paidLeavesAmount - $holidayPay); // We explicitly deduct absent days (LWOP) $absenceDeduction = $absencesCount * $actualDailyRate; @@ -358,12 +356,10 @@ class PayrollService ['name' => 'Holiday Pay', 'amount' => number_format($holidayPay, 2, '.', '')], ]); - if ($restDayPremium > 0) { - $earnings[] = ['name' => 'Rest Day Premium', 'amount' => number_format($restDayPremium, 2, '.', '')]; - } + // Rest Day Premium removed per client request // 7. Totals (Intermediate for Tax) - $totalEarnings = $earnedBasicSalary + $paidLeavesAmount + $nightDiffAmount + $regularOtTotal + $holidayPay + $restDayPremium; + $totalEarnings = $earnedBasicSalary + $paidLeavesAmount + $nightDiffAmount + $regularOtTotal + $holidayPay; // 8. Withholding Tax Calculation (Based on Gross per user request) $tax = 0.00; @@ -419,7 +415,7 @@ class PayrollService 'reg_ot_hours' => number_format($totalOvertimeHours, 2), 'reg_ot_amount' => $regularOtTotal, 'night_diff_amount' => $nightDiffAmount, - 'holiday' => $holidayPay, + 'holiday' => $holidayDaysNotWorked, ] ]; } diff --git a/resources/views/payslips/template.blade.php b/resources/views/payslips/template.blade.php index 32d0fa6f9..6988bd112 100755 --- a/resources/views/payslips/template.blade.php +++ b/resources/views/payslips/template.blade.php @@ -278,7 +278,7 @@