@php
$branch = \App\Models\Branch::find($booking->branch_id);
$branchReceipt = (array) ($branch?->receipt_settings ?? []);
$receiptName = $branchReceipt['business_name'] ?? $branch?->name ?? config('pos.company.name');
$receiptAddress = $branchReceipt['address'] ?? $branch?->address ?? config('pos.company.address');
$receiptPhone = $branchReceipt['phone'] ?? $branch?->phone ?? config('pos.company.phone', '');
$receiptTill = $branchReceipt['till_number'] ?? \App\Models\Setting::get('general','till_number',config('pos.company.till_number'));
$receiptPaybill = $branchReceipt['paybill_number'] ?? \App\Models\Setting::get('general','paybill_number',config('pos.company.paybill_number'));
$receiptPin = $branchReceipt['kra_pin'] ?? \App\Models\Setting::get('general','company_pin',config('pos.company.kra_pin'));
$receiptEmail = $branchReceipt['email'] ?? \App\Models\Setting::get('general','business_email','');
$receiptAltPhone = $branchReceipt['alternative_phone'] ?? \App\Models\Setting::get('general','alternative_phone','');
$receiptWebsite = $branchReceipt['website'] ?? \App\Models\Setting::get('general','business_website','');
$receiptLogo = $branchReceipt['logo_path'] ?? \App\Models\Setting::get('general','logo_path',config('pos.company.logo_path'));
$receiptLogoUrl = $receiptLogo ? \Illuminate\Support\Facades\Storage::disk('public')->url($receiptLogo) : null;
@endphp
@if($receiptLogoUrl)

@endif
ROOM PAYMENT RECEIPT
{{ $receiptName }}
@if($receiptAddress)
{{ $receiptAddress }}
@endif
@if($receiptPhone)
{{ $receiptPhone }}
@endif
@if($receiptAltPhone)
Alt: {{ $receiptAltPhone }}
@endif
@if($receiptWebsite)
{{ $receiptWebsite }}
@endif
@if($receiptEmail)
{{ $receiptEmail }}
@endif
@if($receiptPin)
KRA PIN: {{ $receiptPin }}
@endif
@if($receiptTill || $receiptPaybill)
@if($receiptTill) Till: {{ $receiptTill }} @endif @if($receiptTill && $receiptPaybill) ยท @endif @if($receiptPaybill) Paybill: {{ $receiptPaybill }} @endif
@endif
Receipt No.RCP-{{ str_pad($payment->id,6,'0',STR_PAD_LEFT) }}
Date{{ \Carbon\Carbon::parse($payment->paid_at)->format('d M Y H:i') }}
Booking{{ $booking->booking_reference }}
Guest{{ $booking->guest_name }}
Phone{{ $booking->guest_phone ?: 'โ' }}
Room{{ $booking->room->room_number ?? 'โ' }}
Check-in{{ $booking->check_in->format('d M Y H:i') }}
Check-out{{ $booking->check_out->format('d M Y H:i') }}
Payment method{{ strtoupper($payment->method) }}
Reference{{ $payment->reference_number ?: 'โ' }}
Amount received{{ number_format($payment->amount,2) }}
Total booking{{ number_format($booking->total_amount,2) }}
Total paid{{ number_format($booking->amount_paid,2) }}
Balance{{ number_format(max(0,$booking->total_amount-$booking->amount_paid),2) }}
Thank you.