@if(isset($flag) && $flag == 'mailInvoice') @else @endif

Invoice statement for {{$client->full_name}}

@php $total = 0; $amount_paid = 0; $balance = 0; @endphp @foreach($invoices as $result) @php $amount_paid = $amount_paid + (isset($result->amount_paid) ? $result->amount_paid : 0); $total = $total + (isset($result->total) ? $result->total : 0); $balance = $balance + (isset($result->account_balance) ? $result->account_balance : 0); @endphp @php $pracInv = App\Models\Practitioner::select( 'id', 'first_name', 'last_name' )->where( 'id', $result->practitioner_id )->first(); $fullName = ucwords( $pracInv->first_name.' '.$pracInv->last_name ); @endphp @endforeach
Date Number Type Provider Amount Paid Balance
{{Carbon\Carbon::parse($result->date)->format("d/m/y") ?? "-"}} {{$result->invoice_number ?? "-"}} @if(isset($result->one_invoiceappt) && isset($result->one_invoiceappt->appointment_type_notess) ) {{$result->one_invoiceappt->appointment_type_notess->appointment_type}} @elseif(isset($result->latest_invoice_product) && isset($result->latest_invoice_product['product_iteams'])) {{$result->latest_invoice_product['product_iteams']['product_name']}} @else {{'-'}} @endif {{$fullName ?? "-"}} $ {{$result->total ?? "-"}} $ {{$result->amount_paid ?? "-"}} $ {{$result->account_balance ?? "-"}}
$ {{number_format($total,2)}} $ {{number_format($amount_paid,2) }} $ {{number_format($balance,2) }}