@php $hs = \App\Helpers\HospitalSettings::all(); $patient = $invoice->patient; $visit = $invoice->visit; $isIns = strtolower($invoice->payment_mode ?? '') === 'insurance'; @endphp {{-- ── HEADER ── --}}
{{ $hs['hospital_name'] ?? 'Clara Rosa Hospital' }}
{{ $hs['hospital_address'] ?? '' }}
Tel: {{ $hs['hospital_phone'] ?? '' }}   Email: {{ $hs['hospital_email'] ?? '' }} @if($hs['kra_pin'] ?? null)
KRA PIN: {{ $hs['kra_pin'] }}@endif
Invoice No.: {{ $invoice->invoice_number }}
Date: {{ $invoice->created_at->format('d M Y') }}
{{ ucfirst($invoice->status) }}
Tax Invoice
{{-- ── PATIENT / INSURANCE INFO ── --}}
Billed To
{{ $patient->full_name ?? '' }}
MRN: {{ $patient->mrn ?? '' }}
@if($patient->phone)
{{ $patient->phone }}
@endif
@if($isIns && $invoice->insuranceCompany)
Insurance
{{ $invoice->insuranceCompany->name }}
@if($patient->insurance_member_no)
Member: {{ $patient->insurance_member_no }}
@endif @if($visit?->authorization_code)
Auth: {{ $visit->authorization_code }}
@endif
@else
Visit Details
@if($visit)
{{ $visit->visit_number }}
@endif
{{ $invoice->payment_mode }}
@if($visit?->department)
{{ $visit->department->name ?? '' }}
@endif
@endif
{{-- ── LINE ITEMS ── --}} @foreach($invoice->items as $i => $item) @endforeach
# Description Category Qty Unit Price Total (KES)
{{ $i + 1 }} {{ $item->description }} {{ $item->category }} {{ $item->quantity }} {{ number_format($item->unit_price, 2) }} {{ number_format($item->total, 2) }}
{{-- ── TOTALS ── --}} @if(($invoice->discount_amount ?? 0) > 0) @endif @if(($invoice->waiver_amount ?? 0) > 0) @endif
SubtotalKES {{ number_format($invoice->subtotal, 2) }}
Discount- KES {{ number_format($invoice->discount_amount, 2) }}
Waiver- KES {{ number_format($invoice->waiver_amount, 2) }}
TOTALKES {{ number_format($invoice->total_amount, 2) }}
Amount PaidKES {{ number_format($invoice->amount_paid, 2) }}
Balance DueKES {{ number_format($invoice->balance, 2) }}
{{-- ── PAYMENTS ── --}} @if($invoice->payments->count())
Payments Received
@foreach($invoice->payments as $pay) @endforeach
DateMethodReferenceAmount (KES)
{{ $pay->created_at->format('d M Y H:i') }} {{ str_replace('_',' ',$pay->payment_method) }} {{ $pay->mpesa_code ?? $pay->reference_number ?? '-' }} {{ number_format($pay->amount, 2) }}
@endif