@if($view_loading_order_sales_summaries) {{-- --}} {{--*/ $invoice_amount_total = 0 /*--}} {{--*/ $expenses_amount_total = 0 /*--}} {{--*/ $allocations = 0 /*--}} {{--*/ $truck_invoiced_total = 0 /*--}} {{--*/ $allocation_per_invoiced_total = 0 /*--}} {{--*/ $i = 1 /*--}} @foreach($view_loading_order_sales_summaries as $key=>$view_loading_order_sales_summary) {{--*/ $invoices = $view_loading_order_sales_summary->viewLoadingOrderInvoices /*--}} {{--*/ $invoice_quantity = sizeof($invoices) /*--}} @foreach($invoices as $index=>$invoice) @if($index==0) {{--*/ $allocations += $view_loading_order_sales_summary->truck_allocated /*--}} {{--*/ $truck_invoiced_total += $view_loading_order_sales_summary->truck_invoiced /*--}} {{----}} {{--*/ $i++ /*--}} @endif {{--*/ $allocation_per_invoiced_total += $invoice->truck_invoiced /*--}} {{--*/ $invoice_amount_total += $invoice->total_amount_in_tsh /*--}} {{--*/ $expenses_amount_total += $invoice->total_expense_amount /*--}} @endforeach @endforeach
S/N Loading Order NO. Client Allocation Date Allocation(s)Billing Amount# of Invoiced Invoice # Serial # Invoice Date Allocation Per Invoice Invoiced Amount Invoice Amount (Tsh) Direct Expenses (TSh) Margin (Tsh) % Margin
{{$i}} {{$view_loading_order_sales_summary->loading_order_id}} {{$view_loading_order_sales_summary->client_code}} {{\Carbon\Carbon::parse($view_loading_order_sales_summary->allocation_date)->format('d-m-Y')}} {{$view_loading_order_sales_summary->truck_allocated}}{{($view_loading_order_sales_summary->currency=='TSH') ? 'Tsh ' : '$ '}}{{number_format($view_loading_order_sales_summary->billing_amount)}}{{$view_loading_order_sales_summary->truck_invoiced}}{{ \App\Model\Invoice::find($invoice->invoice_id)->invoice_number }} {{$invoice->invoice_id}} {{\Carbon\Carbon::parse($invoice->invoice_date)->format('d-m-Y')}} {{$invoice->truck_invoiced}}{{($invoice->invoice_currency=='TSH') ? 'Tsh ' : '$ '}}{{number_format($invoice->invoiced_amount)}} {{number_format($invoice->total_amount_in_tsh)}} {{number_format($invoice->total_expense_amount)}} {{number_format($invoice->profit_margin,2)}} @if($invoice->total_amount_in_tsh){{number_format(($invoice->profit_margin/$invoice->total_amount_in_tsh)*100,2)}} @endif
TOTAL {{$allocations}} {{$truck_invoiced_total}} {{$allocation_per_invoiced_total}} {{number_format($invoice_amount_total)}} {{number_format($expenses_amount_total)}} {{number_format($invoice_amount_total-$expenses_amount_total,2)}} @if($invoice_amount_total){{number_format((($invoice_amount_total-$expenses_amount_total)/$invoice_amount_total)*100,2)}} @endif
@else

NO DATA FOUND

@endif