@php /** * Provided vars: * $financial_year, $emp_id, $employee, $salarytypeDetails, $payroll_heads, $finalcialMonths, $type */ $stdByHeadId = collect($salarytypeDetails ?? [])->keyBy('head_id'); $computeDefault = function ($head) use ($stdByHeadId, $employee) { $std = $stdByHeadId->get($head['id'] ?? null); if (!$std) { return 0; } $fixed = (float) ($std->amount ?? 0); $pct = (float) ($std->parcentage ?? 0); $base = (float) ($employee->gross_salary ?? 0); return $pct > 0 ? round(($base * $pct) / 100, 2) : round($fixed, 2); }; $monthClass = [ 'january' => 'january', 'february' => 'february', 'march' => 'march', 'april' => 'april', 'may' => 'may', 'june' => 'june', 'july' => 'july', 'august' => 'august', 'september' => 'september', 'october' => 'october', 'november' => 'november', 'december' => 'december', ]; $dataTypeFor = function ($head) { $op = strtolower((string) ($head['operation_type'] ?? 'pay')); return $op === 'pay' ? 'pay' : 'deduct'; }; @endphp
@foreach ($finalcialMonths as $colIdx => $m) @endforeach @foreach ($payroll_heads as $rowIdx => $head) @php $defaultPerMonth = $computeDefault($head); $dtype = $dataTypeFor($head); @endphp @foreach ($finalcialMonths as $colIdx => $m) @php $cls = $monthClass[$m] ?? $m; @endphp @endforeach @endforeach @foreach ($finalcialMonths as $colIdx => $m) @php $id = $monthClass[$m] ?? $m; @endphp @endforeach
Head{{ $m }}Row Total
{{ $head['head_name'] }} {{ ucfirst($head['header_type'] ?? '') }} @if (!empty($head['pay_code'])) ยท {{ $head['pay_code'] }} @endif
0.00
Month Totals0.00 0.00
Tip: Values prefill from Pay Grades. Percentage entries are calculated from current gross salary ({{ number_format($employee->gross_salary, 2) }}). Use arrow keys to move between cells; Enter moves down.
{{-- Mini JS to enhance "Excel-like" behavior (works alongside your existing script) --}}