@if(!empty($invoice->ID))
رقم الفاتورة : {{$invoice->INVOICE_NO}}
تاريخ اصدار الفاتورة : {{empty($date_to) ? date('Y-m-d',strtotime("+3 hours")) : date("Y-m-d",strtotime($date_to))}}
تاريخ التوريد : {{date("Y-m-d",strtotime($date_from))}}
الى : {{date("Y-m-d",strtotime($date_to))}}

@if($invoice->STATUS == 0 || is_null($invoice->STATUS)) فاتورة مسودة @else فاتورة ضريبية @endif

@if($qr_image) @endif
@endif

معلومات المورد

الاسم: {{$profile->C_INV_NAME}}
رقم المبنى: {{$profile->C_BUILDING_NO}}
أسم الشارع: {{$profile->C_STREET}}
الحي: {{$profile->C_DISTRICT}}
المدينة: {{$profile->C_CITY}}
البلد: {{$profile->C_COUNTRY}}
الرمز البريدي: {{$profile->C_POST_CODE}}
الرقم الضريبي: {{$profile->VAT_NO}}

معلومات العميل

الاسم: {{$insurance->LEGAL_NAME}}
رقم المبنى: {{$insurance->BUILDING_NO}}
أسم الشارع: {{$insurance->STREET}}
الحي: {{$insurance->DISTRICT}}
المدينة: {{$insurance->CITY}}
البلد: {{$insurance->COUNTRY}}
الرمز البريدي: {{$insurance->POST_CODE}}
الرقم الضريبي: {{$insurance->VAT_NUMBER}}
@if(!empty($invoice->eNDUSER->CLIENT_LOGO))
@endif

تعتبر هذه الفاتورة نهائية و صحيحة ما لم يتم الرجوع إلينا خلال أسبوع من تاريخ الأستلام

رقم الفاتورة الفترة من إلى أيام السداد الكمية
@if(!empty($invoice->ID)) {{$invoice->INVOICE_NO}} @endif {{date("Y-m-d",strtotime($date_from))}} {{date("Y-m-d",strtotime($date_to))}} {{date_diff(date_create($date_from),date_create($date_to))->format("%a")}} {{count($orders)}}
الإجمالي {{round($net_total - $total_tax,2)}} @if(isset($global_symbol['is_html_ar']) && $global_symbol['is_html_ar'] && isset($global_symbol['currency_ar'])) {!! $global_symbol['currency_ar'] !!} @else {{ $global_symbol['currency_ar'] ?? 'ر.س' }} @endif
مجموع الخصومات {{round($invoice->DISCOUNT_TOTAL/100,2)}} @if(isset($global_symbol['is_html_ar']) && $global_symbol['is_html_ar'] && isset($global_symbol['currency_ar'])) {!! $global_symbol['currency_ar'] !!} @else {{ $global_symbol['currency_ar'] ?? 'ر.س' }} @endif
مجموع ضریبة القیمة المضافة {{$total_tax}} @if(isset($global_symbol['is_html_ar']) && $global_symbol['is_html_ar'] && isset($global_symbol['currency_ar'])) {!! $global_symbol['currency_ar'] !!} @else {{ $global_symbol['currency_ar'] ?? 'ر.س' }} @endif
إجمالي المبلغ المستحق {{$net_total}} @if(isset($global_symbol['is_html_ar']) && $global_symbol['is_html_ar'] && isset($global_symbol['currency_ar'])) {!! $global_symbol['currency_ar'] !!} @else {{ $global_symbol['currency_ar'] ?? 'ر.س' }} @endif
إجمالي المبلغ المدفوع {{$paid_total}} @if(isset($global_symbol['is_html_ar']) && $global_symbol['is_html_ar'] && isset($global_symbol['currency_ar'])) {!! $global_symbol['currency_ar'] !!} @else {{ $global_symbol['currency_ar'] ?? 'ر.س' }} @endif
إجمالي المبلغ المتبقي {{$net_total - $paid_total}} @if(isset($global_symbol['is_html_ar']) && $global_symbol['is_html_ar'] && isset($global_symbol['currency_ar'])) {!! $global_symbol['currency_ar'] !!} @else {{ $global_symbol['currency_ar'] ?? 'ر.س' }} @endif
{{--@php $ordersChunks = $orders->chunk(16); @endphp--}} @php $baseRowHeight = 46; $additionalHeightPer29Chars = 21; $charLimit = 29; $patientRowHeight = 49; $maxPageHeight = 1200; $dynamicChunks = []; $currentChunk = []; $currentChunkHeight = 0; $lastPatientName = null; foreach ($orders as $order) { $isNewPatient = ($lastPatientName != $order['NAME']); $orderName = $order['lABCATEGORYPACKAGE']['NAME_EN']; $orderNameLength = strlen($orderName); $additionalHeight = 0; if ($orderNameLength > $charLimit) { $additionalSets = ceil(($orderNameLength - $charLimit) / $charLimit); $additionalHeight = $additionalSets * $additionalHeightPer29Chars; } $rowHeight = $baseRowHeight + $additionalHeight; if ($isNewPatient) { $lastPatientName = $order['NAME']; $rowHeight += $patientRowHeight; } if ($currentChunkHeight + $rowHeight > $maxPageHeight) { $dynamicChunks[] = $currentChunk; $currentChunk = []; $currentChunkHeight = $isNewPatient ? $patientRowHeight : 0; } $currentChunk[] = $order; $currentChunkHeight += $rowHeight; } if (!empty($currentChunk)) { $dynamicChunks[] = $currentChunk; } @endphp @php $summary = []; @endphp @foreach($dynamicChunks as $key => $chunk)

