@extends('layouts.app') @section('title', 'Check-out — ' . $reservation->booking_no) @section('nav_checkout', 'bg-teal-50 text-teal-700 font-semibold') @section('page_title', 'Check-out') @section('page_subtitle', 'Review folio and settle balance before departure') @section('content') @php $vatRate = (float) ($settings['vat_rate'] ?? 12); $vatDivisor = 1 + ($vatRate / 100); $totalExtras = $charges->sum('amount'); $totalCharges = (float) $reservation->amount + $totalExtras; $totalPaid = $payments->sum('amount'); $balance = max(0, $totalCharges - $totalPaid); $isSettled = $balance <= 0; // Senior/PWD statutory discount (RA 9994 / RA 10754): the discounted guest's share // is VAT-exempt and must be pulled out of the VATable base before the VAT split. $statDiscount = (float) $reservation->discount_amount; $roomGross = (float) $reservation->amount + $statDiscount; // pre-discount room total $discLabel = $reservation->discount_type === 'pwd' ? 'PWD' : 'Senior Citizen'; $vat = $reservation->vatBreakdown($totalCharges); $exemptSale = $vat['exempt']; $catLabels = [ 'food_beverage' => 'Food & Bev.', 'laundry' => 'Laundry', 'telephone' => 'Telephone', 'minibar' => 'Minibar', 'damage' => 'Damage', 'other' => 'Misc.', ]; @endphp {{-- Back nav + guest header --}}
Check-out Queue / {{ $reservation->booking_no }}
{{-- Flash messages --}} @if(session('error'))
{{ session('error') }}
@endif @if(session('success'))
{{ session('success') }}
@endif {{-- Guest header card --}}
{{ strtoupper(substr($reservation->guest_name, 0, 1)) }}{{ strtoupper(substr(explode(' ', $reservation->guest_name)[1] ?? 'X', 0, 1)) }}

{{ $reservation->guest_name }}

{{ $reservation->booking_no }} · {{ $reservation->room_type }}

Room

{{ $reservation->room_no }}

Check-in

{{ $reservation->check_in->format('M j, Y') }}

Check-out

{{ $reservation->check_out->format('M j, Y') }}

Nights

{{ $reservation->nights }}

{{-- ===== LEFT: Charges ===== --}}
{{-- Room charges --}}

Room Charges

@if($statDiscount > 0) @endif
Description Nights Rate Amount

{{ $reservation->room_type }}

Room {{ $reservation->room_no }}

{{ $reservation->nights }} ₱{{ number_format($reservation->rate, 2) }}/night ₱{{ number_format($roomGross, 2) }}

Less: {{ $discLabel }} Discount

20% statutory, VAT-exempt (RA {{ $reservation->discount_type === 'pwd' ? '10754' : '9994' }}) @if($reservation->discount_id_number) · {{ $reservation->discount_type === 'pwd' ? 'PWD ID' : 'OSCA ID' }}: {{ $reservation->discount_id_number }} @endif

−₱{{ number_format($statDiscount, 2) }}
{{-- Extra charges --}}

Extra Charges

@if($charges->isEmpty() && !isset($addOpen))

No extra charges.

@endif @if($charges->isNotEmpty()) @foreach($charges as $charge) @endforeach
Description Qty Amount

{{ $charge->description }}

{{ $catLabels[$charge->category] ?? $charge->category }} · {{ $charge->charge_date->format('M j') }}

×{{ $charge->quantity }} ₱{{ number_format($charge->amount, 2) }}
@csrf @method('DELETE')
Extras Subtotal ₱{{ number_format($totalExtras, 2) }}
@elseif($charges->isEmpty())

No extra charges.

@endif {{-- Add charge form --}}
@csrf
{{-- Totals summary --}}
Room charges ₱{{ number_format($reservation->amount, 2) }}
@if($totalExtras > 0)
Extra charges ₱{{ number_format($totalExtras, 2) }}
@endif
VAT ({{ $vatRate }}%) incl. ₱{{ number_format($vat['outputVat'], 2) }}
@if($exemptSale > 0)
VAT-Exempt Sales ₱{{ number_format($exemptSale, 2) }}
@endif
Total Charges ₱{{ number_format($totalCharges, 2) }}
{{-- ===== RIGHT: Payments + Action ===== --}}
{{-- Payments received --}}

Payments Received

@if($payments->isEmpty())

No payments recorded.

@else
@foreach($payments as $payment)

{{ $payment->method }}

{{ $payment->payment_date->format('M j, Y') }} @if($payment->reference) · {{ $payment->reference }}@endif

₱{{ number_format($payment->amount, 2) }}
@csrf @method('DELETE')
@endforeach
Total Paid ₱{{ number_format($totalPaid, 2) }}
@endif {{-- Add payment form --}}
@csrf
{{-- Balance + checkout action --}}
{{-- Balance display --}}
@if($isSettled)
All Settled

No outstanding balance

@else

Balance Due

₱{{ number_format($balance, 2) }}

Must be settled before check-out

@endif
{{-- Summary line --}}
Total charges ₱{{ number_format($totalCharges, 2) }}
Total paid ₱{{ number_format($totalPaid, 2) }}
Remaining ₱{{ number_format(max(0, $balance), 2) }}
@if($isSettled) {{-- Confirm check-out --}} @else {{-- Blocked --}}

Record payment above to unlock check-out

@endif {{-- View full folio link --}}
{{-- Check-out Time Modal --}}

Confirm Check-out

@csrf
@endsection