@lang('modules.order.subTotal')
{{ currency_format($order->sub_total, $restaurant->currency_id) }}
@if (!is_null($order->discount_amount))
@lang('modules.order.discount') @if ($order->discount_type == 'percent')
({{ rtrim(rtrim(number_format($order->discount_value, 2), '0'), '.') }}%)
@endif
-{{ currency_format($order->discount_amount, $restaurant->currency_id) }}
@endif
@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($order->sub_total - ($order->discount_amount ?? 0))) , $restaurant->currency_id) }}
@endforeach
@if ($taxMode == 'order')
@foreach ($order->taxes as $item)
{{ $item->tax->tax_name }} ({{ $item->tax->tax_percent }}%)
{{ currency_format(($item->tax->tax_percent / 100) * ($order->sub_total - ($order->discount_amount ?? 0)), $restaurant->currency_id) }}
@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
@lang('modules.order.totalTax')
@lang($restaurant?->tax_inclusive ? 'modules.settings.taxInclusive' : 'modules.settings.taxExclusive')
{{ currency_format($totalTax, $restaurant->currency_id) }}
@endif
@endif
@if ($order->order_type === 'delivery' && !is_null($order->delivery_fee))
@lang('modules.delivery.deliveryFee')
@if($order->delivery_fee > 0)
{{ currency_format($order->delivery_fee, $restaurant->currency_id) }}
@else
@lang('modules.delivery.freeDelivery')
@endif
@endif
@if ($canAddTip || $order->tip_amount > 0)
@lang('modules.order.tip')
@if($order->tip_amount > 0 && $order->tip_note)
"{{ $order->tip_note }}"
@endif
@if($order->tip_amount > 0 && !$canAddTip)
{{ currency_format($order->tip_amount, $restaurant->currency_id) }}
@endif
@if($canAddTip)
@if($order->tip_amount > 0)
{{ currency_format($order->tip_amount, $restaurant->currency_id) }}
@else
@lang('modules.order.addTip')
@endif
@endif
@endif
@lang('modules.order.total')
{{ currency_format($order->total, $restaurant->currency_id) }}