@php $itemCount = $sale->items->count(); $isLargeDoc = $itemCount > 8; $paperLabel = $isLargeDoc ? 'A4 lebih nyaman untuk item banyak' : 'A5 ideal untuk transaksi ringkas'; $paperNote = $isLargeDoc ? 'Dokumen tidak dikunci ke ukuran tertentu. Untuk item banyak, A4 biasanya paling aman; jika printer mendukung, Anda tetap bisa menyesuaikan sendiri margin, orientasi, dan skala.' : 'Untuk transaksi singkat, A5 biasanya paling pas. Jika isi memanjang, Anda bisa pindah ke A4 atau ubah skala di dialog cetak tanpa merusak layout.'; $rawAppName = $settings['app_name'] ?? 'GMComp'; $brandedAppName = preg_replace_callback('/GMComp/i', function ($m) { return 'GMComp'; }, htmlspecialchars($rawAppName, ENT_QUOTES, 'UTF-8')); @endphp
{{-- HEADER --}}
{!! $brandedAppName !!}
@if(!empty($settings['app_address'])){{ $settings['app_address'] }}
@endif @if(!empty($settings['app_phone']))Telp: {{ $settings['app_phone'] }}@if(!empty($settings['app_email']))  |  {{ $settings['app_email'] }}@endif @endif
Invoice Penjualan
{{ $sale->sale_number }}
{{ $sale->created_at->translatedFormat('d F Y, H:i') }} WIB
{{-- META --}}
Kepada
Pelanggan {{ $sale->customer?->name ?? 'Pelanggan Umum' }}
@if($sale->customer?->phone)
Telepon {{ $sale->customer->phone }}
@endif @if($sale->customer?->address)
Alamat {{ Str::limit($sale->customer->address, 60) }}
@endif
Transaksi
Kasir {{ $sale->user?->name }}
Tanggal {{ $sale->created_at->format('d/m/Y H:i') }}
{{-- ITEMS --}}
Item Penjualan
@if($sale->items->sum('discount') > 0)@endif @foreach($sale->items as $i => $item) @if($sale->items->sum('discount') > 0) @endif @endforeach
# Produk Qty Harga SatuanDiskonSubtotal
{{ $i + 1 }} {{ $item->product?->name }} @if($item->product?->code)
{{ $item->product->code }}
@endif
{{ $item->quantity }}{{ $item->product?->unit ? ' '.$item->product->unit : '' }} Rp {{ number_format($item->unit_price, 0, ',', '.') }} @if($item->discount > 0)- Rp {{ number_format($item->discount, 0, ',', '.') }}@else—@endif Rp {{ number_format($item->subtotal, 0, ',', '.') }}
{{-- BOTTOM: PAYMENT + TOTALS --}}
Pembayaran
Metode {{ $sale->payment_method_label }}
Dibayar Rp {{ number_format($sale->paid_amount, 0, ',', '.') }}
@if($sale->change_amount > 0)
Kembalian Rp {{ number_format($sale->change_amount, 0, ',', '.') }}
@endif
Subtotal Rp {{ number_format($sale->subtotal, 0, ',', '.') }}
@if($sale->discount > 0)
Diskon - Rp {{ number_format($sale->discount, 0, ',', '.') }}
@endif @if($sale->tax > 0)
Pajak Rp {{ number_format($sale->tax, 0, ',', '.') }}
@endif
TOTAL Rp {{ number_format($sale->total, 0, ',', '.') }}
{{-- FOOTER --}}
{{-- .page --}}
{{-- .screen-wrap --}}