@if (isset($data) && !empty($data) && count($data) > 0)
{{-- --}} {{-- --}} {{-- --}} @php $avtSetting = App\Models\Avt::find(1); $saleavt = $avtSetting ? $avtSetting->AVT : 0.15; @endphp @foreach ($data as $product) @php // حساب الإجمالي مع الضريبة $netPrice = $product->Price - $product->discount; $taxAmount = $netPrice * $saleavt; $totalWithTax = $product->cashamount + $product->bankamount + $product->creaditamount + $product->Bank_transfer; // تحديد نص طريقة الدفع $payText = match($product->Pay) { 'Cash' => __('report.cash'), 'Shabka' => __('report.shabka'), 'Credit' => __('report.credit'), 'Bank_transfer' => __('home.Bank_transfer'), default => __('home.Partition of the amount'), }; // تجهيز رابط الواتساب $cleanPhone = "966" . ltrim($product->customer->phone ?? '', '0'); $pdfLink = "https://demoo.ebdeaclients.online/ar/generate_pdf/" . $product->id; $waMessage = "يسرنا خدمتك. فاتورتك رقم {$product->id} جاهزة للتحميل:\n" . $pdfLink; $waFullUrl = "https://wa.me/{$cleanPhone}?text=" . urlencode($waMessage); @endphp {{-- --}} {{-- --}} @endforeach
{{ __('home.Invoice_no') }} {{ __('home.sallerName') }} {{ __('home.clietName') }}{{ __('home.phone') }}عدد الفروعنوع البرنامج{{ __('home.address') }}تاريخ البدء تاريخ الانتهاء حالة الدفع {{ __('home.total') }} {{ __('home.paymentmethod') }} {{ __('home.operations') }}
#{{ $product->id }} {{ $product->user->name ?? '---' }} {{ $product->customer->name ?? '---' }}{{ $product->customer->phone ?? '---' }} {{ $product->sales->first()->branches_count ?? '1' }} @if(($product->sales->first()->software_type ?? 'cloud') == 'cloud') سحابي @else محلي @endif {{ $product->sales->first()->subscription_start_date ?? '---' }} @php $saleDetail = $product->sales->first(); @endphp @if($saleDetail) {{-- الشرط الدقيق: إذا كان نوع البرنامج محلي صراحةً --}} @if(($saleDetail->software_type ?? 'cloud') == 'local') مدى الحياة @else {{-- إذا كان البرنامج سحابي cloud نتحقق أولاً من وجود تاريخ انتهاء --}} @if($saleDetail->subscription_end_date) @if(\Carbon\Carbon::parse($saleDetail->subscription_end_date)->isPast()) {{ $saleDetail->subscription_end_date }} (منتهي) @else {{ $saleDetail->subscription_end_date }} (نشط) @endif @else {{-- سحابي ولكن لم يسجل له تاريخ انتهاء بعد --}} --- @endif @endif @else --- @endif
{{ $product->payment_status == 1 ? 'تم الدفع' : 'لم يتم الدفع' }} {{-- طباعة التاريخ فقط لو الحالة مسددة، وإعطاء id للجافاسكريبت لتحديثه لايف --}} {{ $product->payment_date ? \Carbon\Carbon::parse($product->payment_date)->format('Y-m-d') : '' }}
{{-- 🌟 فحص ما إذا كان سعر المنتج صفرًا لاعتبار الفاتورة مرتجعة --}} @if($product->Price == 0) {{ __('home.return') }} @else {{ number_format($totalWithTax, 2) }} ريال @endif {{ $payText }} @if($product->Pay == "Partition")
الشبكة: {{ $product->bankamount }} التحويل: {{ $product->Bank_transfer }}
@endif
{{-- 🌟 7. زر تعديل تواريخ الاشتراك الجديد --}} @php $saleDetail = $product->sales->first(); // جلب التاريخ، وإذا كان null أو فارغ نمرر نصاً فارغاً صريحاً لـ JavaScript $endDateValue = ($saleDetail && $saleDetail->subscription_end_date) ? $saleDetail->subscription_end_date : ''; @endphp
@else @endif