@if(isset($showLogo) && $showLogo && isset($logoUrl) && $logoUrl)
Logo
@endif
{{ $storeName ?? ($order->restaurant->name ?? 'Bismillah Restaurant') }}
@if($storeAddress ?? null) {{ $storeAddress }}
@endif @if($storePhone ?? null) Tel: {{ $storePhone }}
@endif @if($storeTaxNumber ?? null) Tax/Reg: {{ $storeTaxNumber }} @endif
Invoice #: {{ $order->order_number }}
Date: {{ $order->paid_at ? $order->paid_at->format('Y-m-d') : ($order->created_at ? $order->created_at->format('Y-m-d') : date('Y-m-d')) }}
Time: {{ $order->paid_at ? $order->paid_at->format('H:i') : ($order->created_at ? $order->created_at->format('H:i') : date('H:i')) }}
@if($order->tables && $order->tables->count() > 0)
Table: {{ $order->tables->pluck('name')->join(', ') }}
@elseif($order->table)
Table: {{ $order->table->name }}
@endif @if($order->order_type)
Type: {{ ucfirst(str_replace('_', ' ', $order->order_type)) }}
@endif
@if($order->customer_name || $order->customer_phone)
@if($order->customer_name)
Customer: {{ $order->customer_name }}
@endif @if($order->customer_phone)
Phone: {{ $order->customer_phone }}
@endif
@endif
Qty Item Price Total
@forelse($order->items as $item)
{{ $item->item_name ?? 'N/A' }}
{{ $item->quantity ?? 0 }} x {{ number_format($item->price ?? 0, 2) }} {{ number_format($item->total ?? 0, 2) }}
@empty
No items found
@endforelse
@php // Calculate totals - use stored amounts if available, otherwise calculate from percentages $subtotal = $order->subtotal ?? 0; // Service Charge: Use stored amount if available, otherwise calculate from percentage $serviceChargePercent = $order->service_charge_percent ?? 0; $serviceCharge = $order->service_charge ?? 0; if ($serviceCharge == 0 && $serviceChargePercent > 0) { $serviceCharge = ($subtotal * $serviceChargePercent) / 100; } // Tax: Use stored amount if available, otherwise calculate from percentage $taxPercent = $order->tax_percent ?? 0; $tax = $order->tax ?? 0; if ($tax == 0 && $taxPercent > 0) { $tax = (($subtotal + $serviceCharge) * $taxPercent) / 100; } // Discount: Use stored amount if available, otherwise calculate from percentage $discountPercent = $order->discount_percent ?? 0; $discount = $order->discount ?? 0; if ($discount == 0 && $discountPercent > 0) { $discount = ($subtotal * $discountPercent) / 100; } @endphp
Subtotal: PKR {{ number_format($subtotal, 2) }}
@if($serviceCharge > 0)
Service Charge{{ $serviceChargePercent > 0 ? ' (' . number_format($serviceChargePercent, 2) . '%)' : '' }}: PKR {{ number_format($serviceCharge, 2) }}
@endif @if($tax > 0)
Tax/GST{{ $taxPercent > 0 ? ' (' . number_format($taxPercent, 2) . '%)' : '' }}: PKR {{ number_format($tax, 2) }}
@endif @if($discount > 0)
Discount{{ $discountPercent > 0 ? ' (' . number_format($discountPercent, 2) . '%)' : '' }}: - PKR {{ number_format($discount, 2) }}
@endif
GRAND TOTAL: PKR {{ number_format($order->grand_total, 2) }}
@if($order->payment_mode)
Payment: {{ strtoupper($order->payment_mode) }}
@endif