@php $gross_collection = 0; $total_commission = 0; $net_collection = 0; $total_trips = 0; $total_passenger = 0; $avarage_occupancy = 0; $total_luggages = 0; $total_expense = 0; $total_comission = 0; @endphp @foreach ($routesReport as $x => $route) @endforeach @php $arr = sizeof($routesReport); $y = 60 - $arr; for($x = $arr+1; $x <= 25; $x++){ echo ''; } @endphp
S/N ROUTE TRIPS PASSENGERs % OCCUPANCY ROUTE FARE(TZS) GROSS COLLECTION(TZS) AGENT COMMMISSION OTHER EXPENSES NET COLLECTION LUGGAGE (TZS)
{{$x+1}} @php $pA = \App\Models\Route::where(['id' => $route->id])->first()->start_point; $pB = \App\Models\Route::where(['id' => $route->id])->first()->end_point; $pointA = \App\Models\Cities::where(['id' => $pA])->first()->city; $pointB = \App\Models\Cities::where(['id' => $pB])->first()->city; if($pA == 1){ $pointA = "DAR"; }elseif ($pB == 1){ $pointB = "DAR"; } echo ''.$pointA .' - '.$pointB.''; @endphp @php $monday = strtotime('last monday', strtotime('tomorrow')); $sunday = strtotime('+6 days', $monday); $start_week = date('Y-m-d', $monday); $end_week = date('Y-m-d', $sunday); $trips = \Illuminate\Support\Facades\DB::table('schedules') ->where('schedules.company', '=', 2) ->where('schedules.route_id', '=', $route->id) ->whereBetween('schedules.trip_date', [$start_week, $end_week]) ->where('schedules.status', "=",1) ->where('schedules.booked_seats', '>', '0') ->count('schedules.status'); echo $trips; $total_trips += $trips; @endphp @php $monday = strtotime('last monday', strtotime('tomorrow')); $sunday = strtotime('+6 days', $monday); $start_week = date('Y-m-d', $monday); $end_week = date('Y-m-d', $sunday); $bookings = \Illuminate\Support\Facades\DB::table('booking_histories') ->leftJoin('schedules', function ($join) { $join->on('schedules.id', '=', 'booking_histories.schedule_id'); }) ->leftJoin('routes', function ($join) { $join->on('routes.id', '=', 'schedules.route_id'); }) ->where('booking_histories.company', '=', 2) ->where('booking_histories.status', '>', 2) ->whereBetween('schedules.trip_date', [$start_week, $end_week]) ->where('routes.id', '=', $route->id) ->select('booking_histories.count') ->count('booking_histories.count'); echo $bookings; $total_passenger += $bookings; @endphp @php $localTime = new \DateTime("now", new \DateTimeZone('Africa/Dar_es_Salaam')); $kifuaDate = $localTime->format('Y-m-d'); $monday = strtotime('last monday', strtotime('tomorrow')); $sunday = strtotime('+6 days', $monday); $start_week = date('Y-m-d', $monday); $end_week = date('Y-m-d', $sunday); $from = \App\Models\Route::where('id', $route->id)->value('start_point'); $to = \App\Models\Route::where('id', $route->id)->value('end_point'); $origin = \App\Models\Cities::where('id', $from)->value('city'); $destination = \App\Models\Cities::where('id', $to)->value('city'); $fare = DB::table('sub_routes') ->where('route', '=', $route->id) ->where('pointA', '=', $origin) ->where('pointB', '=', $destination) ->where('is_deleted', '=', 0) ->max('fare'); $all_seats = \Illuminate\Support\Facades\DB::table('bookings') ->leftJoin('schedules', function ($join) { $join->on('schedules.id', '=', 'bookings.schedule_id'); }) ->where('bookings.company', '=', 2) ->whereBetween('schedules.trip_date', [$start_week, $end_week]) ->where('schedules.route_id', '=', $route->id) ->select('bookings.count') ->sum('bookings.count'); $passenger_full_fare = \Illuminate\Support\Facades\DB::table('bookings') ->leftJoin('schedules', function ($join) { $join->on('schedules.id', '=', 'bookings.schedule_id'); }) ->whereBetween('schedules.trip_date', [$start_week, $end_week]) ->where('schedules.route_id', '=', $route->id) ->where('bookings.status', '>', 2) ->where('bookings.company', '=', 2) ->where('bookings.fare', '=', $fare) ->select('bookings.count') ->sum('bookings.count'); //dd($passenger_full_fare.' -- '.$all_seats); if($all_seats == 0){ echo '0%'; }else{ $cal = round(($passenger_full_fare/$all_seats)*100, 1); echo $cal."%"; } @endphp @php $from = \App\Models\Route::where('id', $route->id)->value('start_point'); $to = \App\Models\Route::where('id', $route->id)->value('end_point'); $origin = \App\Models\Cities::where('id', $from)->value('city'); $destination = \App\Models\Cities::where('id', $to)->value('city'); $fare = \Illuminate\Support\Facades\DB::table('sub_routes') ->where('sub_routes.route', $route->id) ->where('sub_routes.pointA', $origin) ->where('sub_routes.pointB', $destination) ->max('sub_routes.fare'); echo number_format($fare); @endphp @php $localTime = new \DateTime("now", new \DateTimeZone('Africa/Dar_es_Salaam')); $kifuaDate = $localTime->format('Y-m-d'); $monday = strtotime('last monday', strtotime('tomorrow')); $sunday = strtotime('+6 days', $monday); $start_week = date('Y-m-d', $monday); $end_week = date('Y-m-d', $sunday); $Sales = \Illuminate\Support\Facades\DB::table('booking_histories') ->leftJoin('schedules', function ($join) { $join->on('schedules.id', '=', 'booking_histories.schedule_id'); }) ->leftJoin('sub_routes', function ($join) { $join->on('sub_routes.id', '=', 'booking_histories.sub_route_id'); }) ->leftJoin('routes', function ($join) { $join->on('routes.id', '=', 'sub_routes.route'); }) ->where('booking_histories.company', '=', 2) ->whereBetween('schedules.trip_date', [$start_week, $end_week]) ->where('booking_histories.status', '>', 2) ->where('routes.id', '=', $route->id) ->select('booking_histories.fullname as passenger', 'booking_histories.msisdn', 'booking_histories.status', 'booking_histories.booking_date') ->sum('booking_histories.fare'); echo number_format($Sales); $gross_collection += $Sales; @endphp @php $localTime = new \DateTime("now", new \DateTimeZone('Africa/Dar_es_Salaam')); $kifuaDate = $localTime->format('Y-m-d'); $monday = strtotime('last monday', strtotime('tomorrow')); $sunday = strtotime('+6 days', $monday); $start_week = date('Y-m-d', $monday); $end_week = date('Y-m-d', $sunday); $commission = \Illuminate\Support\Facades\DB::table('booking_histories') ->leftJoin('schedules', function ($join) { $join->on('schedules.id', '=', 'booking_histories.schedule_id'); }) ->leftJoin('sub_routes', function ($join) { $join->on('sub_routes.id', '=', 'booking_histories.sub_route_id'); }) ->leftJoin('routes', function ($join) { $join->on('routes.id', '=', 'sub_routes.route'); }) ->leftJoin('agent_companies', function ($join) { $join->on('agent_companies.agent', '=', 'booking_histories.agent_id'); }) ->where('booking_histories.company', '=', 2) ->whereBetween('schedules.trip_date', [$start_week, $end_week]) ->where('booking_histories.status', '>', 2) ->where('routes.id', '=', $route->id) ->where('agent_companies.type', '=', 2) ->select('sub_routes.fixedCommission') ->sum('sub_routes.fixedCommission'); echo number_format($commission); $total_commission += $commission; @endphp
'.$x.' TENDERS
Total: {{ $total_trips }} {{ $total_passenger }} {{number_format($gross_collection, 0)}}/- {{number_format($total_commission, 0)}}/-

ONLINE :

Mpesa = 0/-
Tigopesa = 0/-
AirtelMoney = 0/-
Halopesa = 0/-

CASH :

BANK :

Powered By: TiketiGala - https://www.aboodbus.co.tz