@extends('layouts.app') @section('title', 'كشف حساب — '.($patient->full_name ?? 'مريض')) @push('head') @endpush @php $statusMeta = [ 'draft' => ['label' => 'مسودة', 'color' => 'secondary'], 'sent' => ['label' => 'مُرسلة', 'color' => 'info'], 'partial' => ['label' => 'مدفوعة جزئياً', 'color' => 'warning'], 'paid' => ['label' => 'مدفوعة', 'color' => 'success'], 'overdue' => ['label' => 'متأخرة', 'color' => 'danger'], 'cancelled' => ['label' => 'ملغاة', 'color' => 'secondary'], ]; $methodMeta = [ 'cash' => ['label' => 'نقدي', 'color' => 'success', 'icon' => 'cash'], 'card' => ['label' => 'بطاقة', 'color' => 'info', 'icon' => 'credit-card'], 'transfer' => ['label' => 'تحويل', 'color' => 'primary', 'icon' => 'building-bank'], 'insurance' => ['label' => 'تأمين', 'color' => 'purple', 'icon' => 'shield-check'], 'other' => ['label' => 'أخرى', 'color' => 'secondary', 'icon' => 'circle'], ]; $patientName = trim(($patient->first_name ?? '').' '.($patient->last_name ?? '')) ?: '—'; $initials = collect(preg_split('/\s+/u', $patientName)) ->filter()->take(2) ->map(fn ($w) => mb_substr($w, 0, 1)) ->implode('') ?: '؟'; $genderClass = ($patient->gender ?? null) === 'female' ? 'gender-female' : ''; // Determine the balance card visual state. $balanceState = match (true) { $totals['balance'] <= 0 => 'is-clear', $outstandingByAge['90+'] > 0 || $outstandingByAge['61-90'] > 0 => 'is-overdue', default => '', // mild warning yellow }; @endphp @section('content') {{-- Print-only letterhead — the regular hero has a gradient background that prints poorly. --}}
{{ $patient->file_number }}
@endif
@if($patient->phone)
{{ $patient->phone }}
@endif
@if($patient->age !== null)
{{ $patient->age }} سنة
@endif
@if($patient->gender)
{{ $patient->gender === 'female' ? 'أنثى' : 'ذكر' }}
@endif
غيّر النطاق الزمني أو ابحث في فترة أوسع.
| الفاتورة | التاريخ | عمر الفاتورة | الحالة | الإجمالي | المدفوع | المتبقي | ||
|---|---|---|---|---|---|---|---|---|
| @if($inv->payments->count()) @endif |
{{ $inv->invoice_number }}
|
{{ $inv->issue_date->format('Y-m-d') }} | {{ $inv->age_days }} يوم | {{ $sm['label'] }} | {{ number_format($inv->total, 2) }} | {{ number_format($inv->paid_amount, 2) }} | {{ number_format($inv->balance, 2) }} | |
|
دفعات الفاتورة ({{ $inv->payments->count() }})
@foreach($inv->payments as $pay)
@php $mm = $methodMeta[$pay->payment_method] ?? ['label' => $pay->payment_method, 'color' => 'secondary', 'icon' => 'circle']; @endphp
{{ $mm['label'] }}
{{ $pay->paid_at->format('Y-m-d H:i') }}
@if($pay->reference_number)
{{ number_format($pay->amount, 2) }} {{ $pay->reference_number }}
@endif
@if($pay->receiver)
{{ $pay->receiver->name }}
@endif
|
||||||||
| الإجمالي | {{ number_format($totals['invoiced'], 2) }} | {{ number_format($totals['paid'], 2) }} | {{ number_format($totals['balance'], 2) }} | |||||
| التاريخ | الفاتورة | الطريقة | المستلم | المرجع | المبلغ |
|---|---|---|---|---|---|
|
{{ $paidAt->format('Y-m-d') }}
{{ $paidAt->format('h:i A') }}
|
{{ $p->invoice_number }}
|
{{ $mm['label'] }} | {{ $p->receiver_name ?? '—' }} | {{ $p->reference_number ?: '—' }} |
{{ number_format($p->amount, 2) }}
|