@php use App\Models\FMS\PPACodes; $ppaCodes = PPACodes::query()->get(); $item = $data; @endphp
@php foreach ($item as $key => $value) { $total = 0; @endphp @foreach($ppaCodes as $ppa) @php $index = preg_replace('/\s+/', '',$ppa->desc); @endphp @foreach($value['amount'] as $amountkey => $amountValue) @if($amountkey == $index) @php $total += $value['amount'][$amountkey]['total']; @endphp @endif @endforeach @endforeach @php if(count($value['children']) > 0){ foreach ($value['children'] as $i => $v) { @endphp @foreach($ppaCodes as $ppa) @php $index = preg_replace('/\s+/', '',$ppa->desc); @endphp @foreach($value['amount'] as $amountkey => $amountValue) @if($amountkey == $index) @php $total += $value['amount'][$amountkey]['total']; @endphp @endif @endforeach @endforeach @php }}} @endphp
Account Title Account code GASS STO Higher Education Advance Education Research Extension Total
{{ $value['title'] }} {{ $value['accountCode'] }} {{$value['amount'][$amountkey]['total']}}{{$total}}
{{ $v['title'] }} {{ $v['accountCode'] }} {{$value['amount'][$amountkey]['total']}}{{$total}}