@extends('layouts.app') @section('content')
{{-- رأس الصفحة --}}

بيان المورد

تفاصيل الفواتير والدفعات للمورد

PDF Excel
{{-- رسائل التنبيه --}} @if(session('success'))

{{ session('success') }}

@endif @if(session('error'))

{{ session('error') }}

@endif
{{-- معلومات المورد --}} @if($data['supplier'])

اسم المورد

{{ $data['supplier']->name ?? 'N/A' }}

المدينة

{{ $data['supplier']->city ?? 'N/A' }}

البريد الإلكتروني

{{ $data['supplier']->email ?? 'N/A' }}

الهاتف

{{ $data['supplier']->phone ?? 'N/A' }}

@endif {{-- ملخص المالي --}}
{{-- إجمالي الفواتير --}}

إجمالي المشتريات

{{ number_format($data['total_invoiced'], 2) }}

{{-- إجمالي المدفوع --}}

المبلغ المدفوع

{{ number_format($data['total_paid'], 2) }}

{{-- المتبقي --}}

المتبقي

{{ number_format($data['total_due'], 2) }}

{{-- جدول الفواتير --}}

الفواتير

@forelse($data['invoices'] ?? [] as $invoice) @empty @endforelse
# رقم الفاتورة التاريخ المبلغ الإجمالي المبلغ المدفوع المتبقي الحالة
{{ $loop->iteration }}
{{ $invoice->invoice_number ?? 'N/A' }}
{{ $invoice->invoice_date ? $invoice->invoice_date->format('Y-m-d') : 'N/A' }} {{ number_format($invoice->total_amount, 2) }} {{ number_format($invoice->paid_amount ?? 0, 2) }} @php $remaining = ($invoice->total_amount ?? 0) - ($invoice->paid_amount ?? 0); @endphp {{ number_format($remaining, 2) }} @php $status = $invoice->status ?? 'unknown'; $statusText = [ 'draft' => 'مسودة', 'sent' => 'مرسلة', 'approved' => 'معتمدة', 'paid' => 'مدفوعة', 'partial' => 'مدفوعة جزئياً', 'cancelled' => 'ملغاة' ][$status] ?? $status; $badgeColor = [ 'draft' => 'gray', 'sent' => 'blue', 'approved' => 'yellow', 'paid' => 'green', 'partial' => 'amber', 'cancelled' => 'red' ][$status] ?? 'gray'; @endphp {{ $statusText }}

لا توجد فواتير

{{-- جدول الدفعات (إن وجدت) --}} @php $hasPayments = false; if (isset($data['invoices'])) { foreach ($data['invoices'] as $inv) { if ($inv->payments && $inv->payments->count() > 0) { $hasPayments = true; break; } } } @endphp @if($hasPayments)

الدفعات

@php $paymentIndex = 0; @endphp @forelse($data['invoices'] ?? [] as $invoice) @forelse($invoice->payments ?? [] as $payment) @php $paymentIndex++; @endphp @empty @endforelse @empty @endforelse
# رقم الفاتورة تاريخ الدفع المبلغ الطريقة
{{ $paymentIndex }} {{ $invoice->invoice_number ?? 'N/A' }} {{ $payment->payment_date ? $payment->payment_date->format('Y-m-d') : 'N/A' }} {{ number_format($payment->amount ?? 0, 2) }} {{ $payment->payment_method ?? 'N/A' }}

لا توجد دفعات

@endif {{-- ملخص نهائي --}}

ملخص الحساب

إجمالي المشتريات {{ number_format($data['total_invoiced'], 2) }}
عدد الفواتير {{ count($data['invoices'] ?? []) }}
المبلغ المدفوع {{ number_format($data['total_paid'], 2) }}
نسبة السداد {{ $data['total_invoiced'] > 0 ? number_format(($data['total_paid'] / $data['total_invoiced']) * 100, 1) : 0 }}%
المتبقي {{ number_format($data['total_due'], 2) }}
نسبة المتبقي {{ $data['total_invoiced'] > 0 ? number_format(($data['total_due'] / $data['total_invoiced']) * 100, 1) : 0 }}%
{{-- تاريخ التقرير --}}

تم إنشاء التقرير في {{ now()->format('Y-m-d H:i') }}

@push('styles') @endpush @endsection