التفاصيل

@php $c = 1; @endphp @foreach($chunk as $order) @if(empty($order['PRICE'])) @continue @endif @if(isset($summary[$order['lABCATEGORYPACKAGE']['ID']])) @php $summary[$order['lABCATEGORYPACKAGE']['ID']]['qty'] +=1; $summary[$order['lABCATEGORYPACKAGE']['ID']]['tax'] +=round($order['INSURANCE_CREDIT_AMOUNT'] - ($order['INSURANCE_CREDIT_AMOUNT'] / (1+$order['TAX'])),2); $summary[$order['lABCATEGORYPACKAGE']['ID']]['total'] +=$order['INSURANCE_CREDIT_AMOUNT']; $summary[$order['lABCATEGORYPACKAGE']['ID']]['paid'] +=($order['AMOUNT'] / 100 - $order['PRICE']); @endphp @else @php $summary[$order['lABCATEGORYPACKAGE']['ID']]['name'] =$order['lABCATEGORYPACKAGE']['NAME_EN']; $summary[$order['lABCATEGORYPACKAGE']['ID']]['qty'] =1; $summary[$order['lABCATEGORYPACKAGE']['ID']]['unit_price'] =round(($order['INSURANCE_CREDIT_AMOUNT'] / (1+$order['TAX'])),2); $summary[$order['lABCATEGORYPACKAGE']['ID']]['tax'] =round($order['INSURANCE_CREDIT_AMOUNT'] - ($order['INSURANCE_CREDIT_AMOUNT'] / (1+$order['TAX'])),2); $summary[$order['lABCATEGORYPACKAGE']['ID']]['total'] =$order['INSURANCE_CREDIT_AMOUNT']; $summary[$order['lABCATEGORYPACKAGE']['ID']]['paid'] =($order['AMOUNT'] / 100 - $order['PRICE']); @endphp @endif @php $c++; @endphp @endforeach @if($key == count($dynamicChunks) - 1) @endif
رقم بوليصة التأمين رقم الحجز اسم المريض رقم الهوية MRN تاريخ الحجز رقم الاختبار اسم الاختبار نسبة تحمل العميل الضريبة على العميل نسبة تحمل التأمين إجمالي الضريبة على التأمين الإجمالي المدفوع
{{$order['eNDUSERLABORDER']['POLICY_NUMBER']}} {{$order['eNDUSERLABORDER']['ID']}} {{$order['NAME']}} {{$order['IDENTIFICATION']}} {{$order['MRN']}} {{$order['eNDUSERLABORDER']['CREATE_DATE']}} {{$order['lABCATEGORYPACKAGE']['ID']}}{{$order['lABCATEGORYPACKAGE']['NAME_EN']}} {{round(($order['PRICE'] / ($order['TAX']+1)),2)}} {{round($order['PRICE'] - ($order['PRICE'] / ($order['TAX']+1)),2)}} {{round(($order['INSURANCE_CREDIT_AMOUNT'] / ($order['TAX']+1)),2)}} {{round($order['INSURANCE_CREDIT_AMOUNT'] - ($order['INSURANCE_CREDIT_AMOUNT'] / ($order['TAX']+1)),2)}} {{$order['INSURANCE_CREDIT_AMOUNT']}} {{($order['AMOUNT'] / 100 - $order['PRICE'])}}
المجموع {{round($net_total_patient - $total_tax_patient, 2)}} {{$total_tax_patient}} {{round($net_total - $total_tax, 2)}} {{$total_tax}} {{$net_total}} {{$paid_total}}
@endforeach
@if(!empty($summary)) @php $summary_total = 0; @endphp

الملخص

@foreach($summary as $testSummery) @php $summary_total += ($testSummery['total']); @endphp @endforeach
اسم الاختبار الكمية نسبة تحمل التأمين إجمالي الضريبة على التأمين الإجمالي المدفوع
{{$testSummery['name']}} {{$testSummery['qty']}} {{$testSummery['unit_price']}}{{$testSummery['tax']}} {{$testSummery['total']}} {{$testSummery['paid']}}
المجموع {{array_sum(array_column($summary, 'qty'))}} {{array_sum(array_column($summary, 'unit_price'))}} {{array_sum(array_column($summary, 'tax'))}} {{$summary_total}} {{array_sum(array_column($summary, 'paid'))}}
@endif