public update
This commit is contained in:
@@ -1 +1 @@
|
||||
a:5:{s:6:"_token";s:40:"hIL4fQEYzgfECNgnHSQszQykiTtHyE4TcpieiHLC";s:9:"_previous";a:1:{s:3:"url";s:31:"http://hrm.test/translations/en";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}s:50:"login_web_3dc7a913ef5fd4b890ecabe3487085573e16cf82";i:1;s:22:"PHPDEBUGBAR_STACK_DATA";a:2:{s:26:"01KPK8GW5J8MANADQ4GD1BBCQS";N;s:26:"01KPK8H4069S5B95MSYSG9NY0J";N;}}
|
||||
a:5:{s:6:"_token";s:40:"hIL4fQEYzgfECNgnHSQszQykiTtHyE4TcpieiHLC";s:9:"_previous";a:1:{s:3:"url";s:31:"http://hrm.test/translations/en";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}s:50:"login_web_3dc7a913ef5fd4b890ecabe3487085573e16cf82";i:1;s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}}
|
||||
@@ -182,16 +182,42 @@
|
||||
$earnings = array_values($rawEarnings);
|
||||
$deductions = array_values($payrollEntry->deductions_breakdown ?? []);
|
||||
|
||||
$grossMonthly = $meta['gross_monthly'] ?? 0;
|
||||
$dailyRate = $meta['daily_rate'] ?? 0;
|
||||
$payType = $meta['pay_type'] ?? 'Monthly';
|
||||
function extractAmount($array, $keywords) {
|
||||
$keywords = (array) $keywords;
|
||||
foreach ($array as $item) {
|
||||
if (!isset($item['name'])) continue;
|
||||
foreach ($keywords as $keyword) {
|
||||
if (stripos($item['name'], $keyword) !== false) {
|
||||
return $item['amount'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
$maxRows = max(count($earnings), count($deductions), 1);
|
||||
// Map dynamic earnings natively
|
||||
$basicSalary = extractAmount($earnings, 'Basic Salary') ?: $payrollEntry->basic_salary;
|
||||
$nightDiff = extractAmount($earnings, 'Night Diff');
|
||||
$overtime = extractAmount($earnings, ['Overtime', 'Reg. OT']);
|
||||
$holidayPay = extractAmount($earnings, 'Holiday');
|
||||
$adjustment = extractAmount($earnings, 'Adjustment');
|
||||
|
||||
// Map explicit deductions natively
|
||||
$undertimeDed = extractAmount($deductions, 'Undertime');
|
||||
$sss = extractAmount($deductions, 'SSS');
|
||||
$phic = extractAmount($deductions, 'PhilHealth');
|
||||
$hdmf = extractAmount($deductions, 'Pag-IBIG');
|
||||
$tax = extractAmount($deductions, ['Tax', 'Withholding']);
|
||||
|
||||
// Explicit penalties
|
||||
$tardiness = extractAmount($deductions, ['Late', 'Tardiness']);
|
||||
$absences = extractAmount($deductions, 'Absence');
|
||||
|
||||
$payType = $meta['pay_type'] ?? 'Monthly';
|
||||
|
||||
$formatter = class_exists('NumberFormatter') ? new \NumberFormatter("en", \NumberFormatter::SPELLOUT) : null;
|
||||
$words = $formatter ? ucwords($formatter->format($payrollEntry->net_pay)) . " Pesos Only" : "PHP " . $payrollEntry->net_pay;
|
||||
|
||||
// Handle decimals mechanically if there are cents
|
||||
if ($formatter && strpos((string)$payrollEntry->net_pay, '.') !== false) {
|
||||
$parts = explode('.', number_format($payrollEntry->net_pay, 2, '.', ''));
|
||||
$cents = (int)$parts[1];
|
||||
@@ -205,7 +231,7 @@
|
||||
<div class="company-name"><?php echo e($companySettings['titleText'] ?? 'Your Company Name'); ?></div>
|
||||
<div class="company-address"><?php echo e($companySettings['companyAddress'] ?? 'Your Company Address'); ?></div>
|
||||
<div class="payslip-title">PAYSLIP</div>
|
||||
<div class="payslip-period"><?php echo e(\Carbon\Carbon::parse($payrollEntry->pay_period_start)->format('M d, Y')); ?> - <?php echo e(\Carbon\Carbon::parse($payrollEntry->pay_period_end)->format('M d, Y')); ?> (<?php echo e($payType); ?>)</div>
|
||||
<div class="payslip-period"><?php echo e(\Carbon\Carbon::parse($payrollEntry->payrollRun->pay_period_start)->format('M d, Y')); ?> - <?php echo e(\Carbon\Carbon::parse($payrollEntry->payrollRun->pay_period_end)->format('M d, Y')); ?> (<?php echo e($payType); ?>)</div>
|
||||
</div>
|
||||
|
||||
<table class="info-grid">
|
||||
@@ -225,11 +251,10 @@
|
||||
<td class="info-label">Payment Date:</td>
|
||||
<td class="info-value"><?php echo e(\Carbon\Carbon::parse($payrollEntry->payrollRun->pay_date)->format('d M, Y')); ?></td>
|
||||
<td class="info-label">Status:</td>
|
||||
<td class="info-value"><?php echo e(ucfirst($payslip->status)); ?></td>
|
||||
<td class="info-value"><?php echo e(ucfirst($payrollEntry->payslip->status ?? 'Generated')); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<table class="main-table">
|
||||
<tr>
|
||||
<th width="35%">EARNINGS</th>
|
||||
@@ -237,19 +262,60 @@
|
||||
<th width="35%">DEDUCTIONS</th>
|
||||
<th width="15%" class="amt">AMOUNT</th>
|
||||
</tr>
|
||||
<?php for($i=0; $i<$maxRows; $i++): ?>
|
||||
<tr>
|
||||
<td><?php echo e(isset($earnings[$i]) ? $earnings[$i]['name'] : ''); ?></td>
|
||||
<td class="amt"><?php echo e(isset($earnings[$i]) ? formatCurrency($earnings[$i]['amount']) : ''); ?></td>
|
||||
<td><?php echo e(isset($deductions[$i]) ? $deductions[$i]['name'] : ''); ?></td>
|
||||
<td class="amt"><?php echo e(isset($deductions[$i]) ? formatCurrency($deductions[$i]['amount']) : ''); ?></td>
|
||||
<td>Basic Salary</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($basicSalary)); ?></td>
|
||||
<td>Undertime Deduction</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($undertimeDed)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-transform: uppercase;">Night Differential</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($nightDiff)); ?></td>
|
||||
<td>SSS Contribution (EE)</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($sss)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-transform: uppercase;">Overtime</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($overtime)); ?></td>
|
||||
<td>PhilHealth Contribution (EE)</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($phic)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-transform: uppercase;">Holiday Pay</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($holidayPay)); ?></td>
|
||||
<td>Pag-IBIG Contribution (EE)</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($hdmf)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-transform: uppercase;">Adjustment +</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($adjustment)); ?></td>
|
||||
<td>Withholding Tax</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($tax)); ?></td>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
<tr class="total-row">
|
||||
<td>Total Earnings</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($payrollEntry->gross_pay)); ?></td>
|
||||
<td>Total Deductions</td>
|
||||
<td class="amt"><?php echo e(formatCurrency($payrollEntry->deductions)); ?></td>
|
||||
<td class="amt"><?php echo e(formatCurrency($payrollEntry->total_deductions)); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Explicit Penalty Block as per Mockup -->
|
||||
<table width="100%" style="margin-bottom: 20px;">
|
||||
<tr>
|
||||
<td width="50%"></td>
|
||||
<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>
|
||||
<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($undertimeDed)); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -257,7 +323,7 @@
|
||||
<table class="att-grid">
|
||||
<tr>
|
||||
<td><strong>Days Worked:</strong> <?php echo e($summary['days_worked'] ?? 0); ?></td>
|
||||
<td><strong>Absences:</strong> <?php echo e($summary['absences'] ?? 0); ?> (<?php echo e(formatCurrency($summary['absence_amount'] ?? 0)); ?>)</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>
|
||||
@@ -275,13 +341,12 @@
|
||||
<div class="net-pay-box">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="net-label">Net Pay</td>
|
||||
<td class="net-amount"><?php echo e(formatCurrency($payrollEntry->net_pay)); ?></td>
|
||||
<td class="net-label">Net Pay: <?php echo e(\App\Models\Currency::getDefaultCurrency()->symbol ?? '?'); ?> <?php echo e(number_format($payrollEntry->net_pay, 2)); ?></td>
|
||||
<td class="net-amount"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="net-words">Amount in words: <?php echo e($words); ?></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php /**PATH /Users/dvapp/Documents/HRM/resources/views/payslips/template.blade.php ENDPATH**/ ?>
|
||||
Reference in New Issue
Block a user