@php $negative_sum=0; $positive_sum =0; for ($i=0; $i < $arrayCount; $i++) { if(isset($negativeArr[$i])){ $negative_sum += $negativeArr[$i]->closing_balance; } if(isset($positiveArr[$i])){ $positive_sum += $positiveArr[$i]->closing_balance; } @endphp @if (isset($negativeArr[$i])) @else @endif @if (isset($positiveArr[$i])) @else @endif @php } @endphp
PCode PName Current Balance PCode PName Current Balance
@if (isset($negativeArr[$i])) {{$negativeArr[$i]->code}} @endif @if (isset($negativeArr[$i])) @if (strlen($negativeArr[$i]->name) > 20) {{substr($negativeArr[$i]->name, 0, 19)}} .. @else {{$negativeArr[$i]->name}} @endif @endif {{number_format($negativeArr[$i]->closing_balance,'2','.','')}} @if (isset($positiveArr[$i])) {{$positiveArr[$i]->code}} @endif @if (isset($positiveArr[$i])) @if (strlen($positiveArr[$i]->name) > 20) {{substr($positiveArr[$i]->name, 0, 19)}} .. @else {{$positiveArr[$i]->name}} @endif @endif {{ number_format($positiveArr[$i]->closing_balance,'2','.','')}}
Total {{number_format($negative_sum, '2', '.', '')}} Total {{number_format($positive_sum, '2', '.', '') }}
Difference {{number_format(($negative_sum + $positive_sum), '2', '.', '')}}