@php $patient = $item?->type == 'appointment' ? $item?->Appointment?->Patient : $item?->Patient; $rows = $stay['rows'] ?? []; $segments = $stay['segments'] ?? []; $ledgerTotal = $stay['total'] ?? 0; // still admitted: the nights so far may be more than billed yet (the bill is fixed at discharge) $total = $stillIn ? max((float) ($item->cost ?? 0), (float) $ledgerTotal) : (float) ($item->cost ?? 0); // Anything billed that the night-by-night ledger doesn't explain (older // admissions priced before per-night billing) is shown as its own line so // the statement always adds up to the billed total. $other = round($total - $ledgerTotal, 2); $discount = (float) $item->pmt->sum('discount'); $promotion = (float) $item->pmt->sum('promotion'); $paid = (float) $item->pmt->sum('payment'); $balance = max(0, round($total - $settled, 2)); $money = fn ($v) => number_format((float) $v, 2); @endphp Admission Statement {{ $item->admission_no }}
@include('layouts.print_header', ['printTitle' => 'Admission Statement'])
Admission no {{ $item->admission_no ?: '#' . $item->id }}
Status {{ $item->status }} / {{ $item->payment_status }}
Patient {{ $patient?->name }}
Patient ID {{ $patient?->patient_id }}
Doctor {{ $item?->Doctor?->name }}
Current room {{ $item?->Room?->name }}@if ($item?->bed) (Bed {{ $item->bed }})@endif
Date in {{ $item->date_in ? \Carbon\Carbon::parse($item->date_in)->format('d M, Y') : '-' }}
Date out {{ $stillIn ? 'Still admitted' : ($item->date_out ? \Carbon\Carbon::parse($item->date_out)->format('d M, Y') : '-') }}@if ($stillIn && $item->date_out) (planned {{ \Carbon\Carbon::parse($item->date_out)->format('d M, Y') }})@endif
Nights {{ $stay['days'] ?? 0 }}@if ($stillIn) up to {{ $stayEnd->format('d M, Y') }}@endif
Transfers {{ $transfers->where('refunded', false)->count() }}
Printed {{ now()->format('d M, Y h:i A') }}
@if ($stillIn)
The patient is still admitted — the stay is counted up to {{ $stayEnd->format('d M, Y') }}. The final room charge is set at discharge.
@endif
Room transfers
@if ($transfers->count()) @if ($showMoney)@endif @foreach ($transfers as $t) @if ($showMoney)@endif @endforeach
Date From room To room Bed StatusRoom charge
{{ $t['date'] }} {{ $t['from'] ?? '-' }} {{ $t['to'] ?? '-' }} {{ $t['bed'] ? 'Bed ' . $t['bed'] : '-' }} {{ $t['refunded'] ? 'Cancelled (refund)' : ($t['until'] ? 'Until ' . $t['until'] : 'Current room') }}{{ $money($t['cost']) }}
@else
No transfers — the patient stayed in {{ $item?->Room?->name ?? 'the same room' }}.
@endif
Room summary
@if (count($segments)) @foreach ($segments as $seg) @endforeach
Room Bed From To Nights Rate / night Amount
{{ $seg['room'] }} {{ $seg['bed'] ? 'Bed ' . $seg['bed'] : '-' }} {{ $seg['from']->format('d M, Y') }} {{ $seg['to']->format('d M, Y') }} {{ $seg['nights'] }} {{ $money($seg['rate']) }} {{ $money($seg['amount']) }}
@else
No nights to charge yet (checkout date is the same as, or before, the admission date).
@endif
Day by day charges
@if (count($rows)) @php $running = 0; @endphp @foreach ($rows as $row) @php $running += $row['rate']; @endphp @endforeach
Day Date Room Bed Charge Running total
{{ $row['night'] }} {{ $row['date']->format('D, d M Y') }} {{ $row['room'] }} {{ $row['bed'] ? 'Bed ' . $row['bed'] : '-' }} {{ $money($row['rate']) }} {{ $money($running) }}
Room charges ({{ $stay['days'] }} {{ \Illuminate\Support\Str::plural('night', $stay['days']) }}) {{ $money($ledgerTotal) }}
@else
No daily charges.
@endif @if ($payments->count())
Payments received
@foreach ($payments as $p) @endforeach
DateMethodReceived byDiscountAmount
{{ $p['date'] }}{{ $p['method'] }}{{ $p['by'] }}{{ $money($p['discount']) }}{{ $money($p['amount']) }}
@endif @if (abs($other) > 0.004) @endif
Room charges{{ $money($ledgerTotal) }}
Other / earlier charges{{ $money($other) }}
Total{{ $money($total) }}
Discount{{ $money($discount) }}
Promotion{{ $money($promotion) }}
Paid{{ $money($paid) }}
Balance due{{ $money($balance) }}
Cashier
Patient / Guardian