{{-- ── Header ── --}}
M.D.S
Payroll History Report
From: {{ $fromDate ? \Carbon\Carbon::parse($fromDate)->format('d/m/Y') : '—' }}, Till: {{ $toDate ? \Carbon\Carbon::parse($toDate)->format('d/m/Y') : '—' }} @if($selectedEmployee)  |  Employee: {{ $selectedEmployee->first_name }} {{ $selectedEmployee->last_name }} @endif @if($selectedDepartment)  |  Dept: {{ $selectedDepartment->name }} @endif
@if(empty($reportData['departments']))

No records found.

@else @php /* Helper: show number or blank */ $n = fn($v) => $v ? number_format($v, 0) : ''; /* Helper: show number or blank, but force 0 when value is explicitly 0 */ $n0 = fn($v) => number_format($v, 0); /* Helper for hours — show with 2 decimals */ $h = fn($v) => $v ? number_format($v, 2) : ''; @endphp @foreach($reportData['departments'] as $deptName => $deptData) {{-- Department Header --}} @foreach($deptData['rows'] as $row) {{-- ✅ FIXED: was rendering blank due to missing fallback --}} @endforeach {{-- Sub Total --}} @endforeach {{-- Grand Total --}}
Employee EmpID Sal.
Type
From To Salary OT
Hours
OT
Amount
Award Absent
Days
Absent
Amt
Other
Ded.
Advance
Ded.
Loan
Ded.
Net Payable
{{ $deptName }}
{{ $row['employee_name'] }} {{ $row['employee_no'] }} {{ $row['salary_type'] }} {{ $row['from'] }} {{ $row['to'] }} {{ $n($row['salary']) }} {{ $h($row['ot_hours']) }} {{ $n($row['overtime']) }} {{ $n($row['award']) }} {{ $row['absent_days'] ?: '' }} {{ $n($row['absent_amount']) }} {{ $n($row['other_ded']) }} {{ $n($row['advance_ded']) }}{{ $n($row['loan_ded']) }} {{ $n0($row['net_payable']) }}
Sub Total => {{ $n0($deptData['subSalary']) }} {{ $h($deptData['subOtHours']) }} {{ $n($deptData['subOvertime']) }} {{ $n($deptData['subAward']) }} {{ $deptData['subAbsentDays'] ?: '' }} {{ $n($deptData['subAbsentAmount']) }} {{ $n($deptData['subOtherDed']) }} {{ $n($deptData['subAdvanceDed']) }} {{ $n($deptData['subLoanDed']) }} {{ $n0($deptData['subNet']) }}
Grand Total => {{ $n0($reportData['grandGross']) }} {{ $h($reportData['grandOtHours']) }} {{ $n($reportData['grandOvertime']) }} {{ $n($reportData['grandAward']) }} {{ $reportData['grandAbsentDays'] ?: '' }} {{ $n($reportData['grandAbsentAmount']) }} {{ $n($reportData['grandOtherDed']) }} {{ $n($reportData['grandAdvanceDed']) }} {{ $n($reportData['grandLoanDed']) }} {{ $n0($reportData['grandNet']) }}
@endif