{{-- ICTHospital - printable invoice for the patient. A page of its own rather than the invoice screen printed through the app layout: the layout's fixed sidebar, full-height wrapper and screen-only styling produced blank pages in some browsers. Same approach as the consultation and radiology print pages. Copyright (c) DEVtrust Part of ICTHospital Licensed under the GNU General Public License v3.0. --}} Invoice {{ $invoice->id }} {{ optional($patient)->patient_id }} @php($institute = \Illuminate\Support\Facades\Schema::hasTable('institute') && \Illuminate\Support\Facades\Schema::hasColumn('institute', 'name') ? \Illuminate\Support\Facades\DB::table('institute')->value('name') : null) @php($branch = \App\Support\Branch::name($invoice->branch_id ?? null))

{{ $institute ?: 'Invoice' }}

@if ($branch)
{{ $branch }}
@endif
Invoice#{{ $invoice->id }}Date{{ $invoice->date }}
Patient{{ $patient ? $patient->name . ' (MR ' . $patient->patient_id . ')' : ($invoice->patient_name ?: '-') }} Doctor{{ $doctor ? $doctor->name : ($invoice->doctor_name ?: '-') }}
Status{{ ucfirst($invoice->settlement()) }}
@foreach ($invoice->items as $item) @php($pkg = $item->payment_category_id ? \App\Models\ServicePackageItem::where('package_id', $item->payment_category_id)->get() : collect()) @if ($pkg->isNotEmpty()) @php($pkgNames = \App\Models\PaymentCategory::whereIn('id', $pkg->pluck('component_id'))->pluck('category', 'id')) @endif @endforeach
ChargeQuantityUnitTotal
{{ $item->name }}{{ $item->quantity }}{{ number_format((float) $item->unit_price, 2) }}{{ number_format((float) $item->line_total, 2) }}
Includes: {{ $pkg->map(fn ($c) => ($pkgNames[$c->component_id] ?? '') . ($c->quantity > 1 ? ' x' . $c->quantity : ''))->implode(', ') }}
Subtotal{{ number_format((float) $invoice->amount, 2) }}
Discount{{ number_format((float) $invoice->discount, 2) }}
Tax{{ number_format((float) $invoice->vat, 2) }}
Total{{ number_format((float) $invoice->gross_total, 2) }}
Paid{{ number_format($invoice->paid(), 2) }}
Balance{{ number_format($invoice->balance(), 2) }}
@if ($invoice->payments->isNotEmpty())

Payments received

@foreach ($invoice->payments as $payment) @endforeach
WhenMethodReferenceAmount
{{ $payment->paid_at }}{{ $payment->method ?: '-' }}{{ $payment->reference ?: '-' }}{{ number_format((float) $payment->amount, 2) }}
@endif

Received by ______________________