@foreach($months as $m) @endforeach @foreach($rows as $row) @foreach($months as $m) @php $key = $m['key']; $val = $row['monthly'][$key] ?? 0; @endphp @endforeach @endforeach @foreach($months as $m) @php $key = $m['key']; $sumForMonth = 0; foreach ($rows as $row) { $sumForMonth += $row['monthly'][$key] ?? 0; } @endphp @endforeach
Employee{{ $m['label'] }}Grand Total
{{ $row['user']->name }}{{ $val > 0 ? number_format($val, 2) : '' }}{{ number_format($row['grand_total'], 2) }}
Total{{ $sumForMonth > 0 ? number_format($sumForMonth, 2) : '' }}{{ number_format($overallTotal, 2) }}