@php $themeColor = $storeSettings['theme_color'] ?? '#4f46e5'; $normalizeHex = function (string $hex): string { $hex = ltrim(trim($hex), '#'); if (strlen($hex) === 3) { $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; } return strlen($hex) === 6 ? '#'.$hex : '#4f46e5'; }; $mixHex = function (string $hex, string $targetHex, float $percent) use ($normalizeHex): string { $hex = $normalizeHex($hex); $targetHex = $normalizeHex($targetHex); $percent = max(0, min(100, $percent)) / 100; [$r1, $g1, $b1] = [hexdec(substr($hex, 1, 2)), hexdec(substr($hex, 3, 2)), hexdec(substr($hex, 5, 2))]; [$r2, $g2, $b2] = [hexdec(substr($targetHex, 1, 2)), hexdec(substr($targetHex, 3, 2)), hexdec(substr($targetHex, 5, 2))]; $r = (int) round($r1 + (($r2 - $r1) * $percent)); $g = (int) round($g1 + (($g2 - $g1) * $percent)); $b = (int) round($b1 + (($b2 - $b1) * $percent)); return sprintf('#%02x%02x%02x', $r, $g, $b); }; $themeColor = $normalizeHex($themeColor); $themeDark = $mixHex($themeColor, '#000000', 22); $themeSoftBorder = $mixHex($themeColor, '#ffffff', 72); $themeSofterBorder = $mixHex($themeColor, '#ffffff', 82); $themeSoftBg = $mixHex($themeColor, '#ffffff', 92); $themeGrandBg = $mixHex($themeColor, '#ffffff', 86); $discountsEnabled = (bool) ($storeSettings['enable_discounts'] ?? true); $vouchersEnabled = (bool) ($storeSettings['enable_vouchers'] ?? true); $marketplaceEnabled = (bool) ($storeSettings['enable_marketplace'] ?? true); $promosEnabled = $discountsEnabled || $vouchersEnabled; $showDiscounts = $promosEnabled && (float) ($transaction->discount ?? 0) > 0; $showMarketplace = $marketplaceEnabled && ($transaction->store_type === 'marketplace' || (float) ($transaction->marketplace_tax_amount ?? 0) > 0); $showOrderNumber = $marketplaceEnabled && $transaction->items->contains(fn ($item) => filled($item->order_number)); $showPpn = (float) ($transaction->ppn_tax_amount ?? 0) > 0; $discountLabel = $vouchersEnabled && $transaction->voucher_code ? 'Voucher ' . $transaction->voucher_code : 'Diskon'; @endphp @php $isOnline = $transaction->store_type === 'online'; $isBooking = $transaction->order_type === 'booking'; $paymentBadgeClass = $transaction->payment_status === 'paid' ? 'badge-paid' : ($transaction->payment_status === 'partial' ? 'badge-partial' : 'badge-unpaid'); $paymentLabel = $transaction->payment_status === 'paid' ? 'LUNAS' : ($transaction->payment_status === 'partial' ? 'SEBAGIAN' : 'BELUM BAYAR'); @endphp
@if(!empty($storeSettings['store_logo'])) @endif

{{ $storeSettings['store_name'] ?? 'ADK POS' }}

{!! nl2br(e($storeSettings['store_address'] ?? 'Alamat toko belum diatur')) !!}
Telp: {{ $storeSettings['store_phone'] ?? '-' }}

INVOICE

No. Invoice #{{ $transaction->transaction_code }}
Tanggal {{ $transaction->created_at->format('d/m/Y') }}
Jam {{ $transaction->created_at->format('H:i') }}
Kasir {{ $transaction->user->name ?? '-' }}
Status Pembayaran {{ $paymentLabel }}
Metode Bayar {{ ucfirst($transaction->payment_method ?? '-') }}

Informasi Pelanggan

{{ $transaction->customer_name ?? 'Pelanggan Umum' }}
@if($isBooking)
Info Booking
@if($transaction->booking_code) Kode: {{ $transaction->booking_code }}
@endif @if($transaction->booking_date) Jadwal: {{ \Illuminate\Support\Carbon::parse($transaction->booking_date)->format('d/m/Y H:i') }}
@endif @if($transaction->booker_name) Pemesan: {{ $transaction->booker_name }}
@endif @if($transaction->booker_phone) Telp Pemesan: {{ $transaction->booker_phone }} @endif
@endif @if($isOnline && $transaction->recipient_address)
{{ $transaction->recipient_address }}
{{ $transaction->recipient_city }} {{ $transaction->recipient_postal_code }}
Telp: {{ $transaction->recipient_phone ?: '-' }}
@endif

