Profit/Loss Report - {{ $type === 'customer' ? 'Per Customer' : 'Per Passenger' }}

BM Umrah Booking System

@php $__currency = $currency ?? 'SAR'; $__rate = app(\App\Services\CurrencyRateService::class)->getCurrentRateValue(); $fmtNum = function($amount, $d = 0) use ($__currency, $__rate) { if ($amount === null || $amount === '') return ''; $val = $__currency === 'BDT' ? $amount * $__rate : $amount; return number_format($val, $d); }; $fmtCurrency = function($amount, $d = 0) use ($__currency, $__rate) { if ($amount === null || $amount === '') return ''; $val = $__currency === 'BDT' ? $amount * $__rate : $amount; return ($__currency === 'BDT' ? 'BDT ' : 'SAR ') . number_format($val, $d); }; $appliedFilters = array_filter([ 'Date From' => $dateFrom, 'Date To' => $dateTo, ]); @endphp @if(!empty($appliedFilters))
Filters Applied: @foreach($appliedFilters as $label => $value) {{ $label }}: {{ $value }}@if(!$loop->last) | @endif @endforeach | Currency: {{ $__currency }}
@endif @if($type === 'customer') @forelse($customers as $row) @empty @endforelse @if(count($customers) > 0) @php $grandTotal = $customers->reduce(fn($acc, $r) => [ 'package_value' => $acc['package_value'] + $r['package_value'], 'total_cost' => $acc['total_cost'] + $r['total_cost'], 'profit' => $acc['profit'] + $r['profit'], ], ['package_value' => 0, 'total_cost' => 0, 'profit' => 0]); @endphp @endif
Invoice ID Customer Name Mobile Pax Qty Total Package Value ({{ $__currency }}) Total Cost ({{ $__currency }}) Profit/Loss ({{ $__currency }})
{{ $row['invoice_id'] }} {{ $row['customer_name'] }} {{ $row['mobile'] }} {{ $row['pax_qty'] }} {{ $fmtCurrency($row['package_value']) }} {{ $fmtCurrency($row['total_cost']) }} {{ ($row['profit'] >= 0 ? '+' : '') . $fmtCurrency($row['profit']) }}
No records found.
Grand Total {{ $fmtCurrency($grandTotal['package_value']) }} {{ $fmtCurrency($grandTotal['total_cost']) }} {{ ($grandTotal['profit'] >= 0 ? '+' : '') . $fmtCurrency($grandTotal['profit']) }}
@else @forelse($passengers as $row) @empty @endforelse @if(count($passengers) > 0) @php $grandTotal = $passengers->reduce(fn($acc, $r) => [ 'package_value' => $acc['package_value'] + $r['package_value'], 'total_cost' => $acc['total_cost'] + $r['total_cost'], 'profit' => $acc['profit'] + $r['profit'], ], ['package_value' => 0, 'total_cost' => 0, 'profit' => 0]); @endphp @endif
Invoice ID Customer Name Mobile Passenger Name Package Value ({{ $__currency }}) Total Cost ({{ $__currency }}) Profit/Loss ({{ $__currency }})
{{ $row['invoice_id'] }} {{ $row['customer_name'] }} {{ $row['mobile'] }} {{ $row['passenger_name'] }} {{ $fmtCurrency($row['package_value']) }} {{ $fmtCurrency($row['total_cost']) }} {{ ($row['profit'] >= 0 ? '+' : '') . $fmtCurrency($row['profit']) }}
No records found.
Grand Total {{ $fmtCurrency($grandTotal['package_value']) }} {{ $fmtCurrency($grandTotal['total_cost']) }} {{ ($grandTotal['profit'] >= 0 ? '+' : '') . $fmtCurrency($grandTotal['profit']) }}
@endif