@php $logoSrc = null; $logoVal = $settings->hotel_logo ?? ''; if (!empty($logoVal)) { if (preg_match('/^https?:\\/\\//i', $logoVal)) { $logoSrc = $logoVal; } else { $diskPath = \Illuminate\Support\Facades\Storage::disk('public')->path($logoVal); if (is_file($diskPath)) { $mime = @mime_content_type($diskPath) ?: 'image/png'; $data = @file_get_contents($diskPath); if ($data !== false) { $logoSrc = 'data:' . $mime . ';base64,' . base64_encode($data); } } if (!$logoSrc) { $logoSrc = asset(\Illuminate\Support\Facades\Storage::url($logoVal)); } } } @endphp @if($logoSrc) @endif
@if($settings)
{{ $settings->hotel_address }}
{{ $settings->hotel_phone }} | {{ $settings->hotel_email }}
@endif

INVOICE

# {{ $invoice->invoice_number }}
{{ $invoice->created_at->format('d F Y') }}
@if(($invoice->non_refundable ?? false) || (!empty($invoice->notes) && preg_match('/non[- ]?refund/i', $invoice->notes)))
NON-REFUNDABLE
@endif
Bill To:
{{ $invoice->guest_name }}
@php $companyName = null; $notesSrc = trim((string)($invoice->notes ?? '')); if ($notesSrc !== '' && stripos($notesSrc, 'Perusahaan:') !== false) { $seg = explode('Perusahaan:', $notesSrc)[1] ?? ''; $companyName = trim(explode('|', $seg)[0] ?? ''); } if (!$companyName && $invoice->booking && !empty($invoice->booking->special_requests)) { $sr = (string)$invoice->booking->special_requests; if ($sr !== '' && stripos($sr, 'Perusahaan:') !== false) { $seg = explode('Perusahaan:', $sr)[1] ?? ''; $companyName = trim(explode('|', $seg)[0] ?? ''); } } if (!$companyName && $invoice->booking && $invoice->booking->guest && !empty($invoice->booking->guest->notes)) { $gn = (string)$invoice->booking->guest->notes; if ($gn !== '' && stripos($gn, 'Perusahaan:') !== false) { $seg = explode('Perusahaan:', $gn)[1] ?? ''; $companyName = trim(explode('|', $seg)[0] ?? ''); } } @endphp @if(!empty($companyName))
{{ $companyName }}
@endif
{{ $invoice->guest_email }}
@if($invoice->guest_phone)
{{ $invoice->guest_phone }}
@endif
Booking Details:
@if($invoice->booking_id)
Booking ID: {{ optional($invoice->booking)->booking_code ?? 'N/A' }}
@endif @php $bookingGuestName = optional(optional($invoice->booking)->guest)->name ?? optional($invoice->booking)->guest_name; @endphp @if($bookingGuestName && ($bookingGuestName !== $invoice->guest_name))
Guest: {{ $bookingGuestName }}
@endif
Check-in: {{ $invoice->check_in_date->format('d/m/Y') }}
Check-out: {{ $invoice->check_out_date->format('d/m/Y') }}
Duration: {{ $invoice->nights }} {{ $invoice->nights > 1 ? 'nights' : 'night' }}
@if($invoice->paymentChannel)
Payment Method: {{ $invoice->paymentChannel->name }}
@endif @if($invoice->paid_at)
Paid At: {{ $invoice->paid_at->format('d/m/Y H:i') }}
@endif
{{ ucfirst($invoice->status ?? 'Draft') }}
@php $hasMerged = isset($mergedSources) && ($mergedSources->count() > 0); @endphp @if($hasMerged) @php $minDate = collect([$invoice->check_in_date])->merge($mergedSources->pluck('check_in_date'))->filter()->min(); $maxDate = collect([$invoice->check_out_date])->merge($mergedSources->pluck('check_out_date'))->filter()->max(); $nightsMerged = \Carbon\Carbon::parse($minDate)->diffInDays(\Carbon\Carbon::parse($maxDate)) ?: 1; $combinedSubtotal = (int) ($invoice->subtotal ?? 0) + (int) $mergedSources->sum('subtotal'); $ratePerNightMerged = $nightsMerged > 0 ? (int) floor($combinedSubtotal / $nightsMerged) : (int) $combinedSubtotal; $roomTypeDisp = ($invoice->booking->room->roomType->name ?? $invoice->room_type ?? 'Room'); $roomNumberDisp = ($invoice->room_number ?? ($invoice->booking->room->room_number ?? '-')); @endphp @else @php $overrideSegments = []; if (!empty($invoice->notes) && preg_match('/Overrides:\s*([^|]+)/i', $invoice->notes, $ovm)) { $ovraw = trim($ovm[1] ?? ''); if ($ovraw !== '') { foreach (explode(';', $ovraw) as $seg) { $seg = trim($seg); if ($seg === '') continue; $parts = array_map('trim', explode(':', $seg)); if (count($parts) >= 4) { $overrideSegments[] = [ 'name' => $parts[0], 'rate' => is_numeric($parts[1]) ? intval($parts[1]) : 0, 'nights' => is_numeric($parts[2]) ? intval($parts[2]) : 0, 'subtotal' => is_numeric($parts[3]) ? intval($parts[3]) : 0, 'start' => $parts[4] ?? null, 'end' => $parts[5] ?? null, ]; } } } } @endphp @if(count($overrideSegments) > 0) @foreach($overrideSegments as $item) @php $roomDisplay = '-'; $name = $item['name'] ?? ''; if (strpos($name, ' - ') !== false) { $partsNm = explode(' - ', $name); $roomDisplay = $partsNm[1] ?? '-'; $name = $partsNm[0] ?? $name; } @endphp @endforeach @else @php $ratePerNight = (int) ($invoice->room_rate ?? (((($invoice->nights ?? 1) > 0) ? (int) (($invoice->subtotal ?? 0) / ($invoice->nights ?? 1)) : (int) ($invoice->subtotal ?? 0)))); @endphp @endif @if($invoice->booking && $invoice->booking->roomServices && $invoice->booking->roomServices->count() > 0) @foreach($invoice->booking->roomServices as $service) @endforeach @endif @endif
Description {{ ($invoice->booking->booking_type ?? 'room') === 'ballroom' ? 'Ballroom' : 'Room' }} {{ ($invoice->booking->booking_type ?? 'room') === 'ballroom' ? 'Days' : 'Nights' }} Rate Amount
{{ $roomTypeDisp }} Room
{{ \Carbon\Carbon::parse($minDate)->format('d M Y') }} - {{ \Carbon\Carbon::parse($maxDate)->format('d M Y') }}
{{ $roomNumberDisp }} {{ $nightsMerged }} Rp {{ number_format($ratePerNightMerged, 0, ',', '.') }} Rp {{ number_format($combinedSubtotal, 0, ',', '.') }}
{{ $name }} Room @if(!empty($item['start']) && !empty($item['end']))
{{ \Carbon\Carbon::parse($item['start'])->format('d M Y') }} - {{ \Carbon\Carbon::parse($item['end'])->format('d M Y') }}
@endif
{{ $roomDisplay }} {{ $item['nights'] }} Rp {{ number_format($item['rate'], 0, ',', '.') }} Rp {{ number_format($item['subtotal'], 0, ',', '.') }}
{{ ($invoice->booking->room->roomType->name ?? $invoice->room_type) }} Room
{{ $invoice->check_in_date->format('d M Y') }} - {{ $invoice->check_out_date->format('d M Y') }}
{{ $invoice->room_number }} {{ $invoice->nights }}Rp {{ number_format($ratePerNight, 0, ',', '.') }} Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}
Room Service - {{ $service->service_name }} - {{ $service->quantity }} Rp {{ number_format($service->unit_price, 0, ',', '.') }} Rp {{ number_format($service->total_price, 0, ',', '.') }}
@php $cardCharge = 0; if (!empty($invoice->notes) && preg_match('/Card\s*Charge:\s*Rp\s*([0-9\.,]+)/i', $invoice->notes, $m)) { $raw = $m[1] ?? '0'; $cardCharge = (int) preg_replace('/[^0-9]/', '', $raw); } $taxRate = (int) \App\Models\Settings::get('tax_rate', 10); $servicesViewTotal = (int) ($invoice->services_total ?? 0); if ($servicesViewTotal <= 0 && $invoice->booking && $invoice->booking->roomServices) { $servicesViewTotal = (int) $invoice->booking->roomServices->sum('total_price'); } $totalInclude = max(0, (int) ($invoice->subtotal ?? 0) + $servicesViewTotal - (int) ($invoice->discount_amount ?? 0) ); $rawDPP = $totalInclude / (1 + ($taxRate / 100)); $baseDPP = floor($rawDPP); $dpp = (($rawDPP - $baseDPP) < 0.5) ? $baseDPP : ($baseDPP + 1); $computedTax = max(0, $totalInclude - $dpp); $finalTotal = $totalInclude + $cardCharge; @endphp
Total Included Tax: Rp {{ number_format($totalInclude, 0, ',', '.') }}
@if($cardCharge > 0)
Card Charge: Rp {{ number_format($cardCharge, 0, ',', '.') }}
@endif
Total: Rp {{ number_format($finalTotal, 0, ',', '.') }}
Tax Included: Rp {{ number_format($computedTax, 0, ',', '.') }}
@if($invoice->paymentChannel || $invoice->paid_at)
Payment Information:
Receptionist
@if($invoice->paymentChannel)
Payment Method: {{ $invoice->paymentChannel->name }}
@if($invoice->paymentChannel->description)
{{ $invoice->paymentChannel->description }}
@endif @if(is_array($invoice->paymentChannel->settings) && count($invoice->paymentChannel->settings) > 0)
@foreach($invoice->paymentChannel->settings as $key => $val) {{ ucwords(str_replace('_', ' ', $key)) }}: {{ e($val) }}@if(!$loop->last)  |  @endif @endforeach
@endif @endif @php $user = auth()->user(); $receptionistName = $user ? ($user->name ?? ($user->email ?? 'Receptionist')) : 'Receptionist'; @endphp @if($invoice->paid_at)
Payment Date: {{ $invoice->paid_at->format('d F Y, H:i') }} WIB
{{ $receptionistName }}
✓ PAID
@else
⚠ UNPAID
{{ $receptionistName }}
@endif
@endif