@extends('layouts.admin') @section('title', 'Billing — '.$patient->full_name) @section('content') @php $cur = config('clinic.currency.symbol'); $billed = $patient->totalBilled(); $paid = $patient->totalPaid(); $due = $billed - $paid; @endphp Patient Profile Back
{{-- PAYMENT --}}

Total Treatment Cost: {{ $cur }}{{ number_format($billed, 2) }}

Amount Paid: {{ $cur }}{{ number_format($paid, 2) }}

Remaining Balance: {{ $cur }}{{ number_format($due, 2) }}

Add Payment
@csrf
{{-- HISTORY --}}
@forelse($patient->payments->sortByDesc('payment_date') as $pay) {{ $pay->receipt_no }} {{ $pay->payment_date->format('d M Y') }} {{ $cur }}{{ number_format($pay->amount, 2) }} {{ strtoupper($pay->method) }} {{ $pay->reference ?? '—' }} {{ $pay->collectedBy?->name ?? '—' }} @empty No payments. @endforelse
{{-- LEDGER --}}

Total Billed: {{ $cur }}{{ number_format($billed, 2) }}

Total Paid: {{ $cur }}{{ number_format($paid, 2) }}

Outstanding: {{ $cur }}{{ number_format($due, 2) }}

Charges
@forelse($patient->billItems->sortByDesc('created_at') as $b) {{ $b->created_at->format('d M Y') }}{{ $b->description }}{{ ucfirst($b->type) }}{{ $cur }}{{ number_format($b->amount, 2) }}{{ $b->createdBy?->name ?? '—' }} @empty No charges. @endforelse
{{-- TREATMENT PROCEDURES --}}
Add Treatment / Procedure
@csrf
Treatments
@forelse($patient->treatments->sortByDesc('created_at') as $t) {{ $t->diagnosis?->name ?? '—' }}{{ $t->sittings }}{{ $cur }}{{ number_format($t->cost_per_sitting, 2) }}{{ $cur }}{{ number_format($t->total_cost, 2) }} @empty No treatments. @endforelse
{{-- DOCUMENTS --}}
Upload Document (images auto-converted to WebP)
@csrf
@if($patient->prescriptions->count())
Prescriptions
@foreach($patient->prescriptions as $rx) {{ $rx->code }}{{ $rx->prescribed_on?->format('d M Y') }} Open @endforeach @endif
Uploaded Documents
@forelse($patient->documents->sortByDesc('created_at') as $doc) {{ $doc->name }}{{ $doc->type ?? '—' }}{{ $doc->created_at->format('d M Y') }}{{ $doc->uploadedBy?->name ?? '—' }} @empty No documents. @endforelse
@endsection