{{--*/ $invoice_amount = ['revenue'=>$client_inquiry_item->rate*$client_inquiry_item->tonnage] /*--}} {{--*/ $route = $client_inquiry_item->getRoute() /*--}} {{--*/ $loading_point_expenses = $client_inquiry_item->loadingPointExpenses() /*--}} {{--*/ $route_border_expenses = $client_inquiry_item->routeBorderExpenses() /*--}} {{--*/ $route_forecasting_expenses = $client_inquiry_item->routeForecastingExpenses() /*--}} {{--*/ $permit_expenses = $route->getPermitExpenses($client_inquiry_item->cargo_type, $route->getDays($client_inquiry_item->cargo_type), $exchange_rate) /*--}} @if($route) {{--*/ $revenue = $invoice_amount['revenue'] /*--}}
{{--*/ $cost_total = 0 /*--}} {{--*/ $cost_total_usd = 0 /*--}} @foreach($loading_point_expenses as $loading_point_expense) {{--*/ $cost_total += \App\Logistics\Facades\Logistics::currencyConvert($loading_point_expense->amount, $loading_point_expense->currency, $exchange_rate) /*--}} @endforeach @foreach($route_forecasting_expenses as $route_forecasting_expense) {{--*/ $cost_total += \App\Logistics\Facades\Logistics::currencyConvert($route_forecasting_expense->amount, $route_forecasting_expense->currency, $exchange_rate) /*--}} @endforeach @foreach($route_border_expenses as $route_border_expense) {{--*/ $cost_total += \App\Logistics\Facades\Logistics::currencyConvert($route_border_expense->amount, $route_border_expense->currency, $exchange_rate) /*--}} @endforeach @foreach($permit_expenses as $permit_expense) {{--*/ $cost_total += \App\Logistics\Facades\Logistics::currencyConvert($permit_expense['amount'], $permit_expense['currency'], $exchange_rate) /*--}} @endforeach @foreach($route->routeExpenses()->whereIn('cargo_type',['ALL',$client_inquiry_item->cargo_type])->get() as $route_expense) {{--*/ $cost_total += \App\Logistics\Facades\Logistics::currencyConvert($route_expense->amount, $route_expense->currency, $exchange_rate) /*--}} @endforeach {{--*/ $cost_total +=$route->getFuel($client_inquiry_item->cargo_type)*$fuel_rate /*--}} {{--*/ $cost_total +=$route->go_distance*2*300 /*--}}
{{$loading_point_expense->cost_name}} {{$loading_point_expense->currency}} {{number_format($loading_point_expense->amount,2)}}
{{$route_forecasting_expense->cost_name}} {{$route_forecasting_expense->currency}} {{number_format($route_forecasting_expense->amount,2)}} {{$route_forecasting_expense->descriptions}}
{{$route_border_expense->cost_name}} {{$route_border_expense->currency}} {{number_format($route_border_expense->amount,2)}} {{$route_border_expense->descriptions}}
{{$permit_expense['cost_name']}} {{$permit_expense['currency']}} {{number_format($permit_expense['amount'],2)}}
{{$route_expense->cost_name}} {{$route_expense->currency}} {{number_format($route_expense->amount,2)}}
FUEL EXPENSES: {{number_format(($route->getFuel($client_inquiry_item->cargo_type))*$fuel_rate,2)}}
TYRE CONSUMPTION COST: {{number_format($route->go_distance*2*300,2)}}
TOTAL OPERATING COST {{number_format($cost_total,2)}}
TOTAL OPERATING COST(USD) {{number_format($cost_total_usd = \App\Logistics\Facades\Logistics::currencyConvert($cost_total, 'TSH', $exchange_rate, 'USD'),2)}}
Contribution in USD {{number_format($revenue - $cost_total_usd,2)}}
{{number_format($revenue-$cost_total_usd)}}
@endif