{{-- TOTAL --}}
@if ( !(request()->total_expense || request()->total_profit || request()->receivable || request()->receivable_finished_payment || request()->outsource_pending_payment || request()->outsource_profit ))

{{ __('messages.total_debit') }}

@if (request('outsource_vehicle_amount')) {{ $bookings->sum('outsource_purchase') }} @else {{ $bookings->sum('debit') }} @endif

@endif @if ( !(request()->total_sale || request()->income || request()->total_expense || request()->receivable || request()->receivable_finished_payment || request()->outsource_vehicle_amount || request()->outsource_pending_payment || request()->on_road_total_debit ))

{{ __('messages.total_credit') }}

@if (request('total_profit')) {{ $payments->sum('amount') - $expense->sum('expense') }} @elseif (request('outsource_profit') || request('driver')) {{ $bookings->sum('debit') - $bookings->sum('outsource_purchase') }} @else {{ $payments->sum('amount') }} @endif

@endif @if ( !(request()->total_sale || request()->income || request()->total_profit || request()->receivable || request()->receivable_finished_payment || request()->outsource_vehicle_amount || request()->outsource_pending_payment || request()->outsource_profit || request()->on_road_total_debit ))

{{ __('messages.total_expense') }}

{{ $expense->sum('expense') }}

@endif @if ( !(request()->total_sale || request()->income || request()->total_expense || request()->total_profit || request()->outsource_vehicle_amount || request()->outsource_profit || request()->on_road_total_debit ))

{{ __('messages.balance') }}

@if (request()->receivable) {{ $bookings->sum('debit') - $payments->sum('amount') }} @elseif (request()->receivable_finished_payment) {{ $bookings->sum('debit') - $payments->sum('amount') }} @elseif (request()->outsource_pending_payment) {{ $bookings->sum('outsource_purchase') - $payments->sum('outsource_credit') }} @else {{ $bookings->sum('debit') + $expense->sum('expense') - $payments->sum('amount') }} @endif

@endif
{{-- GENERAL LEDGER --}}

{{ __('messages.general_ledger') }}

{{-- FILTER BY PARTNER --}}
{{-- FILTER BY DRIVER --}}
{{-- FILTER BY VEHICLE --}}
@if (request('partner') || request('driver') || request('vehicle')) {{ __('messages.reset_filter') }} @endif {{-- Export --}} {{ __('messages.export_to_excel') }}

Total Debit:

Total Credit:

@if (!request()->total_expense) @forelse ($bookings as $key => $booking) {{-- Booking --}} @if ($booking->getTable() == 'bookings') @if ($booking->on_road) @elseif ($booking->outsource) @else @endif @if ($booking->on_road) @elseif ($booking->outsource) @else @endif @endif @empty @endforelse @endif {{-- Expense --}} @if ( !(request()->total_sale || request()->income || request()->receivable || request()->receivable_finished_payment || request()->outsource_vehicle_amount || request()->outsource_pending_payment || request()->outsource_profit || request()->on_road_total_debit )) @foreach ($expense as $exp) @endforeach @endif
# {{ __('messages.booking_type') }} {{ __('messages.travel_date') }} {{ __('messages.partner') }} {{ __('messages.passenger') }} {{ __('messages.employee') }} {{ __('messages.vehicle') }} {{ __('messages.location') }} {{ __('messages.debit') }} {{ __('messages.credit') }} {{ __('messages.account') }} {{ __('messages.expense_type') }} {{ __('messages.expense_description') }} {{ __('messages.expense') }} {{ __('messages.created_at') }} {{ __('messages.status') }}
{{ $key + 1 }} {{ $booking->on_road ? __('messages.on_road') : ($booking->outsource ? __('messages.outsource') : __('messages.regular')) }} {{ $booking->travel_date }} {{ $booking->partner ? $booking->partner->company : __('messages.no_partner_selected') }} {{ $booking->passenger_name ?? __('messages.na') }} {{ $booking->employee ? $booking->employee->fname . ' ' . $booking->employee->lname : __('messages.no_driver_selected') }} {{ $booking->vehicle ? $booking->vehicle->name : __('messages.no_vehicle_selected') }} {{ $booking->pickup_location . ' - ' . $booking->dropoff_location }} {{ $booking->debit }} {{ $booking->onRoadPayment ? $booking->onRoadPayment->amount : __('messages.no_payment_added_yet') }} {{ __('messages.on_road_credit') }} {{ $booking->outsource_purchase }} {{ __('messages.outsource_purchase') }} {{ __('-') }} {{ $booking->onRoadPayment ? $booking->onRoadPayment->account->title . '-' . $booking->onRoadPayment->account->type : __('messages.no_payment_added_yet') }} {{ __('messages.outsource_account') }}{{ __('-') }}{{ __('-') }} {{ __('-') }} {{ __('-') }} {{ $booking->created_at->format('d-m-Y') }}
{{ strtoupper($booking->status) }}
{{ __('messages.no_data_available') }}
{{ $key + 1 }} {{ __('messages.expense') }} {{ $exp->created_at->format('d-m-Y') }} {{ $exp->partner ? $exp->partner->company : __('messages.no_partner_selected') }} {{ __('-') }} {{ $exp->employee ? $exp->employee->fname . ' ' . $exp->employee->lname . ' - ' . $exp->employee->type : '-' }} {{ $exp->vehicle ? $exp->vehicle->name . $exp->vehicle->type : '-' }} {{ __('-') }} {{ __('-') }} {{ __('-') }} {{ $exp->account->title . '-' . $exp->account->type }} {{ $exp->expenseType->type }} {{ $exp->description }} {{ $exp->expense }} {{ $exp->created_at->format('d-m-Y') }}
{{ strtoupper($exp->status) }}