{{-- "What does this patient owe, and to whom?" Rendered into the `patient.administrative` slot, behind `invoices.view`. Patients knows nothing about invoices; remove this module and the panel goes with it. Its data comes from PatientFinancialsComposer. Split by department because that is how the clinic collects: reception takes the consultation fee, the laboratory takes its own, and "you owe 40" with no breakdown is a figure nobody at either counter can act on. --}} @if (Route::has('invoices.index')) {{ __('billing::messages.ledger.all_invoices') }} @endif @forelse ($ledgers as $ledger) {{-- One block per currency. A clinic billing in one — nearly all of them — never sees that this is a loop. --}} @if (! $loop->first)
@endif {{-- The currency is named once, in the headings, and the cells carry bare numbers. Repeating it on every figure put "PKR" six times in a panel three columns wide, and in a narrow column the code wrapped onto its own line above the amount — which is how a column of money stops lining up and stops being readable at a glance. --}}
@foreach ($ledger->lines as $line) {{-- Owed back is not the same as settled, and reads as its own figure rather than a bare minus. --}} @endforeach
{{ __('billing::messages.ledger.department') }} {{ __('billing::messages.ledger.billed') }} ({{ $ledger->currency }}) {{ __('billing::messages.ledger.paid') }} {{ __('billing::messages.ledger.outstanding') }}
{{ $line->serviceLine->label() }} {{-- Charges raised but not yet invoiced. The desk's own unfinished business, not the patient's — worth separating from a bill that has actually been handed over. --}} @if ($line->pending->isPositive()) {{ __('billing::messages.ledger.pending', ['amount' => $line->pending->format()]) }} @endif {{ $line->billed->toMajor() }} {{ $line->paid->toMajor() }} {{ $line->owesPatient() ? '−'.$line->refundDue()->toMajor() : $line->outstanding->toMajor() }}
{{ __('billing::messages.ledger.total') }} {{ $ledger->billed->toMajor() }} {{ $ledger->paid->toMajor() }} {{ $ledger->outstanding->toMajor() }}
{{-- The one state that needs acting on rather than noting. Money taken beyond what was charged is a refund waiting to be made, and it used to be reported as "settled". --}} @if ($ledger->owesPatient())
{{ __('billing::messages.ledger.owed_back', ['amount' => $ledger->refundDue()->format()]) }}
@elseif ($ledger->isSettled())

{{ __('billing::messages.ledger.settled') }}

@endif @empty

{{ __('billing::messages.ledger.none') }}

@endforelse