@php $paidTotal = $sale->payment_method === 'cash' ? (float) $sale->grand_total : (float) $sale->payments->sum('amount'); $remaining = max(0, (float) $sale->grand_total - $paidTotal); $money = fn($amount) => 'Rp ' . number_format((float) $amount, 0, ',', '.'); // Angka-angka ini dibaca dari dokumen, bukan dihitung ulang di sini: // blade yang menghitung pajaknya sendiri akan diam-diam menyimpang // dari faktur begitu cara hitungnya berubah. $tax = (float) $sale->tax_amount; $dpp = $sale->taxBase(); $lineDiscount = $sale->lineDiscountTotal(); $hasTax = $sale->hasTaxLine(); @endphp
@if ($sale->tenant?->tenant_logo_url) @endif

{{ $sale->tenant?->name ?? '-' }}

@if ($sale->tenant?->address)

{{ $sale->tenant->address }}

@endif

Kepada: {{ $sale->customer?->name ?? '-' }}
Kirim ke: {{ $sale->customer?->address ?: '-' }}

FAKTUR

No. Invoice: {{ $sale->sale_number }}
Tanggal: {{ $sale->sale_date?->format('d/m/Y') ?? '-' }}
Jatuh Tempo: {{ $sale->getAttribute('due_date') ? \Illuminate\Support\Carbon::parse($sale->getAttribute('due_date'))->format('d/m/Y') : '-' }}
No. Surat Jalan: {{ $sale->getAttribute('delivery_number') ?: '-' }}
{{-- --}} @foreach ($sale->details as $index => $detail) {{-- --}} @endforeach
No. Nama Barang QtyUnitHarga Satuan Diskon Keterangan Total
{{ $index + 1 }} {{ $detail->product?->name ?? '-' }} {{-- @if ($detail->product?->sku) KODE: {{ $detail->product->sku }} @endif --}} {{ rtrim(rtrim(number_format((float) $detail->quantity, 2, ',', '.'), '0'), ',') }} {{ $detail->unit?->code ?? '-' }} {{ $detail->unit?->code ?? '-' }}{{ $money($detail->unit_price) }} {{ $detail->discount_amount !== null ? $money($detail->discount_amount) : '-' }} {{ $detail->item_note ?? '' }} {{ $money($detail->line_total) }}
@if ($sale->note)

Catatan: {{ $sale->note }}

@endif
Tanda Terima
{{ $sale->customer?->name ?? '-' }}
Hormat Kami
{{ $sale->tenant?->name ?? '-' }}
Subtotal
{{ $money($sale->subtotal) }}
@if ($lineDiscount > 0)
Diskon item
-{{ $money($lineDiscount) }}
@endif @if ($sale->discount_amount > 0)
Diskon
-{{ $money($sale->discount_amount) }}
@endif @if ($sale->shipping_cost > 0)
Ongkos kirim
{{ $money($sale->shipping_cost) }}
@endif @if ($hasTax)
DPP
{{ $money($dpp) }}
Pajak (11%)
{{ $money($tax) }}
@endif
Total
{{ $money($sale->grand_total) }}
Bayar
{{ $money($paidTotal) }}
Sisa
{{ $money($remaining) }}
@if ($hasTax)

Harga termasuk PPN 11%: DPP = (subtotal-diskon) ÷ (1+11%); pajak = DPPx11%.

@endif
@if ($sale->tenant?->tenant_logo_url) @endif

{{ $sale->tenant?->name ?? '-' }}

@if ($sale->tenant?->address)

{{ $sale->tenant->address }}

@endif

Kepada: {{ $sale->customer?->name ?? '-' }}
Kirim ke: {{ $sale->customer?->address ?: '-' }}

SURAT
JALAN

No. Invoice: {{ $sale->sale_number }}
Tanggal: {{ $sale->sale_date?->format('d/m/Y') ?? '-' }}
Jatuh Tempo: {{ $sale->getAttribute('due_date') ? \Illuminate\Support\Carbon::parse($sale->getAttribute('due_date'))->format('d/m/Y') : '-' }}
No. Surat Jalan: {{ $sale->getAttribute('delivery_number') ?: '-' }}
{{-- --}} @foreach ($sale->details as $index => $detail) {{-- --}} @endforeach
No. Nama Barang QtyUnitKeterangan Kesesuaian
{{ $index + 1 }} {{ $detail->product?->name ?? '-' }} {{-- @if ($detail->product?->sku) KODE: {{ $detail->product->sku }} @endif --}} {{ rtrim(rtrim(number_format((float) $detail->quantity, 2, ',', '.'), '0'), ',') }} {{ $detail->unit?->code ?? '-' }} {{ $detail->unit?->code ?? '-' }}@include('sales._item-delivery-note', ['detail' => $detail])
@include('sales._delivery-pending', ['sale' => $sale]) @if ($sale->note)

Catatan: {{ $sale->note }}

@endif
Tanda Terima
{{ $sale->customer?->name ?? '-' }}
Hormat Kami
{{ $sale->tenant?->name ?? '-' }}
Pengirim
 

☑ Barang harap diperiksa terlebih dahulu sebelum ditanda tangan. ☑ Beri tanda bila sesuai.