@php function penyebut($nilai) { $nilai = abs($nilai); $huruf = [ '', 'satu', 'dua', 'tiga', 'empat', 'lima', 'enam', 'tujuh', 'delapan', 'sembilan', 'sepuluh', 'sebelas', ]; $temp = ''; if ($nilai < 12) { $temp = ' ' . $huruf[$nilai]; } elseif ($nilai < 20) { $temp = penyebut($nilai - 10) . ' belas'; } elseif ($nilai < 100) { $temp = penyebut(intval($nilai / 10)) . ' puluh' . penyebut($nilai % 10); } elseif ($nilai < 200) { $temp = ' seratus' . penyebut($nilai - 100); } elseif ($nilai < 1000) { $temp = penyebut(intval($nilai / 100)) . ' ratus' . penyebut($nilai % 100); } elseif ($nilai < 2000) { $temp = ' seribu' . penyebut($nilai - 1000); } elseif ($nilai < 1000000) { $ribuan = intval($nilai / 1000); $sisa = $nilai % 1000; // aturan khusus: contoh 701 ribu → tujuh ratus seribu if ($ribuan % 100 == 1 && $ribuan > 100) { $temp = penyebut(intval($ribuan / 100)) . ' ratus seribu' . penyebut($sisa); } else { $temp = penyebut($ribuan) . ' ribu' . penyebut($sisa); } } elseif ($nilai < 1000000000) { $temp = penyebut(intval($nilai / 1000000)) . ' juta' . penyebut($nilai % 1000000); } elseif ($nilai < 1000000000000) { $temp = penyebut(intval($nilai / 1000000000)) . ' milyar' . penyebut(fmod($nilai, 1000000000)); } elseif ($nilai < 1000000000000000) { $temp = penyebut(intval($nilai / 1000000000000)) . ' trilyun' . penyebut(fmod($nilai, 1000000000000)); } return $temp; } function terbilang($nilai) { if ($nilai < 0) { $hasil = 'minus ' . trim(penyebut($nilai)); } else { $hasil = trim(penyebut($nilai)); } return ucwords($hasil); } @endphp Hotel Bill & Tanda Terima {{-- ================= Halaman 1 ================= --}}

{{ $data['hotel']['name'] }}

{{ $data['hotel']['address'] ?? '' }}

BILL / TAGIHAN HOTEL
No. Reservasi: {{ $data['code'] }} Tanggal: {{ $data['date'] }}
Nama Tamu: {{ $data['guest_name'] }} Lama Menginap: {{ $data['stay_duration'] }} Malam
Check-in: {{ $data['planning_checkin'] }} Check-out: {{ $data['planning_checkout'] }}
@foreach ($data['reservation_details'] as $index => $detail) @endforeach
No Tipe Kamar Harga PPN Diskon Total
{{ $index + 1 }} {{ $detail['room']['name'] ?? '-' }}
{{ $detail['sarapan'] == '1' ? 'Termasuk Sarapan' : 'Tidak Termasuk Sarapan' }}
Rp {{ number_format($detail['price'], 0, ',', '.') }} Rp {{ number_format($detail['tax'], 0, ',', '.') }} Rp {{ number_format($detail['discount'], 0, ',', '.') }} Rp {{ number_format($detail['total_price'], 0, ',', '.') }}
Subtotal Rp {{ number_format($data['total_price'], 0, ',', '.') }}
Diskon Rp {{ number_format($data['discount'], 0, ',', '.') }}
Biaya Layanan Rp {{ number_format($data['service_fee'], 0, ',', '.') }}
Biaya Tambahan Rp {{ number_format($data['additional_fee'], 0, ',', '.') }}
Grand Total Rp {{ number_format($data['grand_total'], 0, ',', '.') }}
Hormat Kami,
Kepala Hotel / Manager
_________________________
{{-- ================= Halaman 2 ================= --}}

TANDA TERIMA RETRIBUSI

{{ strtoupper($data->hotel->name) }}
{{ strtoupper($data->hotel->address) }}
{{ strtoupper($data->hotel->kota->name ?? '') }}
No : {{ $data['code_retribusi'] ?? str_pad($data['id'], 6, '0', STR_PAD_LEFT) }}

Nama : {{ $data['guest_name'] }}
Kamar No : {{ $data['reservation_details'][0]['room']['name'] ?? '-' }}
Masuk Tgl : {{ \Carbon\Carbon::parse($data['planning_checkin'])->format('d/m/Y') }}
Keluar Tgl : {{ \Carbon\Carbon::parse($data['planning_checkout'])->format('d/m/Y') }}

{{-- --}} @foreach ($data['reservation_details'] as $detail) {{-- --}} @endforeach
URAIAN JUMLAH KAMAR JUMLAH HARI/MALAM SATUAN (Rp) JUMLAH (Rp)TARIF PERATURAN (Rp) JUMLAH
{{ $detail['room']['name'] ?? '-' }} 1 {{ $detail['stay_duration'] }} {{ number_format($detail['price'], 0, ',', '.') }} {{ number_format($detail['total_price'], 0, ',', '.') }}{{ number_format($detail['price'], 0, ',', '.') }} {{ number_format($detail['total_price'], 0, ',', '.') }}
Jumlah {{ number_format($data['grand_total'], 0, ',', '.') }}
Terbilang : {{ ucwords(terbilang($data['grand_total'])) }} Rupiah


{{ $data['hotel']['kota']['name'] ?? '-' }}, {{ now()->format('d F Y') }}
Yang Menerima



(..................................)