@foreach($items as $client_inquiry_item) {{--*/ $route = $client_inquiry_item->getRoute() /*--}} @if($route) {{--*/ $route_cargo_details =$route->routeCargoDetails() /*--}} {{--*/ $route_cargo_detail = $route_cargo_details->whereType($client_inquiry_item->cargo_type)->first() /*--}} @else {{--*/ $route_cargo_detail = [] /*--}} @endif {{--*/ $return_expense_keys = [] /*--}} {{--------------------------------------------------------------------------------------------------------------------------}} @if($route_cargo_detail->is_returning) @endif @foreach($client_inquiry_item->loadingPointExpenses() as $l) @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) {{--@foreach($route_cargo_detail->routeReturningCargoDetails as $route_returning_cargo_detail)--}} @if($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($l->account_id) > 0) {{--*/ array_push($return_expense_keys,$l->account_id) /*--}} @endif {{--@endforeach--}} @endif @endforeach @foreach($client_inquiry_item->routeBorderExpenses() as $b) @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) {{--@foreach($route_cargo_detail->routeReturningCargoDetails as $route_returning_cargo_detail)--}} @if($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($b->account_id) > 0) {{--*/ array_push($return_expense_keys,$b->account_id) /*--}} @endif {{--@endforeach--}} @endif @endforeach @foreach($client_inquiry_item->routeForecastingExpenses() as $l) @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) {{-- @foreach($route_cargo_detail->routeReturningCargoDetails as $route_returning_cargo_detail)--}} @if($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($l->account_id) > 0) {{--*/ array_push($return_expense_keys,$l->account_id) /*--}} @endif {{--@endforeach--}} @endif @endforeach @foreach($route->routeExpenses()->whereIn('cargo_type',['ALL',$client_inquiry_item->cargo_type])->get() as $route_expense) @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) {{-- @foreach($route_cargo_detail->routeReturningCargoDetails as $route_returning_cargo_detail)--}} @if($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($route_expense->account_id) > 0) {{--*/ array_push($return_expense_keys,$route_expense->account_id) /*--}} @endif {{--@endforeach--}} @endif @endforeach @if($route_cargo_detail->is_returning) @foreach($route_cargo_detail->routeReturningCargoDetails()->first()->returnExpenses()->whereNotIn('account_id',$return_expense_keys)->get() as $b) @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @endforeach @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) {{-- @foreach($route_cargo_detail->routeReturningCargoDetails as $route_returning_cargo_detail)--}} {{--@endforeach--}} @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) {{--@foreach($route_cargo_detail->routeReturningCargoDetails as $route_returning_cargo_detail)--}} {{--@endforeach--}} @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($route_cargo_detail->is_returning) @endif @foreach($route->getPrepaidExpensesBudgets($client_inquiry_item->cargo_type,$route->getDays($client_inquiry_item->cargo_type),'2250','TSH') as $l) @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) {{--@foreach($route_cargo_detail->routeReturningCargoDetails as $route_returning_cargo_detail)--}} {{--*/ $return_prepaid_expenses_budget= $route->getPrepaidExpensesBudget($l['permit_id'], $client_inquiry_item->cargo_type, $route_cargo_detail->routeReturningCargoDetails->first()->getDays(),'2250','TSH' )/*--}} {{--@endforeach--}} @endif @endforeach @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($route_cargo_detail->is_returning) @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif @if($client_inquiry_item->cargo_type =='TANKERS') @endif @if($route_cargo_detail->is_returning) @endif
is_returning)?2:1 !!}"> Operating Cost  
{!! $l->cost_name !!} {!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($l->amount,$l->currency,2250)) !!}{!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($l->amount,$l->currency,2250)) !!}{{number_format(($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($l->account_id)))}}
{!! $b->cost_name !!} {!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($b->amount,$b->currency,2250)) !!}{!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($b->amount,$b->currency,2250)) !!}{{number_format(($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($b->account_id)))}}
{!! $l->cost_name !!} {!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($l->amount,$l->currency,2250)) !!}{!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($l->amount,$l->currency,2250)) !!}{{number_format(($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($l->account_id)))}}
{{$route_expense->cost_name}} {{number_format(\App\Logistics\Facades\Logistics::currencyConvert($route_expense->amount,$route_expense->currency,2250))}}{{number_format(\App\Logistics\Facades\Logistics::currencyConvert($route_expense->amount,$route_expense->currency,2250))}} {{number_format($route_cargo_detail->routeReturningCargoDetails->first()->getExpenses($route_expense->account_id))}}
{!! $b->name !!} {!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($b->amount,$b->currency,2250)) !!}{!! number_format(\App\Logistics\Facades\Logistics::currencyConvert($b->amount,$b->currency,2250)) !!}
FUEL EXPENSES {{number_format(($route->getFuel($client_inquiry_item->cargo_type))*1990,2)}}{{number_format(($route->getFuel($client_inquiry_item->cargo_type))*1990,2)}}{{number_format(($route_cargo_detail->routeReturningCargoDetails->first()->getFuel())*2320,2)}}
TYRE CONSUMPTION COST {{number_format($route->go_distance * (((8*580000)+(12*480000))/40000))}}{{number_format($route->go_distance * (((8*580000)+(12*480000))/40000))}}{{number_format($route_cargo_detail->routeReturningCargoDetails->first()->getKm() * (((8*580000)+(12*480000))/40000))}}
is_returning)?2:1 !!}" style="text-align: right;">Total Operating Cost (TSH) {!! number_format(0) !!}{!! number_format(0) !!}{!! number_format(0) !!}
is_returning)?2:1 !!}" style="text-align: right;">Total Operating Cost (USD) {!! number_format(0) !!}{!! number_format(0) !!}{!! number_format(0) !!}
is_returning)?2:1 !!}" style="text-align: right;">Contribution in USD {!! number_format(0) !!}{!! number_format(0) !!}{!! number_format(0) !!}
is_returning)?2:1 !!}"> Fixed Cost  
{!! $l['permit'] !!} {!! number_format($l['amount'])!!}{!! number_format($l['amount'])!!}{{number_format($return_prepaid_expenses_budget['amount'])}}
Over Heads {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
Depreciation {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
Total Fixed Cost(Tsh) {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
Total Fixed Cost(USD) {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
is_returning)?3:2 !!}"> 
Net Profit in USD {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
{!! number_format(0) !!}% {!! number_format(0) !!}% {!! number_format(0) !!}%
is_returning)?3:2 !!}">    
is_returning)?3:2 !!}">    
Net Profit in USD {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
Add: Depreciation {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
Cash Profit per Trip per {!! ($client_inquiry_item->cargo_type =='TANKERS')?"Tanker":"Truck" !!} {!! number_format(0) !!} {!! number_format(0) !!} {!! number_format(0) !!}
@endforeach