@extends('layouts.app') @section('title', 'عرض الفاتورة') @push('styles') @endpush @section('content')

تفاصيل الفاتورة #{{ $invoice->invoice_number ?? '--' }}

معلومات المريض

الاسم: {{ $invoice->patient->name ?? '--' }}

رقم الهاتف: {{ $invoice->patient->mobile ?? $invoice->patient->phone ?? '--' }}

@if($invoice->patient->birth_date ?? false)

العمر: {{ \Carbon\Carbon::parse($invoice->patient->birth_date)->age }} سنة

@endif @if($invoice->patient->gender ?? false)

الجنس: {{ $invoice->patient->gender === 'male' ? 'ذكر' : 'أنثى' }}

@endif
معلومات الفاتورة

رقم الفاتورة: {{ $invoice->invoice_number ?? '--' }}

تاريخ الفاتورة: {{ $invoice->formatted_invoice_date }}

حالة الدفع: مدفوع بالكامل

@if($invoice->appointment)

رقم الموعد: {{ $invoice->appointment->booking_reference ?? '--' }}

@endif
بنود الفاتورة
@forelse($invoice->items as $index => $item) @empty @endforelse @if(($invoice->discount_amount ?? 0) > 0) @endif @if(($invoice->tax_amount ?? 0) > 0) @endif
# الوصف الكمية سعر الوحدة الخصم الإجمالي
{{ $index + 1 }} {{ $item->description ?? '--' }} {{ number_format($item->quantity ?? 0, 2) }} {{ number_format($item->unit_price ?? 0, 2) }} ج.م @php $dtype = $item->line_discount_type ?? 'none'; $dval = (float)($item->line_discount_value ?? 0); @endphp @if($dtype === 'percent') {{ rtrim(rtrim(number_format($dval, 2), '0'), '.') }}% @elseif($dtype === 'amount') {{ number_format($dval, 2) }} ج.م @else 0 @endif {{ number_format($item->line_total ?? 0, 2) }} ج.م
لا توجد بنود في هذه الفاتورة
المجموع الفرعي: {{ number_format($invoice->subtotal ?? 0, 2) }} ج.م
الخصم: -{{ number_format($invoice->discount_amount ?? 0, 2) }} ج.م
الضريبة ({{ $invoice->vat_rate ?? 0 }}%): {{ number_format($invoice->tax_amount ?? 0, 2) }} ج.م
الإجمالي النهائي: {{ number_format($invoice->total_amount ?? 0, 2) }} ج.م
المدفوع: {{ number_format($paid ?? 0, 2) }} ج.م
المتبقي: {{ number_format($remaining ?? 0, 2) }} ج.م
@if($invoice->notes)
ملاحظات
{!! nl2br(e($invoice->notes)) !!}
@endif @if(($invoice->payments ?? [])->count() > 0)
سجل المدفوعات
@foreach($invoice->payments as $index => $payment) @endforeach
# التاريخ المبلغ طريقة الدفع بواسطة حالة التسليم ملاحظات
{{ $index + 1 }} {{ $payment->payment_date ? $payment->payment_date->format('Y-m-d') : '--' }} {{ $payment->payment_time ? $payment->payment_time->format('h:i A') : '' }} {{ number_format($payment->amount, 2) }} ج.م @php $paymentMethods = [ 'cash' => 'نقدي', 'bank_transfer' => 'تحويل بنكي', 'card' => 'بطاقة ائتمان' ]; @endphp {{ $paymentMethods[$payment->payment_method] ?? $payment->payment_method }} {{ $payment->recordedBy->name ?? '--' }} @if($payment->handover_status === 'confirmed') تم التسليم @else قيد الانتظار @endif {{ $payment->notes ?? '--' }}
@endif
@if($invoice->status !== 'paid' && $remaining > 0)
@endif
@if($invoice->status !== 'paid') @endif @endsection @push('styles') @endpush