Informasi Transaksi

@if($isBooking && $transaction->booking_code) @endif @if($transaction->due_date) @endif
Kasir {{ $transaction->user->name ?? '-' }}
Cabang {{ $transaction->branch->name ?? '-' }}
Tipe Order @if($isOnline) Online Store @elseif($isBooking) Booking @else POS / Walk-in @endif
Kode Booking {{ $transaction->booking_code }}
Jatuh Tempo {{ \Illuminate\Support\Carbon::parse($transaction->due_date)->format('d/m/Y') }}
@if($showOrderNumber) @endif @foreach($transaction->items as $index => $item) @if($showOrderNumber) @endif @endforeach
No ItemNo. PesananQty Harga Subtotal
{{ $index + 1 }}
{{ $item->product->name ?? 'Produk Dihapus' }}
@if(!empty($item->product?->variant_name))
Varian: {{ $item->product->variant_name }}
@endif @if($item->custom_width && $item->custom_height)
Ukuran: {{ rtrim(rtrim(number_format((float) $item->custom_width, 2, ',', '.'), '0'), ',') }} x {{ rtrim(rtrim(number_format((float) $item->custom_height, 2, ',', '.'), '0'), ',') }} {{ $item->product && $item->product->pricing_unit === 'cm2' ? 'cm' : 'm' }}
@endif @if($item->note)
Catatan: {{ $item->note }}
@endif @if($showDiscounts && (float) $item->discount_amount > 0)
Diskon {{ rtrim(rtrim(number_format((float) $item->discount_percent, 2, ',', '.'), '0'), ',') }}% (- Rp {{ number_format((float) $item->discount_amount, 0, ',', '.') }})
@endif @if($showMarketplace && (float) $item->shopee_admin_fee_percent > 0)
Pajak Marketplace {{ rtrim(rtrim(number_format((float) $item->shopee_admin_fee_percent, 2, ',', '.'), '0'), ',') }}% (Rp {{ number_format((float) $item->shopee_admin_fee_amount, 0, ',', '.') }})
@endif
{{ $item->order_number ?: '-' }}{{ number_format($item->quantity, 0, ',', '.') }} Rp {{ number_format($item->price, 0, ',', '.') }} Rp {{ number_format($item->subtotal, 0, ',', '.') }}
@if($transaction->note)

Catatan Transaksi

{{ $transaction->note }}
@endif @if($isOnline)

Informasi Pengiriman

Kurir {{ $transaction->shipping_courier ?: '-' }}
No. Resi {{ $transaction->shipping_tracking_number ?: '-' }}
Status {{ ucfirst($transaction->shipping_status ?: '-') }}
@endif

Ringkasan Pembayaran

@if($showMarketplace) @endif @if($showDiscounts) @endif @if($showPpn) @endif @if($transaction->payment_status === 'paid') @elseif($transaction->payment_status === 'partial') @endif
Jumlah Item {{ number_format($transaction->items->sum('quantity'), 0, ',', '.') }}
Subtotal Rp {{ number_format($transaction->subtotal, 0, ',', '.') }}
Pajak Marketplace @if(($transaction->marketplace_tax_mode ?? 'global') === 'global') ({{ rtrim(rtrim(number_format((float) ($transaction->marketplace_tax_rate ?? 0), 2, ',', '.'), '0'), ',') }}%) @else (Per Item) @endif {{ $transaction->marketplace_tax_burden === 'customer' ? '+' : '-' }} Rp {{ number_format($transaction->marketplace_tax_amount ?? 0, 0, ',', '.') }}
{{ $discountLabel }} - Rp {{ number_format($transaction->discount ?? 0, 0, ',', '.') }}
PPN ({{ rtrim(rtrim(number_format((float) ($transaction->ppn_tax_rate ?? 0), 2, ',', '.'), '0'), ',') }}%) {{ $transaction->ppn_tax_burden === 'customer' ? '+' : '-' }} Rp {{ number_format($transaction->ppn_tax_amount ?? 0, 0, ',', '.') }}
Total Tagihan Rp {{ number_format($transaction->total_amount, 0, ',', '.') }}
Dibayar ({{ ucfirst($transaction->payment_method ?? '-') }}) Rp {{ number_format($transaction->amount_paid, 0, ',', '.') }}
Kembalian Rp {{ number_format($transaction->change_amount, 0, ',', '.') }}
Sisa Tagihan Rp {{ number_format($transaction->remaining_amount, 0, ',', '.') }}