@php
$line = str_repeat('=', 48);
$dash = str_repeat('-', 48);
$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 = $qty ? $total / $qty : $total;
@endphp
{{ $item->product->title ?? 'Produk' }}
{{ $qty }}x @ {{ $formatPrice($unit) }}
{{ $formatPrice($total) }}
@endforeach
{{ $dash }}
@php
$subtotal = ($transaction->grand_total ?? 0) + ($transaction->discount ?? 0);
$discount = $transaction->discount ?? 0;
$total = $transaction->grand_total ?? 0;
$cash = $transaction->cash ?? 0;
$change = $transaction->change ?? 0;
$paymentMethod = strtoupper($transaction->payment_method ?? 'TUNAI');
@endphp
Subtotal
{{ $formatPrice($subtotal) }}
@if($discount > 0)
Diskon
-{{ $formatPrice($discount) }}
@endif
TOTAL
{{ $formatPrice($total) }}
{{ $dash }}
Bayar ({{ $paymentMethod }})
{{ $formatPrice($cash) }}
@if($change > 0)
Kembali
{{ $formatPrice($change) }}
@endif
{{ $line }}
{{ $transaction->invoice }}
Terima kasih!