Month Wise Blood Bank‐ Code Wise No of Team of different Blood Bank work with Association during financial Year : {{ str_replace('-', ' - ', $data['report_financial_year']) }}
@php // ✅ STEP 1: Extract ALL UNIQUE BB codes dynamically $bbCodes = []; foreach ($data['list'] as $monthData) { foreach ($monthData['MonthWisedata'] as $bb => $val) { if (!empty($bb)) { // ❌ skip empty key $bbCodes[$bb] = $bb; } } } ksort($bbCodes); // optional sorting // ✅ Initialize totals $grandTotals = []; foreach ($bbCodes as $bb) { $grandTotals[$bb] = 0; } $grandTotalAll = 0; @endphp @foreach ($bbCodes as $bb) @endforeach @foreach ($data['list'] as $month => $monthData) @php $rowTotal = 0; @endphp @foreach ($bbCodes as $bb) @php $value = $monthData['MonthWisedata'][$bb] ?? 0; $rowTotal += $value; $grandTotals[$bb] += $value; $grandTotalAll += $value; @endphp @endforeach @endforeach @foreach ($bbCodes as $bb) @endforeach
Month {{ $bb }} Tot Camp Dt
{{ date('M-Y', strtotime($monthData['MonthName'])) }} {{ $value }}{{ $rowTotal }}
Grand Total{{ $grandTotals[$bb] }}{{ $grandTotalAll }}