payroll fix
This commit is contained in:
@@ -133,22 +133,28 @@ class PayrollService
|
||||
$regularOtTotal = $totalOvertimeHours * ($hourlyRate * 1.25);
|
||||
$nightDiffAmount = $nightDiffHours * ($hourlyRate * 0.10);
|
||||
|
||||
// 4. Statutory Contributions — based on FULL monthly salary bracket (PH law)
|
||||
$msc = min(floor($grossMonthly / 500) * 500, 30000);
|
||||
|
||||
$sssMonthly = $salaryData->sss_fixed ?? ($msc * 0.045);
|
||||
$philhealthMonthly = $salaryData->philhealth_fixed ?? ($grossMonthly * 0.025);
|
||||
if ($salaryData && is_null($salaryData->philhealth_fixed) && $grossMonthly <= 10000) $philhealthMonthly = 250;
|
||||
if ($salaryData && is_null($salaryData->philhealth_fixed) && $grossMonthly >= 100000) $philhealthMonthly = 2500;
|
||||
|
||||
$pagibigMonthly = $salaryData->pagibig_fixed ?? (100 * $divisor);
|
||||
|
||||
$sssCutoff = $sssMonthly / $divisor;
|
||||
$phCutoff = $philhealthMonthly / $divisor;
|
||||
$pagibigCutoff = $pagibigMonthly / $divisor;
|
||||
|
||||
// 4. Statutory Contributions — only if employee has earnings (prevents negative payroll)
|
||||
$sssCutoff = 0;
|
||||
$phCutoff = 0;
|
||||
$pagibigCutoff = 0;
|
||||
$tax = 0.00;
|
||||
|
||||
if ($daysWorked > 0) {
|
||||
// Based on FULL monthly salary bracket (PH law)
|
||||
$msc = min(floor($grossMonthly / 500) * 500, 30000);
|
||||
|
||||
$sssMonthly = $salaryData->sss_fixed ?? ($msc * 0.045);
|
||||
$philhealthMonthly = $salaryData->philhealth_fixed ?? ($grossMonthly * 0.025);
|
||||
if ($salaryData && is_null($salaryData->philhealth_fixed) && $grossMonthly <= 10000) $philhealthMonthly = 250;
|
||||
if ($salaryData && is_null($salaryData->philhealth_fixed) && $grossMonthly >= 100000) $philhealthMonthly = 2500;
|
||||
|
||||
$pagibigMonthly = $salaryData->pagibig_fixed ?? (100 * $divisor);
|
||||
|
||||
$sssCutoff = $sssMonthly / $divisor;
|
||||
$phCutoff = $philhealthMonthly / $divisor;
|
||||
$pagibigCutoff = $pagibigMonthly / $divisor;
|
||||
}
|
||||
|
||||
// 5. Build earnings array
|
||||
$earnings = [
|
||||
['name' => 'Basic Salary', 'amount' => number_format($earnedBasicSalary, 2, '.', '')],
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -309,11 +309,6 @@
|
||||
<td width="35%" style="text-transform: uppercase; font-weight: bold; border: 1px solid #ddd; padding: 4px 12px; background: #fff;">Tardiness</td>
|
||||
<td width="15%" style="border: 1px solid #ddd; padding: 4px 12px; text-align: right; background: #fff; font-weight: bold;"><?php echo e(formatCurrency($tardiness)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%"></td>
|
||||
<td width="35%" style="text-transform: uppercase; font-weight: bold; border: 1px solid #ddd; padding: 4px 12px; border-top: none; background: #fff;">Absences</td>
|
||||
<td width="15%" style="border: 1px solid #ddd; padding: 4px 12px; border-top: none; text-align: right; background: #fff; font-weight: bold;"><?php echo e(formatCurrency($absences)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%"></td>
|
||||
<td width="35%" style="text-transform: uppercase; font-weight: bold; border: 1px solid #ddd; padding: 4px 12px; border-top: none; background: #fff;">Undertime</td>
|
||||
@@ -324,9 +319,9 @@
|
||||
<div class="att-summary-title">Attendance Summary</div>
|
||||
<table class="att-grid">
|
||||
<tr>
|
||||
<td><strong>Days Worked:</strong> <?php echo e($summary['days_worked'] ?? 0); ?></td>
|
||||
<td><strong>Daily Rate:</strong> <?php echo e(formatCurrency($meta['daily_rate'] ?? 0)); ?></td>
|
||||
<td><strong>Days Worked:</strong> <?php echo e($summary['days_worked'] ?? 0); ?> / <?php echo e($summary['expected_working_days'] ?? '-'); ?></td>
|
||||
<td><strong>Absences:</strong> <?php echo e($summary['absences'] ?? 0); ?></td>
|
||||
<td><strong>Leaves:</strong> <?php echo e($summary['leaves'] ?? 0); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Expected Hours:</strong> <?php echo e(isset($summary['expected_hours']) ? $summary['expected_hours'].'h' : '0.00h'); ?></td>
|
||||
@@ -336,7 +331,7 @@
|
||||
<tr>
|
||||
<td><strong>Night Diff:</strong> <?php echo e(isset($summary['night_diff_hours']) ? $summary['night_diff_hours'].'h' : (isset($summary['night_diff']) ? $summary['night_diff'].'h' : '0h')); ?></td>
|
||||
<td><strong>Holiday:</strong> <?php echo e(isset($summary['holiday']) ? $summary['holiday'].'h' : '0h'); ?></td>
|
||||
<td></td>
|
||||
<td><strong>Leaves:</strong> <?php echo e($summary['leaves'] ?? 0); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
9338
u693027326_seb (2).sql
Normal file
9338
u693027326_seb (2).sql
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user