@include('layouts.print_header', ['printTitle' => $f['unpaid'] ? 'Patient statement — unpaid bills' : 'Patient statement',
'printSubtitle' => $f['start'] ? ($fmt($f['start']) . ' – ' . $fmt($f['end'])) : 'All visits'])
{{ $patient->name }}
ID: {{ $patient->patient_id }}
@if ($patient->gender) · {{ ucfirst($patient->gender) }} @endif
@if ($patient->dob) · {{ \Carbon\Carbon::parse($patient->dob)->age }} years @endif
@if ($patient->phone) · {{ $patient->phone }} @endif
· {{ $episodes->count() }} visit(s){{ $f['start'] ? ' · ' . $fmt($f['start']) . ' – ' . $fmt($f['end']) : '' }}
@if ($scope === 'pharmacy') · pharmacy bills only @endif
Total charges
{{ $money($grand['charge']) }}
Paid
{{ $money($grand['paid']) }}
Discount
{{ $money($grand['discount']) }}
Balance
{{ $money($grand['balance']) }}
{{-- ===== Totals by type first (Admission, Pharmacy, Lab …), details by visit below ===== --}}
@if (($byType ?? collect())->isNotEmpty())
| Category | Bills | Total amount | Paid | Discount | Balance |
@foreach ($byType as $t)
| {{ $t['label'] }} |
{{ $t['count'] }} |
{{ $money($t['charge']) }} |
{{ $money($t['paid']) }} |
{{ $money($t['discount']) }} |
{{ $money($t['balance']) }} |
@endforeach
| Grand total | {{ $byType->sum('count') }} | {{ $money($grand['charge']) }} |
{{ $money($grand['paid']) }} | {{ $money($grand['discount']) }} | {{ $money($grand['balance']) }} |
@if ($f['layout'] === 'visit')
Details by visit
@endif
@endif
@if ($f['layout'] === 'type')
@if (($typeGroups ?? collect())->isNotEmpty())
@include($view . '._by_type')
@else
No bills match these filters.
@endif
@else
@forelse ($episodes as $ep)
@php [$tLabel, $tIcon, $tColor] = $typeMeta[$ep['type']]; @endphp
{{ $ep['title'] }}
@if ($ep['status']){{ $ep['status'] }}@endif
{{ $fmt($ep['date']) }}{{ $ep['subtitle'] ? ' · ' . $ep['subtitle'] : '' }}
@if (!empty($ep['stay']))
{{ $ep['stay'] }}
@endif
Charge {{ $money($ep['totals']['charge']) }} · Paid {{ $money($ep['totals']['paid'] + $ep['totals']['discount']) }}
Balance {{ $money($ep['totals']['balance']) }}
| Bill | Date | Charge | Paid | Discount | Balance | Status |
@foreach ($ep['items'] as $it)
@php
$st = $it['balance'] <= 0.009 ? ['Paid', 'ok'] : ($it['paid'] + $it['discount'] > 0 ? ['Partially paid', 'part'] : ['Unpaid', 'bad']);
@endphp
| {{ $it['label'] }}@if ($it['note']) {{ $it['note'] }} @endif |
{{ $fmt($it['date']) }} |
{{ $money($it['charge']) }} |
{{ $money($it['paid']) }} |
{{ $money($it['discount']) }} |
{{ $money($it['balance']) }} |
{{ $st[0] }} |
{{-- What was charged: drug lines of a pharmacy bill, tests of a lab request. --}}
@if (!empty($it['details']))
@if ($it['type'] === 'admission')
| Room | Date in | Date out | Days | Rate / day | Amount |
@foreach ($it['details'] as $d)
| {{ $d['name'] }} | {{ $fmt($d['from']) }} | {{ $fmt($d['to']) }} |
{{ $d['days'] }} | {{ $money($d['price']) }} | {{ $money($d['amount']) }} |
@endforeach
@else
| {{ in_array($it['type'], ['pharmacy', 'prescription']) ? 'Drug' : 'Test' }} |
@if (in_array($it['type'], ['pharmacy', 'prescription']))Qty | Price | @endif
Amount |
@foreach ($it['details'] as $d)
| {{ $d['name'] }} |
@if (in_array($it['type'], ['pharmacy', 'prescription']))
{{ $d['qty'] }} | {{ $money($d['price']) }} |
@endif
{{ $money($d['amount']) }} |
@endforeach
@endif
|
@endif
@endforeach
@empty
No bills match these filters.
@endforelse
@endif