fix: correctly calculate holiday premium addition for monthly earners
This commit is contained in:
@@ -58,6 +58,7 @@ class PayrollService
|
||||
|
||||
$earnedBasicSalary = 0;
|
||||
$holidayPay = 0;
|
||||
$holidayPremiumPay = 0;
|
||||
$holidayDaysNotWorked = 0;
|
||||
$regularOtTotal = 0;
|
||||
$nightDiffAmount = 0;
|
||||
@@ -192,6 +193,7 @@ class PayrollService
|
||||
$premium = ($earnedDaily - $proratedDailyRate);
|
||||
if ($isRegularHoliday || $isSpecialHoliday) {
|
||||
$holidayPay += $premium;
|
||||
$holidayPremiumPay += $premium;
|
||||
}
|
||||
// Rest Day Premium removed per client request
|
||||
}
|
||||
@@ -303,8 +305,10 @@ class PayrollService
|
||||
|
||||
// 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);
|
||||
// Basic = CutOff - Leaves - Holidays (only the unworked holiday portion), then add them back as separate earning lines
|
||||
// Any extra premium earned from working on a holiday is an addition, NOT deducted from base salary.
|
||||
$holidayPayNotWorked = max(0, $holidayPay - $holidayPremiumPay);
|
||||
$earnedBasicSalary = max(0, $cutOffSalary - $paidLeavesAmount - $holidayPayNotWorked);
|
||||
|
||||
// We explicitly deduct absent days (LWOP)
|
||||
$absenceDeduction = $absencesCount * $actualDailyRate;
|
||||
|
||||
Reference in New Issue
Block a user