@php $bulanId = ['','Januari','Februari','Maret','April','Mei','Juni', 'Juli','Agustus','September','Oktober','November','Desember']; $fmtTgl = fn($d) => $d ? $d->format('d') . ' ' . $bulanId[(int)$d->format('n')] . ' ' . $d->format('Y') : '—'; $rupiah = fn($n) => 'Rp ' . number_format($n, 0, ',', '.'); $no = $faktur->nomor; $tglFmt = $fmtTgl($faktur->tanggal_faktur); $namaFaskes = $faktur->nama_faskes; $namaPerush = $profile->nama_perusahaan ?? $profile->nama ?? 'PT. IDEMEDIKA'; $alamat = $profile->alamat ?? ''; $telp = collect([$profile->no_telp_1 ?? null, $profile->no_telp_2 ?? null])->filter()->implode(' / '); $email = $profile->email ?? ''; $npwp = $profile->npwp ?? ''; $cetakPada = $fmtTgl(now()) . ', ' . now()->format('H:i'); $ppnMult = $faktur->jenis_ppn === 'sudah_ppn' ? 1.11 : 1; function terbilangKsoLot($angka) { $satuan = ['','satu','dua','tiga','empat','lima','enam','tujuh','delapan','sembilan','sepuluh', 'sebelas','dua belas','tiga belas','empat belas','lima belas','enam belas','tujuh belas', 'delapan belas','sembilan belas']; $angka = abs((int) $angka); if ($angka === 0) return 'nol'; if ($angka < 20) return $satuan[$angka]; if ($angka < 100) return $satuan[(int)($angka/10) + 9] . ' puluh' . ($angka % 10 ? ' ' . $satuan[$angka % 10] : ''); $r = ''; if ($angka >= 1000000000) { $r .= terbilangKsoLot((int)($angka/1000000000)) . ' milyar '; $angka %= 1000000000; } if ($angka >= 1000000) { $r .= terbilangKsoLot((int)($angka/1000000)) . ' juta '; $angka %= 1000000; } if ($angka >= 1000) { $x = (int)($angka/1000); $r .= ($x === 1 ? 'seribu' : terbilangKsoLot($x) . ' ribu') . ' '; $angka %= 1000; } if ($angka >= 100) { $x = (int)($angka/100); $r .= ($x === 1 ? 'seratus' : terbilangKsoLot($x) . ' ratus') . ' '; $angka %= 100; } if ($angka > 0) { $r .= terbilangKsoLot($angka); } return trim($r); } @endphp
@if(!empty($logoBase64))Logo@endif
{{ $namaPerush }}
{{ $alamat }} @if($telp)
Telp: {{ $telp }}@endif @if($email) | {{ $email }}@endif @if($npwp)
NPWP: {{ $npwp }}@endif
Faktur Penjualan
No: {{ $no }}
Tgl: {{ $tglFmt }}
Kepada Yth.
{{ $faskes?->nama_perusahaan ?: $namaFaskes }}
@php $alamatFaskes = $faskes?->alamat_penagihan ?: $faskes?->alamat ?? null; @endphp @if($alamatFaskes)
{{ $alamatFaskes }}
@endif @if($faskes?->npwp)
NPWP: {{ $faskes->npwp }}
@endif
Informasi Faktur
No. Faktur PPN  : {{ $faktur->nomor_efaktur ?? '—' }}
Jatuh Tempo    : {{ $faktur->tgl_jatuh_tempo ? $fmtTgl($faktur->tgl_jatuh_tempo) : '—' }}
Total           : Rp {{ number_format($faktur->total_harga, 0, ',', '.') }}
@if($faktur->catatan)
Catatan: {{ $faktur->catatan }}
@endif
@php $rowNo = 1; @endphp @foreach($faktur->pemakaians as $pemakaian)
{{ $pemakaian->nomor_penjualan_kso }} @if($pemakaian->nama_pasien) — {{ $pemakaian->nama_pasien }}@endif ({{ $pemakaian->tgl_pemakaian->format('d-m-Y') }})
@foreach($pemakaian->items as $item) @php $stoks = $item->itemStoks ?? collect(); $jenisNie = $item->barang?->jenis_nie ?? $item->barang?->merekBarang?->jenis_nie; $noNie = $item->barang?->no_nie ?? $item->barang?->merekBarang?->no_nie; $totalQtyItem = $stoks->isNotEmpty() ? $stoks->sum(fn($s) => $s->qty_ambil ?? $s->qty ?? 0) : $item->qty; $lotLines = []; foreach ($stoks as $is) { $stok = $is->stok ?? null; $snStr = $stok?->no_serial ?? $is->no_serial ?? null; $lotStr = $stok?->no_lot ?? $is->no_lot ?? null; $expStr = ($stok?->tanggal_kedaluwarsa) ? \Carbon\Carbon::parse($stok->tanggal_kedaluwarsa)->format('m/Y') : null; $label = $snStr ? 'SN: '.$snStr : ($lotStr ? 'LOT: '.$lotStr : null); $sjNomor = $is->nomor_sj ?: $is->suratJalanLot?->nomor_sj ?: null; $parts = array_filter([$label, $expStr ? 'ED: '.$expStr : null]); if ($parts) { $entry = implode(' | ', $parts); if ($sjNomor) $entry .= ' | SJ: ' . $sjNomor; $lotLines[] = $entry; } } @endphp @endforeach
No Nama Barang Qty (Pcs) Harga Subtotal
{{ $rowNo++ }} {{ $item->nama_barang }} @if($item->barang?->manufaktur)
{{ $item->barang->manufaktur }}
@endif @if($jenisNie || $noNie)
{{ implode(' — ', array_filter([$jenisNie, $noNie])) }}
@endif @foreach($lotLines as $line)
{{ $line }}
@endforeach
{{ $totalQtyItem }} {{ $rupiah($item->harga_jual * $ppnMult) }} {{ $rupiah(($item->subtotal ?? $item->qty * $item->harga_jual) * $ppnMult) }}
@endforeach
Terbilang:
{{ ucfirst(terbilangKsoLot((int)round($faktur->total_harga))) }} rupiah
@if($faktur->jenis_ppn === 'sudah_ppn') @elseif($faktur->jenis_ppn === 'tanpa_ppn') @else @endif
Total{{ $rupiah($faktur->subtotal * $ppnMult) }}
Harga sudah termasuk PPN
Subtotal{{ $rupiah($faktur->subtotal) }}
Tanpa PPN
TOTAL{{ $rupiah($faktur->total_harga) }}
Subtotal{{ $rupiah($faktur->subtotal) }}
DPP (11/12){{ $rupiah($faktur->dpp) }}
PPN 12%{{ $rupiah($faktur->ppn) }}
TOTAL{{ $rupiah($faktur->total_harga) }}
@if($profile->catatan_penjualan)
Catatan: {{ $profile->catatan_penjualan }}
@endif
{{-- .page-content --}}
Hormat Kami,
{{ $namaPerush }}
 
Yang Menerima,
{{ $namaFaskes }}
 
{{-- .page-bottom --}}
{{-- .page --}}