@php $cc_id = -1; $transactions = $transactions->sortBy('cost_center_id')->values();; $netT = 0; @endphp @foreach ($transactions as $k => $item) @if ($cc_id != $item->cost_center_id) @php $cc_id = $item->cost_center_id; @endphp {{ $item->costCenter?->name }} @endif @php $tbd = ' '.$tbody; $netT += $item->total; @endphp {!! newBladeStringCompiler($tbd, $item->toArray()) !!} @if (!isset($transactions[$k+1]) || $cc_id != $transactions[$k+1]->cost_center_id) {{ $item->costCenter?->name }} Total {{ $netT }} @php $netT = 0; @endphp @endif @endforeach @if (count($otherTransactions)) {{ getInvoiceViewName($invoice->transaction_type, 2) }} {{ $print_settings["total_tfoot"]->label }} {!! newBladeStringCompiler($tfoot, $transactions->toArray()) !!} @php $title = getInvoiceViewName($otherTransactions->first()->transaction_type, 2); @endphp {{ $title }} @foreach ($otherTransactions as $item) @php $tbd = ' '.$tbody; @endphp {!! newBladeStringCompiler($tbd, $item->toArray()) !!} @endforeach span }}"> {{ $title }} {{ $print_settings["total_tfoot"]->label }} {!! newBladeStringCompiler($tfoot, $otherTransactions->toArray()) !!} @endif