@php $line = str_repeat('=', 48); $dash = str_repeat('-', 48); $formatPrice = fn($v) => 'Rp ' . number_format($v ?? 0, 0, ',', '.'); // Translation helpers $l = function($key) use ($locale) { $labels = $locale === 'en' ? include base_path("lang/en/pdf/labels.php") : include base_path("lang/id/pdf/labels.php"); $keys = explode('.', $key); $value = $labels; foreach ($keys as $k) { $value = $value[$k] ?? $key; } return $value; }; @endphp
{{ $store['name'] }}
@if($store['address'])
{{ $store['address'] }}
@endif @if($store['phone'])
{{ $l('common.phone') }}: {{ $store['phone'] }}
@endif @if($store['email'])
{{ $l('common.email') }}: {{ $store['email'] }}
@endif @if($store['website'])
{{ $store['website'] }}
@endif
{{ $line }}
{{ $l('receipt.transaction_no') }}: {{ $transaction->invoice }}
{{ $l('receipt.transaction_date') }}: {{ \Carbon\Carbon::parse($transaction->created_at)->format('d/m/Y H:i') }}
{{ $l('common.cashier') }}: {{ $transaction->cashier->name ?? '-' }}
{{ $l('common.customer') }}: {{ $transaction->customer->name ?? $l('receipt.customer_type') }}
{{ $line }}
@foreach($transaction->details as $item) @php $qty = max(1, $item->qty); $total = $item->price; $unit = $item->unit_price ?: ($qty ? $total / $qty : $total); @endphp
{{ $item->product->title ?? $l('receipt.product') }}
@if($item->discount_total > 0 && ($item->pricing_group_label || $item->pricing_rule_name))
{{ $l('receipt.promo') }}: {{ $item->pricing_group_label ?: $item->pricing_rule_name }} {{ $formatPrice($item->base_unit_price) }}
@endif
{{ $qty }}x @ {{ $formatPrice($unit) }} {{ $formatPrice($total) }}
@endforeach
{{ $dash }}
@php $promoDiscount = $transaction->details->sum('discount_total'); $voucherDiscount = $transaction->customer_voucher_discount ?? 0; $loyaltyDiscount = $transaction->loyalty_discount_total ?? 0; $subtotal = ($transaction->grand_total ?? 0) + ($transaction->discount ?? 0) - ($transaction->shipping_cost ?? 0) - ($transaction->tax_total ?? 0) + $promoDiscount + $voucherDiscount + $loyaltyDiscount; $discount = $transaction->discount ?? 0; $total = $transaction->grand_total ?? 0; $shipping = $transaction->shipping_cost ?? 0; $taxTotal = $transaction->tax_total ?? 0; $taxRate = $transaction->tax_rate ?? 0; $cash = $transaction->cash ?? 0; $change = $transaction->change ?? 0; $paymentMethod = strtoupper($transaction->payment_method ?? 'TUNAI'); @endphp
{{ $l('common.subtotal') }} {{ $formatPrice($subtotal) }}
@if($promoDiscount > 0)
{{ $l('receipt.promo') }} -{{ $formatPrice($promoDiscount) }}
@endif @if($discount > 0)
{{ $l('invoice.manual_discount') }} -{{ $formatPrice($discount) }}
@endif @if($voucherDiscount > 0)
{{ $l('receipt.voucher_used') }} -{{ $formatPrice($voucherDiscount) }}
@endif @if($loyaltyDiscount > 0)
{{ $l('invoice.redeem_points') }} -{{ $formatPrice($loyaltyDiscount) }}
@endif @if($shipping > 0)
{{ $l('invoice.shipping_cost') }} {{ $formatPrice($shipping) }}
@endif @if($taxTotal > 0)
{{ str_replace(':rate', number_format($taxRate, 0), $l('receipt.tax_rate')) }} {{ $formatPrice($taxTotal) }}
@endif
{{ $l('receipt.grand_total') }} {{ $formatPrice($total) }}
{{ $dash }}
{{ $l('receipt.amount_tendered') }} ({{ $paymentMethod }}) {{ $formatPrice($cash) }}
@if($change > 0)
{{ $l('receipt.change_col') }} {{ $formatPrice($change) }}
@endif
{{ $line }}
barcode
{{ $transaction->invoice }}
{{ $l('common.thank_you') }}