@php
$line = str_repeat('=', 32);
$dash = str_repeat('-', 32);
$formatPrice = fn($v) => 'Rp ' . number_format($v ?? 0, 0, ',', '.');
@endphp
{{ $store['name'] }}
@if($store['address'])
{{ $store['address'] }}
@endif
@if($store['phone'])
Telp: {{ $store['phone'] }}
@endif
@if($store['email'])
Email: {{ $store['email'] }}
@endif
@if($store['website'])
{{ $store['website'] }}
@endif
{{ $line }}
No:
{{ $transaction->invoice }}
Tgl:
{{ \Carbon\Carbon::parse($transaction->created_at)->format('d/m/Y H:i') }}
Kasir:
{{ $transaction->cashier->name ?? '-' }}
Pelanggan:
{{ $transaction->customer->name ?? 'Umum' }}
{{ $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 ?? 'Produk' }}
@if($item->discount_total > 0 && ($item->pricing_group_label || $item->pricing_rule_name))
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
Subtotal
{{ $formatPrice($subtotal) }}
@if($promoDiscount > 0)
Promo
-{{ $formatPrice($promoDiscount) }}
@endif
@if($discount > 0)
Diskon Manual
-{{ $formatPrice($discount) }}
@endif
@if($voucherDiscount > 0)
Voucher
-{{ $formatPrice($voucherDiscount) }}
@endif
@if($loyaltyDiscount > 0)
Redeem Poin
-{{ $formatPrice($loyaltyDiscount) }}
@endif
@if($shipping > 0)
Ongkir
{{ $formatPrice($shipping) }}
@endif
@if($taxTotal > 0)
PPN {{ number_format($taxRate, 0) }}%
{{ $formatPrice($taxTotal) }}
@endif
TOTAL
{{ $formatPrice($total) }}
{{ $dash }}
Bayar ({{ $paymentMethod }})
{{ $formatPrice($cash) }}
@if($change > 0)
Kembali
{{ $formatPrice($change) }}
@endif
{{ $line }}
{{ $transaction->invoice }}
Terima kasih!