@php $appLocale = app()->getLocale(); if (!function_exists('flipText')) { function flipText($text, $language = null, $printingChoice = 'browserPopupPrint') { if ($printingChoice == 'browserPopupPrint') { return $text; } if ($language && in_array($language, ['ar', 'fa', 'ur', 'he', 'ps', 'ku', 'sd', 'ckb'])) { $arabic = new ArPHP\I18N\Arabic(); $text = $arabic->utf8Glyphs($text); return $text; } return $text; } } @endphp {{ restaurant()->name }} - {{ $order->show_formatted_order_number ?? "" }} {{-- --}}
@if ($receiptSettings->show_restaurant_logo) @php $logoUrl = restaurant()->logo_url; $logoBase64 = null; if ($logoUrl) { try { // If the URL is relative, prepend the app URL if (!preg_match('/^https?:\/\//', $logoUrl)) { $logoUrl = url($logoUrl); } $logoImageContents = @file_get_contents($logoUrl); if ($logoImageContents !== false) { $logoBase64 = 'data:image/png;base64,' . base64_encode($logoImageContents); } } catch (\Exception $e) { $logoBase64 = null; } } @endphp @if ($logoBase64) @else @endif @endif @if ($receiptSettings->show_restaurant_name)
{{ restaurant()->name }}
@endif
@if (!$receiptSettings->show_restaurant_name && $receiptSettings->show_branch_name)
{{ $orderBranch->name ?? restaurant()->name }}
@elseif ($receiptSettings->show_restaurant_name && $receiptSettings->show_branch_name)
{{ $orderBranch->name ?? restaurant()->name }}
@endif @if ($receiptSettings->show_branch_address)
{!! nl2br($orderBranch->address ?? restaurant()->address ?? '') !!}
@endif
{{ flipText(__('modules.customer.phone'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.customer.phone', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $orderBranch->phone ?: restaurant()->phone_number }}
@if ($receiptSettings->show_tax) @if (empty($orderBranch->cr_number) && empty($orderBranch->vat_number)) @foreach ($taxDetails as $taxDetail)
{{ $taxDetail->tax_name }}: {{ $taxDetail->tax_id }}
@endforeach @endif @endif @if ($receiptSettings->show_cr_number && !empty($orderBranch->cr_number))
{{ flipText(__('modules.settings.branchCrNumber'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.settings.branchCrNumber', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $orderBranch->cr_number }}
@endif @if ($receiptSettings->show_vat_number && !empty($orderBranch->vat_number))
{{ flipText(__('modules.settings.branchVatNumber'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.settings.branchVatNumber', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $orderBranch->vat_number }}
@endif
{{ $order->show_formatted_order_number }} {{ $order->date_time->timezone(timezone())->format(dateFormat() . ' ' . timeFormat()) }}
@php $tokenNumber = $order->kot->whereNotNull('token_number')->first()?->token_number; @endphp @if ($tokenNumber)
{{ flipText(__('modules.order.tokenNumber'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.tokenNumber', [], $receiptLanguages[1]), $appLocale, $printingChoice) }} @endif
: {{ $tokenNumber }}
@endif @if($receiptSettings->show_table_number || $receiptSettings->show_total_guest)
@if ($receiptSettings->show_table_number && $order->table && $order->table->table_code) {{ flipText(__('modules.settings.tableNumber'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.settings.tableNumber', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $order->table->table_code }} @endif
@if ($receiptSettings->show_total_guest && $order->number_of_pax) {{ flipText(__('modules.order.noOfPax'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.noOfPax', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $order->number_of_pax }} @endif
@endif @if ($receiptSettings->show_waiter && $order->waiter && $order->waiter->name)
{{ flipText(__('modules.order.waiter'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1) {{ flipText(__('modules.order.waiter', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $order->waiter->name }}
@endif @if ($receiptSettings->show_order_type )
@php $billPrintOrderType = (string) $order->order_type; $billPrintOrderTypeKey = 'modules.order.' . $billPrintOrderType; $billPrintOrderTypeLabel = __($billPrintOrderTypeKey); if ($billPrintOrderTypeLabel === $billPrintOrderTypeKey) { $billPrintOrderTypeLabel = Str::title(str_replace('_', ' ', $billPrintOrderType)); } @endphp {{ flipText($billPrintOrderTypeLabel, $appLocale, $printingChoice) }} @if ($order->order_type === 'pickup') @if ($order->pickup_date) : {{ \Carbon\Carbon::parse($order->pickup_date)->format(dateFormat() . ' ' . timeFormat()) }} @endif @endif
@endif @if ($receiptSettings->show_customer_name && $order->customer && $order->customer->name)
{{ flipText(__('modules.customer.customer'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1) {{ flipText(__('modules.customer.customer', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $order->customer->name }}
@endif @if ($receiptSettings->show_customer_address && $order->customer && $order->customer->delivery_address)
{{ flipText(__('modules.customer.customerAddress'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1) {{ flipText(__('modules.customer.customerAddress', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $order->customer->delivery_address }}
@endif @if ($receiptSettings->show_customer_phone && $order->customer && $order->customer->phone)
{{ flipText(__('modules.customer.phone'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1) {{ flipText(__('modules.customer.phone', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $order->customer->phone }}
@endif @if (function_exists('module_enabled') && module_enabled('Hotel') && in_array('Hotel', restaurant_modules()) && $order->order_type === 'room_service' && $order->context_type === 'HOTEL_ROOM' && $order->hotelStay) @php $hotelStay = $order->hotelStay; @endphp @if ($hotelStay->room)
{{ flipText(__('hotel::modules.folio.room'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1) {{ flipText(__('hotel::modules.folio.room', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $hotelStay->room->room_number }}
@endif
{{ flipText(__('hotel::modules.folio.stay'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1) {{ flipText(__('hotel::modules.folio.stay', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $hotelStay->stay_number }}
@if ($hotelStay->stayGuests && $hotelStay->stayGuests->isNotEmpty() && $hotelStay->stayGuests->first()?->guest)
{{ flipText(__('hotel::modules.guest.guest'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1) {{ flipText(__('hotel::modules.guest.guest', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif: {{ $hotelStay->stayGuests->first()->guest->full_name }}
@endif @if ($order->bill_to)
{{ flipText(__('hotel::modules.roomService.billTo'), $appLocale, $printingChoice) }}: {{ $order->bill_to === 'POST_TO_ROOM' ? __('hotel::modules.roomService.postToRoom') : __('hotel::modules.roomService.payNow') }}
@endif @endif
@foreach ($order->items as $item) @endforeach
{{ flipText(__('modules.order.qty'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.qty', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ flipText(__('modules.menu.itemName'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.menu.itemName', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ flipText(__('modules.order.price'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.price', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ flipText(__('modules.order.amount'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.amount', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ $item->quantity }} {{ flipText($item->menuItem->item_name, $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1 && $item->menuItem->translations->count() > 1)
{{ flipText($item->menuItem->getTranslatedValue('item_name', $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif @if (isset($item->menuItemVariation))
({{ $item->menuItemVariation->variation }}) @endif @foreach ($item->modifierOptions as $modifier) @php if ($order->order_type_id) { $modifier->setPriceContext($order->order_type_id, $order?->delivery_app_id); } @endphp
• {{ $modifier->name ?? $modifier->pivot->modifier_option_name }} (+{{ currency_format($modifier->pivot->modifier_option_price ?? $modifier->price, restaurant()->currency_id) }})
@endforeach
{{ currency_format($item->price, restaurant()->currency_id) }} {{ currency_format($item->amount, restaurant()->currency_id) }}
{{ flipText(__('modules.order.subTotal'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.subTotal', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ currency_format($order->sub_total, restaurant()->currency_id) }}
@if (!is_null($order->discount_amount))
{{ flipText(__('modules.order.discount'), $appLocale, $printingChoice) }} @if ($order->discount_type == 'percent') ({{ rtrim(rtrim($order->discount_value, '0'), '.') }}%) @endif @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.discount', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
-{{ currency_format($order->discount_amount, restaurant()->currency_id) }}
@endif @if(function_exists('module_enabled') && module_enabled('Loyalty') && $order->loyalty_points_redeemed > 0 && $order->loyalty_discount_amount > 0)
{{ flipText(__('loyalty::app.loyaltyDiscount'), $appLocale, $printingChoice) }} ({{ number_format($order->loyalty_points_redeemed) }} @lang('loyalty::app.points')) @if (count($receiptLanguages) > 1)
{{ flipText(__('loyalty::app.loyaltyDiscount', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} ({{ number_format($order->loyalty_points_redeemed) }} @lang('loyalty::app.points', [], $receiptLanguages[1])) @endif
-{{ currency_format($order->loyalty_discount_amount, restaurant()->currency_id) }}
@endif @if(function_exists('module_enabled') && module_enabled('Loyalty') && ($order->stamp_discount_amount > 0 || $order->items()->where('is_free_item_from_stamp', true)->exists()))
{{ flipText(__('app.stampDiscount'), $appLocale, $printingChoice) }} @if($order->items()->where('is_free_item_from_stamp', true)->exists()) (@lang('app.freeItem')) @if (count($receiptLanguages) > 1)
{{ flipText(__('app.freeItem', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif @endif
@if($order->stamp_discount_amount > 0) -{{ currency_format($order->stamp_discount_amount, restaurant()->currency_id) }} @else {{ flipText(__('app.free'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('app.free', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif @endif
@endif @php // Calculate discounted subtotal (after both regular and loyalty discounts) // Loyalty points are always removed from subtotal before calculating tax $discountedSubtotal = $order->sub_total - ($order->discount_amount ?? 0) - ($order->loyalty_discount_amount ?? 0); // Calculate service charges on discounted subtotal $serviceTotal = 0; if ($order->charges && $order->charges->count() > 0) { foreach ($order->charges as $chargeRelation) { $charge = $chargeRelation->charge; if ($charge) { $chargeAmount = $charge->getAmount((float)$discountedSubtotal); $serviceTotal += (float)$chargeAmount; } } } // For backward compatibility, keep $net for service charge display $net = $order->sub_total - ($order->discount_amount ?? 0); $taxBase = $order->tax_base ?? $net; @endphp @foreach ($order->charges as $item)
{{ $item->charge->charge_name }} @if ($item->charge->charge_type == 'percent') ({{ $item->charge->charge_value }}%) @endif: {{ currency_format($item->charge->getAmount($discountedSubtotal), restaurant()->currency_id) }}
@endforeach @if ($order->tip_amount > 0)
{{ flipText(__('modules.order.tip'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.tip', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ currency_format($order->tip_amount, restaurant()->currency_id) }}
@endif @if ($order->order_type === 'delivery' && !is_null($order->delivery_fee))
{{ flipText(__('modules.delivery.deliveryFee'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.delivery.deliveryFee', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
@if($order->delivery_fee > 0) {{ currency_format($order->delivery_fee, restaurant()->currency_id) }} @else {{ flipText(__('modules.delivery.freeDelivery'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.delivery.freeDelivery', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif @endif
@endif @if ($taxMode == 'order') @foreach ($order->taxes as $item) @if($item->tax)
{{ $item->tax->tax_name }} ({{ $item->tax->tax_percent }}%): @php // Calculate tax_base based on Tax Calculation Base setting // Check if service charges should be included in tax base $restaurant = restaurant(); $includeChargesInTaxBase = false; if ($restaurant && isset($restaurant->include_charges_in_tax_base)) { $includeChargesInTaxBase = (bool)$restaurant->include_charges_in_tax_base; } // Tax base = (subtotal - discounts) + service charges (if enabled) $taxBase = $includeChargesInTaxBase ? ($discountedSubtotal + $serviceTotal) : $discountedSubtotal; $taxBase = max(0, (float)$taxBase); // Calculate tax on tax_base $taxAmount = ($item->tax->tax_percent / 100) * $taxBase; @endphp {{ currency_format($taxAmount, restaurant()->currency_id) }}
@endif @endforeach @else @if($order->total_tax_amount > 0) @php $taxTotals = []; $totalTax = 0; foreach ($order->items as $item) { $qty = $item->quantity ?? 1; $taxBreakdown = is_array($item->tax_breakup) ? $item->tax_breakup : (json_decode($item->tax_breakup, true) ?? []); foreach ($taxBreakdown as $taxName => $taxInfo) { if (!isset($taxTotals[$taxName])) { $taxTotals[$taxName] = [ 'percent' => $taxInfo['percent'] ?? 0, 'amount' => ($taxInfo['amount'] ?? 0) * $qty ]; } else { $taxTotals[$taxName]['amount'] += ($taxInfo['amount'] ?? 0) * $qty; } } $totalTax += $item->tax_amount ?? 0; } @endphp
@foreach ($taxTotals as $taxName => $taxInfo)
{{ $taxName }} ({{ $taxInfo['percent'] }}%) {{ currency_format($taxInfo['amount'], restaurant()->currency_id) }}
@endforeach
{{ flipText(__('modules.order.totalTax'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.totalTax', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ currency_format($totalTax, restaurant()->currency_id) }}
@endif @endif @if ($payment)
{{ flipText(__('modules.order.balanceReturn'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.balanceReturn', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ currency_format($payment->balance, restaurant()->currency_id) }}
@endif
{{ flipText(__('modules.order.total'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.total', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
{{ currency_format($order->total, restaurant()->currency_id) }}
@if ($receiptSettings->show_payment_status)
{{ flipText(__('modules.order.paymentStatus'), $appLocale, $printingChoice) }} @if (count($receiptLanguages) > 1)
{{ flipText(__('modules.order.paymentStatus', [], $receiptLanguages[1]), $receiptLanguages[1], $printingChoice) }} @endif
@if($order->status === 'paid') @lang('modules.order.paid') @else @lang('modules.order.unpaid') @endif
@endif