جارٍ إرسال الفاتورة، يرجى الانتظار
Invoice is being sent, please wait
{{ session()->get('foundinvoice') }}
{{ session()->get('success') }}
{{ session()->get('createnewproduct') }}
-
@foreach ($errors->all() as $error)
- {{ $error }} @endforeach
{{ session()->get('notfountreturnproduct') }}
@if (isset($data['product']))
{{ __('home.paymentmethod') }}
| {{__('home.the amount')}} | {{ __('home.discount') }} | {{ __('home.avt') }} | {{ __('home.total') }} |
| @php // تحديد معرّف الفاتورة المتاح في المصفوفة $currentInvoiceId = $data['id'] ?? $data['invoice_id'] ?? $data['invoices_id'] ?? null; if ($currentInvoiceId) { // جلب مجموع (سعر الوحدة * الكمية) من جدول المبيعات مباشرة $rawUnitTotal = \App\Models\sales::where('invoice_id', $currentInvoiceId) ->sum(\DB::raw('Unit_Price * quantity')); } else { $rawUnitTotal = 0; } @endphp {{ number_format($rawUnitTotal, 2) }} | {{ $data['invoicetotal_discount'] ?? 0 }} | {{ round( $data['invoicetotal_addedvalue'] ?? 0,2) }} | {{-- الإجمالي النهائي = (المبلغ الجديد - الخصم) + الضريبة --}} {{ round(($rawUnitTotal - ($data['invoicetotal_discount'] ?? 0)) + ($data['invoicetotal_addedvalue'] ?? 0), 2) }} |
@endif