@php $sum = 0; @endphp @foreach ($list as $p) @php $adjustment = 0; if($p->due_amount <= 0){ $adjustment = $p->bill_amount; }else{ $adjustment = $p->bill_amount - $p->due_amount; } $sum += $adjustment; @endphp @endforeach
# CID Date Username Name Description Bill Amount Due Amount Paid Amount
{{ $loop->iteration }} CID: {{ $p->client_id }} {{ date('d-M-Y h:i:s A', strtotime($p->created_at)) }} {{ $p->clients->userid ?? '' }} {{ $p->clientsinfo->clients_name ?? '' }} {{ $p->description ?? '' }}{{ $adjustment ?? '' }} {{ $p->due_amount ?? '' }} {{ $p->paid_amount ?? '' }}
Total {{ number_format((float) $sum, 2, '.', '') }} {{ number_format((float) $list->sum('due_amount'), 2, '.', '') }} {{ number_format((float) $list->sum('paid_amount'), 2, '.', '') }}