{{-- Header --}}

{{ $store['name'] }}

{{ $store['addr'] }}
{{ $store['phone'] }}

Invoice Penjualan

{{ $trx->invoice }}
{{-- Info kiri/kanan --}}
Informasi Pelanggan
Nama: {{ $trx->customer->name ?? 'Umum' }}
@if($trx->transaction_type === 'dine_in')
Meja: {{ $trx->table->number ?? '-' }}
Pelayan: {{ $trx->waiter->name ?? '-' }}
@endif @if($trx->transaction_type === 'platform')
Platform: {{ $trx->platform ?? '-' }}
@endif @if($trx->shipping_name || $trx->shipping_address)
Pengirim/kurir: {{ $trx->shipping_name ?? '-' }}
Alamat: {{ $trx->shipping_address ?? '-' }}
No. Resi: {{ $trx->shipping_ref ?? '-' }}
Status Kirim: {{ $statusShipping[$trx->shipping_status] ?? ucfirst($trx->shipping_status ?? '-') }}
@endif
Detail Transaksi
@if($isRestaurantActive)
Jenis: {{ $statusTransaction[$trx->transaction_type] ?? '-' }}
@endif
Tanggal: {{ \Carbon\Carbon::parse($trx->created_at)->format('d/m/Y H:i') }}
Status Pembayaran: {{ $statusPayment[$trx->status] ?? ucfirst($trx->status) }}
@if($trx->notes_noref)
No. Referensi: {{ $trx->notes_noref }}
@endif @if($trx->notes_transaction_source)
Sumber: {{ $trx->notes_transaction_source }}
@endif
Kasir: {{ $trx->cashier_shift->user->name }}
@php $rows = []; foreach ($trx->transaction_details as $index => $d) { $qty = (float)$d->quantity; $price = (float)$d->price; $discVal = 0; if ($d->discount !== null && $d->discount_type) { if ($d->discount_type === 'percentage') { $discVal = $price * $qty * ((float)$d->discount / 100); } else { $discVal = (float)$d->discount * $qty; } } $amount = ($price * $qty) - $discVal; $name = '-'; $unit = '-'; if ($d->items_type === \App\Models\ProductVariant::class) { $product = $d->items->product ?? null; if ($product) { if ($product->has_variant) { $variants = $d->items->product_variant_values ?? []; $variantList = collect($variants)->map(function ($v) { return ($v->variant_value->variant_option->name ?? '-') . ':' . ($v->variant_value->name ?? '-'); })->join(', '); $name = $product->name . ' [' . $variantList . ']'; } else { $name = $product->name ?? '-'; } } $unit = $d->items->unit->name ?? '-'; } elseif ($d->items_type === \App\Models\Menu::class) { $name = $d->items->name ?? '-'; $unit = $d->items->unit->name ?? '-'; } elseif ($d->items_type === \App\Models\DiscountPackage::class) { $name = ($d->items->name ?? 'Paket Diskon'); $unit = '-'; } else { $name = $d->items->name ?? ($d->items->title ?? '-'); } $rows[] = [ 'no' => $index + 1, 'name' => $name, 'qty' => $qty, 'price' => $price, 'unit' => $unit, 'disc' => $discVal, 'amount' => $amount, 'expired' => $d->expired_at ?? null, 'note' => $d->note ?? null, ]; } $subtotal = (float)($trx->subtotal ?? array_sum(array_column($rows, 'amount')) + (float)($trx->discount ?? 0)); $discountGlobal = (float)($trx->discount ?? 0); $grandTotal = (float)($trx->grand_total ?? ($subtotal - $discountGlobal)); $pay = (float)($trx->pay ?? 0); $remaining = max($grandTotal - $pay, 0); @endphp @foreach ($rows as $r) @endforeach @foreach($trx->transaction_taxs as $tax) @endforeach
No Item Qty Harga Diskon Total
{{ $r['no'] }} {{ $r['name'] }} @if($r['note'])
Catatan: {{ $r['note'] }}
@endif
{{ (int)$r['qty'] }} Rp {{ number_format($r['price'], 0) }} Rp {{ number_format($r['disc'], 0) }} Rp {{ number_format($r['amount'], 0) }}
Subtotal Rp {{ number_format($subtotal, 0) }}
Diskon Rp {{ number_format($discountGlobal, 0) }}
{{ $tax->name }} Rp {{ number_format($tax->value, 0) }}
Grand Total Rp {{ number_format($grandTotal, 0) }}
@if($trx->pay > 0) @endif @foreach ($trx->transaction_payments as $i => $p) @if(!empty($p->notes)) @endif @endforeach
No Tanggal Pembayaran Metode Pembayaran Akun Bank Jumlah Bayar
1 {{ \Carbon\Carbon::parse($trx->transaction_date)->format('d/m/Y') }} {{ strtoupper($trx->payment_method ?? '-') }} @php $bank = $transaction->bank_account ?? null; $bankName = $bank->bank_name ?? $p->bank_name ?? null; $accName = $bank->account_name ?? $p->account_name ?? null; $accNo = $bank->account_number ?? $p->account_number ?? null; @endphp @if($bankName || $accName || $accNo) {{ $bankName }} - {{ $accName }} [{{ $accNo }}] @else - @endif Rp {{ number_format((float)$trx->pay, 0) }}
{{ $i + 2 }} {{ \Carbon\Carbon::parse($p->paid_at ?? $p->created_at)->format('d/m/Y') }} {{ strtoupper($p->method ?? $p->payment_method ?? '-') }} @php // Dukungan dua kemungkinan skema: $bank = $p->bank_account ?? null; $bankName = $bank->bank_name ?? $p->bank_name ?? null; $accName = $bank->account_name ?? $p->account_name ?? null; $accNo = $bank->account_number ?? $p->account_number ?? null; @endphp @if($bankName || $accName || $accNo) {{ $bankName }} - {{ $accName }} [{{ $accNo }}] @else - @endif Rp {{ number_format((float)$p->amount, 0) }}
Catatan: {{ $p->notes }}
Total Bayar Rp {{ number_format($pay + $trx->transaction_payments->sum('amount'), 0) }}
@if($trx->notes_note)
Catatan:
{{ $trx->notes_note }}
@endif
Informasi Bank Transfer: @foreach($banks as $bank)
{{ $bank->bank_name }} - {{ $bank->account_name }} [{{ $bank->account_number }}]
@endforeach