@lang('modules.order.totalItem')
{{ count($orderDetail->items) }}
@lang('modules.order.subTotal')
@php
$stampDiscountAmount = (float)($orderDetail->stamp_discount_amount ?? 0);
$hasFreeStampItems = $orderDetail->items()->where('is_free_item_from_stamp', true)->exists();
@endphp
@if($stampDiscountAmount > 0 || $hasFreeStampItems)
@lang('app.stampDiscount')
@if($stampDiscountAmount > 0)
(-{{ currency_format($stampDiscountAmount, $currencyId ?? restaurant()->currency_id) }})
@elseif($hasFreeStampItems)
(@lang('app.freeItem'))
@endif
@endif
{{ currency_format($orderDetail->sub_total, restaurant()->currency_id) }}
@if ($orderDetail->loyalty_points_redeemed > 0 && $orderDetail->loyalty_discount_amount > 0)
@lang('loyalty::app.loyaltyDiscount') ({{ number_format($orderDetail->loyalty_points_redeemed) }} @lang('loyalty::app.points'))
-{{ currency_format($orderDetail->loyalty_discount_amount, $currencyId ?? restaurant()->currency_id) }}
@endif
@if (!is_null($orderDetail->discount_amount) && $orderDetail->loyalty_points_redeemed == 0)
@lang('modules.order.discount') @if ($orderDetail->discount_type == 'percent') ({{ rtrim(rtrim($orderDetail->discount_value), '.') }}%) @endif
-{{ currency_format($orderDetail->discount_amount, restaurant()->currency_id) }}
@endif
@foreach ($extraCharges as $charge)
{{ $charge->charge_name }}
@if ($charge->charge_type == 'percent')
({{ $charge->charge_value }}%)
@endif
@if($orderDetail->status !== 'paid' && user_can('Update Order'))
@endif
@php
// Calculate discounted subtotal for charges (after both regular and loyalty discounts)
$chargeBase = $orderDetail->sub_total
- ($orderDetail->discount_amount ?? 0)
- ($orderDetail->loyalty_discount_amount ?? 0);
@endphp
{{ currency_format($charge->getAmount($chargeBase), restaurant()->currency_id) }}
@endforeach
@if ($orderDetail->tip_amount > 0)
@lang('modules.order.tip')
{{ currency_format($orderDetail->tip_amount, restaurant()->currency_id) }}
@endif
@if ($orderType === 'delivery' && !is_null($deliveryFee))
@lang('modules.delivery.deliveryFee')
@if($deliveryFee > 0)
{{ currency_format($deliveryFee, restaurant()->currency_id) }}
@else
@lang('modules.delivery.freeDelivery')
@endif
@endif
@if ($taxMode == 'order')
@php
$net = $orderDetail->sub_total - ($orderDetail->discount_amount ?? 0);
$taxBase = $orderDetail->tax_base ?? $net;
@endphp
@foreach ($orderDetail->taxes as $item)
@if (!$item->tax)
@continue
@endif
{{ $item->tax->tax_name }} ({{ $item->tax->tax_percent }}%)
@php
// Calculate tax on discounted subtotal (after both regular and loyalty discounts)
$discountedSubtotal = $orderDetail->sub_total
- ($orderDetail->discount_amount ?? 0)
- ($orderDetail->loyalty_discount_amount ?? 0);
$taxAmount = ($item->tax->tax_percent / 100) * $discountedSubtotal;
@endphp
{{ currency_format($taxAmount, restaurant()->currency_id) }}
@endforeach
@else
@php
// Show item-wise tax breakdown using actual order items data
$taxTotals = [];
foreach ($orderItemTaxDetails as $item) {
$qty = $item['qty'] ?? 1;
if (!empty($item['tax_breakup'])) {
foreach ($item['tax_breakup'] as $taxName => $taxInfo) {
if (!isset($taxTotals[$taxName])) {
$taxTotals[$taxName] = [
'percent' => $taxInfo['percent'],
'amount' => 0
];
}
$taxTotals[$taxName]['amount'] += $taxInfo['amount'] * $qty;
}
}
}
@endphp
@foreach ($taxTotals as $taxName => $taxInfo)
{{ $taxName }} ({{ $taxInfo['percent'] }}%)
{{ currency_format($taxInfo['amount'], restaurant()->currency_id) }}
@endforeach
@lang('modules.order.totalTax')
@if($taxMode === 'item')
@lang(restaurant()->tax_inclusive ? 'modules.settings.taxInclusive' : 'modules.settings.taxExclusive')
@endif
{{ currency_format($totalTaxAmount, restaurant()->currency_id) }}
@endif
@lang('modules.order.total')
{{ currency_format($orderDetail->total, restaurant()->currency_id) }}
@if ($orderDetail->status == 'billed' && user_can('Update Order'))
@endif
@if($orderDetail->status == 'paid')
@endif