@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; $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

Description Nights Rate Amount

{{ $reservation->room_type }}

Room {{ $reservation->room_no }}

{{ $reservation->nights }} ₱{{ number_format($reservation->rate, 0) }}/night ₱{{ number_format($reservation->amount, 0) }}
{{-- 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, 0) }}
@csrf @method('DELETE')
Extras Subtotal ₱{{ number_format($totalExtras, 0) }}
@elseif($charges->isEmpty())

No extra charges.

@endif {{-- Add charge form --}}
@csrf
{{-- Totals summary --}}
Room charges ₱{{ number_format($reservation->amount, 0) }}
@if($totalExtras > 0)
Extra charges ₱{{ number_format($totalExtras, 0) }}
@endif
@php $subtotalPreVat = $totalCharges / $vatDivisor; $vatAmount = $totalCharges - $subtotalPreVat; @endphp VAT ({{ $vatRate }}%) incl. ₱{{ number_format($vatAmount, 2) }}
Total Charges ₱{{ number_format($totalCharges, 0) }}
{{-- ===== 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, 0) }}
@csrf @method('DELETE')
@endforeach
Total Paid ₱{{ number_format($totalPaid, 0) }}
@endif {{-- Add payment form --}}
@csrf
{{-- Balance + checkout action --}}
{{-- Balance display --}}
@if($isSettled)
All Settled

No outstanding balance

@else

Balance Due

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

Must be settled before check-out

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

Record payment above to unlock check-out

@endif {{-- View full folio link --}}
@endsection