@extends('layouts.app') @section('content')
Salary Deduction Details for Check Number: {{ $checkNumber }} [ {{ $firstName }} {{ $middleName }} {{ $lastName }} ]

@foreach($deductionTypes as $type) @endforeach @php $columnTotals = array_fill_keys($deductionTypes, 0); // Initialize totals array $balanceTotals = array_fill_keys($deductionTypes, 0); // Initialize balance totals array @endphp @foreach($formattedData as $year => $months) @foreach($months as $month => $deductions) @foreach($deductionTypes as $type) @php $amount = $deductions[$type] ?? 0; $balance = $deductions[$type . '_balance'] ?? 0; $columnTotals[$type] += $amount; $balanceTotals[$type] += $balance; @endphp @endforeach @endforeach @endforeach @foreach($deductionTypes as $type) @endforeach
DATE{{ $type }} DEDUCTION {{ $type }} Balance
{{ $year }}
{{ $month }}{{ number_format($amount, 2) }} {{ number_format($balance, 2) }}
Total{{ number_format($columnTotals[$type], 2) }} N/A
@endsection