@php $groupedOrders = $orders->groupBy('order_type'); $typeLabels = [ 'dine_in' => 'Dine In Orders', 'takeaway' => 'Take Away Orders', 'delivery' => 'Delivery Orders', ]; $subtotalWithoutTax = (float) ($summary['subtotal_without_tax'] ?? $orders->sum(fn ($o) => (float) ($o->grand_total ?? 0) - (float) ($o->service_charges ?? 0) - (float) ($o->pra_tax ?? 0) - (float) ($o->gst_tax ?? 0))); $serviceCharges = (float) ($summary['service_charges'] ?? $orders->sum(fn ($o) => (float) ($o->service_charges ?? 0))); $gstTax = (float) ($summary['gst_tax'] ?? $orders->sum(fn ($o) => (float) ($o->gst_tax ?? 0))); $praTax = (float) ($summary['pra_tax'] ?? $orders->sum(fn ($o) => (float) ($o->pra_tax ?? 0))); $grandTotal = (float) ($summary['grand_total'] ?? $orders->sum(fn ($o) => (float) ($o->grand_total ?? 0))); $todayServiceCharges = (float) ($summary['today_service_charges'] ?? $serviceCharges); $todayPraTax = (float) ($summary['today_pra_tax'] ?? $praTax); @endphp
@include('pdf.partials.pdf-branding')

Order Sales Report

@if(isset($startOfDay) && isset($endOfDay)) Period: {{ $startOfDay->format('d M Y, h:i A') }} to {{ $endOfDay->format('d M Y, h:i A') }}  |  @endif Generated on: {{ now()->format('d M Y, h:i A') }}
{{-- 4 KPI Summary Tiles --}}
Subtotal (Excl. Tax & Service)
Rs {{ number_format($subtotalWithoutTax, 2) }}
Without Service & PRA Tax ({{ number_format($orders->count()) }} Orders)
Service (7%)
Rs {{ number_format($serviceCharges, 2) }}
Today's Service (7%): Rs {{ number_format($todayServiceCharges, 2) }}
PRA Tax (8%)
Rs {{ number_format($praTax, 2) }}
Today's PRA (8%) Tax: Rs {{ number_format($todayPraTax, 2) }}
Grand Total (Incl. Tax)
Rs {{ number_format($grandTotal, 2) }}
Including Service (7%) & PRA (8%)
@if($orders->count() > 0) @foreach ($groupedOrders as $type => $typeOrders) @php $grpSubtotalExclTax = 0; $grpService = 0; $grpGst = 0; $grpPra = 0; $grpGrand = 0; @endphp
{{ $typeLabels[$type] ?? ucfirst(str_replace('_', ' ', $type)) }} ({{ $typeOrders->count() }})
@foreach ($typeOrders as $index => $order) @php $rowGst = (float) ($order->gst_tax ?? 0); $rowPra = (float) ($order->pra_tax ?? 0); $rowService = (float) ($order->service_charges ?? 0); $rowGrand = (float) ($order->grand_total ?? 0); $rowSubExclTax = $rowGrand - $rowService - $rowPra - $rowGst; $grpSubtotalExclTax += $rowSubExclTax; $grpService += $rowService; $grpGst += $rowGst; $grpPra += $rowPra; $grpGrand += $rowGrand; @endphp @endforeach
# Order # Status Subtotal (Excl. Tax & Service) Service (7%) GST Tax PRA Tax (8%) Grand Total Order Date Comments
{{ $index + 1 }} #{{ $order->id }} {{ ucfirst($order->status) }} Rs {{ number_format($rowSubExclTax, 2) }} Rs {{ number_format($rowService, 2) }} Rs {{ number_format($rowGst, 2) }} Rs {{ number_format($rowPra, 2) }} Rs {{ number_format($rowGrand, 2) }} {{ $order->created_at?->format('d M Y h:i A') }} {{ $order->comments ?: '—' }}
Group Totals ({{ $typeLabels[$type] ?? ucfirst($type) }}): Rs {{ number_format($grpSubtotalExclTax, 2) }} Rs {{ number_format($grpService, 2) }} Rs {{ number_format($grpGst, 2) }} Rs {{ number_format($grpPra, 2) }} Rs {{ number_format($grpGrand, 2) }}
@endforeach
Financial Summary
Total Paid Orders {{ number_format($orders->count()) }} Orders
Order Subtotal (Excl. Tax & Service) Rs {{ number_format($subtotalWithoutTax, 2) }}
Service Charges (7%) Rs {{ number_format($serviceCharges, 2) }}
PRA Tax (8%) Rs {{ number_format($praTax, 2) }}
Grand Total (Including Tax & Service) Rs {{ number_format($grandTotal, 2) }}
@else

No paid orders found for this period.

@endif