@php
// === موضع الأقسام الرئيسية (يجب أن تكون محفوظة في DB) ===
$header_section_pos = $receipt_details->elements_positions['header-section'] ?? [0, 0, 550, 180];
$contact_section_pos = $receipt_details->elements_positions['contact-invoice-section'] ?? [0, 190, 550, 90];
$product_section_pos = $receipt_details->elements_positions['product-table-section'] ?? [0, 290, 550, 250];
$totals_section_pos = $receipt_details->elements_positions['totals-section'] ?? [0, 550, 550, 100];
$footer_section_pos = $receipt_details->elements_positions['footer-section'] ?? [0, 0, 550, 80];
// === عناصر داخلية ===
$logo_pos = $receipt_details->elements_positions['preview-logo'] ?? [200, 40, 150, 50];
$display_name_pos = $receipt_details->elements_positions['preview-business-name'] ?? [200, 100, 200, 30];
$address_pos = $receipt_details->elements_positions['address_bar'];
$contact_pos = $receipt_details->elements_positions['contact_bar'] ?? [200, 180, 200, 30];
// عناصر قسم العميل
$customer_name_lable_pos = $receipt_details->elements_positions['preview_customer_label'] ?? [0, 0, 'auto', 'auto'];
$customer_name_pos = $receipt_details->elements_positions['preview-customer-name'] ?? [0, 0, 'auto', 'auto'];
$invoice_no_lable_pos = $receipt_details->elements_positions['preview_invoice_no_prefix'] ?? [0, 0, 'auto', 'auto'];
$invoice_no_pos = $receipt_details->elements_positions['preview-invoice-number'] ?? [0, 0, 'auto', 'auto'];
$preview_client_id_label_pos = $receipt_details->elements_positions['preview_client_id_label'] ?? [0, 0, 'auto', 'auto'];
$preview_client_id_pos = $receipt_details->elements_positions['preview-client-id'] ?? [0, 0, 'auto', 'auto'];
$preview_date_label_pos = $receipt_details->elements_positions['preview_date_label'] ?? [0, 0, 'auto', 'auto'];
$preview_date_pos = $receipt_details->elements_positions['preview-invoice-date'] ?? [0, 0, 'auto', 'auto'];
$bar_code_pos = $receipt_details->elements_positions['preview-barcode'] ?? [0, 0, 'auto', 'auto'];
$qr_code_pos = $receipt_details->elements_positions['preview-qr-code'] ?? [0, 0, 'auto', 'auto'];
$discount_lable_pos = $receipt_details->elements_positions['preview_discount_label'] ?? [0, 0, 'auto', 'auto'];
$root_rights_saved_pos = $receipt_details->elements_positions['root_rights_saved'] ?? [0, 0, 'auto', 'auto'];
@endphp
@if(empty($receipt_details->letter_head) && !empty($receipt_details->logo) && $logo_pos)
@endif
@if(!empty($receipt_details->display_name) && $display_name_pos)
{{ $receipt_details->display_name }}
@endif
@if(!empty($receipt_details->address) && $address_pos)
{!! $receipt_details->address !!}
@endif
@if(!empty($receipt_details->contact) && $contact_pos)
{!! $receipt_details->contact !!}
@endif
@if(!empty($receipt_details->website))
{{ $receipt_details->website }}
@endif
@if(!empty($receipt_details->location_custom_fields))
{{ $receipt_details->location_custom_fields }}
@endif
@if(!empty($receipt_details->sub_heading_line1))
{{ $receipt_details->sub_heading_line1 }}
@endif
@if(!empty($receipt_details->sub_heading_line2))
{{ $receipt_details->sub_heading_line2 }}
@endif
@if(!empty($receipt_details->sub_heading_line3))
{{ $receipt_details->sub_heading_line3 }}
@endif
@if(!empty($receipt_details->sub_heading_line4))
{{ $receipt_details->sub_heading_line4 }}
@endif
@if(!empty($receipt_details->sub_heading_line5))
{{ $receipt_details->sub_heading_line5 }}
@endif
@if(!empty($receipt_details->tax_info1))
{{ $receipt_details->tax_label1 }} {{ $receipt_details->tax_info1 }}
@endif
@if(!empty($receipt_details->tax_info2))
{{ $receipt_details->tax_label2 }} {{ $receipt_details->tax_info2 }}
@endif
@if(!empty($receipt_details->invoice_heading))
{!! $receipt_details->invoice_heading !!}
@endif
@if(!empty($receipt_details->letter_head))
@endif
@if(!empty($receipt_details->customer_label) && $customer_name_lable_pos)
{!! $receipt_details->customer_label !!}
@endif
@if(!empty($receipt_details->customer_name) && $customer_name_pos)
{!! $receipt_details->customer_name !!}
@endif
@if(!empty($receipt_details->client_id_label) && $preview_client_id_label_pos)
{!! $receipt_details->client_id_label !!}
@endif
@if(!empty($receipt_details->client_id) && $preview_client_id_pos)
{!! $receipt_details->client_id !!}
@endif
@if(!empty($receipt_details->customer_tax_label))
{{ $receipt_details->customer_tax_label }} {{ $receipt_details->customer_tax_number }}
@endif
@if(!empty($receipt_details->customer_custom_fields))
{!! $receipt_details->customer_custom_fields !!}
@endif
@if(!empty($receipt_details->sales_person_label))
{{ $receipt_details->sales_person_label }} {{ $receipt_details->sales_person }}
@endif
@if(!empty($receipt_details->commission_agent_label))
{{ $receipt_details->commission_agent_label }} {{ $receipt_details->commission_agent }}
@endif
@if(!empty($receipt_details->customer_rp_label))
{{ $receipt_details->customer_rp_label }} {{ $receipt_details->customer_total_rp }}
@endif
@if(!empty($receipt_details->invoice_no_prefix) && $invoice_no_lable_pos)
{{ $receipt_details->invoice_no_prefix }}
@endif
@if(!empty($receipt_details->types_of_service))
{!! $receipt_details->types_of_service_label !!}:
{{$receipt_details->types_of_service}}
@if(!empty($receipt_details->types_of_service_custom_fields))
@foreach($receipt_details->types_of_service_custom_fields as $key => $value)
{{$key}}: {{$value}}
@endforeach
@endif
@endif
@if(!empty($receipt_details->table_label) || !empty($receipt_details->table))
@if(!empty($receipt_details->table_label))
{!! $receipt_details->table_label !!}
@endif
{{$receipt_details->table}}
@endif
@if(!empty($receipt_details->invoice_no) && $invoice_no_pos)
{{ $receipt_details->invoice_no }}
@endif
@if(!empty($receipt_details->date_label) && $preview_date_label_pos)
{{ $receipt_details->date_label }}
@endif
@if(!empty($receipt_details->invoice_date) && $preview_date_pos)
{{ $receipt_details->invoice_date }}
@endif
@includeIf('sale_pos.receipts.partial.common_repair_invoice')
@php
// حساب ارتفاع جدول المنتجات
$product_lines_count = count($receipt_details->lines);
$header_height = 30; // ارتفاع رأس الجدول
$row_height = 25; // ارتفاع كل صف
$padding = 10; // هامش إضافي
$product_table_height = $header_height + ($product_lines_count * $row_height) + $padding;
// إذا كان لديك ترتيب متداخل للأقسام في قاعدة البيانات، قم بتحديثه
$product_section_pos = $receipt_details->elements_positions['product-table-section'] ?? [0, 290, 550, 250];
$product_section_pos[3] = $product_table_height; // تحديث الارتفاع
@endphp
@php
// موقع قسم الإجماليات (يجب أن يبدأ أسفل قسم المنتجات مباشرة)
$product_section_top = $product_section_pos[1];
$totals_section_pos = $receipt_details->elements_positions['totals-section'] ?? [0, 550, 550, 100];
// تحديث موقع قسم الإجماليات ليكون أسفل جدول المنتجات
$totals_section_pos[1] = $product_section_top + $product_table_height + 10; // 10 بكس للفاصل
@endphp
@php
$highlight_color = $receipt_details->highlight_color ?? '#f2f2f2'; // اللون الافترادي إذا لم يكن محدد
@endphp
@php
$columnsOrder = json_decode($receipt_details->table_columns_order ?? '[]', true);
$visibleColumns = $columnsOrder['visible_columns'] ?? [];
// إذا لم يكن هناك ترتيب محفوظ، استخدم الترتيب الافتراضي
if(empty($visibleColumns)) {
$visibleColumns = [
['id' => 'col-preview-product', 'text' => $receipt_details->table_product_label],
['id' => 'col-preview-qty', 'text' => $receipt_details->table_qty_label],
['id' => 'col-preview-unit-price', 'text' => $receipt_details->table_unit_price_label],
['id' => 'col-preview-subtotal', 'text' => $receipt_details->table_subtotal_label],
];
}
@endphp
@foreach($visibleColumns as $column)
|
{{ $column['text'] }}
|
@endforeach
@foreach($receipt_details->lines as $line)
@foreach($visibleColumns as $column)
@php
$columnId = $column['id'];
$cellValue = '';
// تحديد قيمة الخلية بناءً على العمود
switch($columnId) {
case 'col-preview-product':
case 'preview_table_product_label':
$cellValue = $line['name'];
break;
case 'col-preview-qty':
case 'preview_table_qty_label':
$cellValue = $line['quantity'];
break;
case 'col-preview-unit-price':
case 'preview_table_unit_price_label':
$cellValue = $line['unit_price_before_discount'];
break;
case 'col-preview-subtotal':
case 'preview_table_subtotal_label':
$cellValue = $line['line_total'];
break;
case 'col-preview-image':
case 'preview-image':
$cellValue = !empty($line['image']) ? '
' : '';
break;
case 'col-preview-brand':
case 'preview-brand':
$cellValue = $line['brand'] ?? '';
break;
case 'col-preview-expiry':
case 'preview-expiry':
$cellValue = $line['expiry_date'] ?? '';
break;
case 'col-preview-sku':
case 'preview-sku':
$cellValue = $line['sku'] ?? '';
break;
case 'col-preview-cat-code':
case 'preview-cat-code':
$cellValue = $line['cat_code'] ?? $line['hsn_code'] ?? '';
break;
case 'col-preview-sale-description':
case 'preview-sale-description':
$cellValue = $line['sell_line_note'] ?? $line['product_description'] ?? '';
break;
default:
$cellValue = $line['name']; // قيمة افتراضية
}
@endphp
{!! $cellValue !!} |
@endforeach
@endforeach
@if (optional($receipt_details)->installment_module)
@php $i=0 @endphp
{{-- @dd($receipt_details->installments, $receipt_details->payments) --}}
@foreach($receipt_details->installments as $installment)
@if (!fmod($i, 2))
@endif
@php
$num = $i + 1;
$payment_status = Modules\Installments\Entities\InstallmentLine::getPaymentStatus($installment);
@endphp
@lang('installments::installment.installment') {{ $num }}
@if (in_array($payment_status, ['paid', 'partial']))
@lang('lang_v1.' . $payment_status)
@endif
@lang('installments::installment.total') :
@format_currency($installment->amount)
{{ @format_date($installment->due_date) }}
@if (!in_array($payment_status, ['paid', 'partial']))
@lang('lang_v1.' . $payment_status)
@else
@php
$total_paid = 0;
foreach ($installment->payments as $payment) {
$total_paid += $payment->amount;
}
@endphp
@lang('installments::installment.paid_amount') : @format_currency($total_paid)
@endif
|
@if (fmod($i, 2))
@endif
@php $i++ @endphp
@endforeach
@endif
@if(!empty($receipt_details->total_quantity_label))
|
{!! $receipt_details->total_quantity_label !!}
|
{{$receipt_details->total_quantity}}
|
@endif
@if(!empty($receipt_details->total_items_label))
|
{!! $receipt_details->total_items_label !!}
|
{{$receipt_details->total_items}}
|
@endif
|
{!! $receipt_details->subtotal_label !!}
|
{{$receipt_details->subtotal}}
|
@if(!empty($receipt_details->total_exempt_uf))
|
@lang('lang_v1.exempt')
|
{{$receipt_details->total_exempt}}
|
@endif
@if(!empty($receipt_details->shipping_charges))
|
{!! $receipt_details->shipping_charges_label !!}
|
{{$receipt_details->shipping_charges}}
|
@endif
@if(!empty($receipt_details->packing_charge))
|
{!! $receipt_details->packing_charge_label !!}
|
{{$receipt_details->packing_charge}}
|
@endif
@if( !empty($receipt_details->discount) )
|
{!! $receipt_details->discount_label !!}
|
(-) {{$receipt_details->discount}}
|
@endif
@if( !empty($receipt_details->total_line_discount) )
|
{!! $receipt_details->line_discount_label !!}
|
(-) {{$receipt_details->total_line_discount}}
|
@endif
@if( !empty($receipt_details->additional_expenses) )
@foreach($receipt_details->additional_expenses as $key => $val)
|
{{$key}}:
|
(+) {{$val}}
|
@endforeach
@endif
@if( !empty($receipt_details->reward_point_label) )
|
{!! $receipt_details->reward_point_label !!}
|
(-) {{$receipt_details->reward_point_amount}}
|
@endif
@if( !empty($receipt_details->tax) )
|
{!! $receipt_details->tax_label !!}
|
(+) {{$receipt_details->tax}}
|
@endif
@if( $receipt_details->round_off_amount > 0)
|
{!! $receipt_details->round_off_label !!}
|
{{$receipt_details->round_off}}
|
@endif
|
{!! $receipt_details->total_label !!}
|
{{$receipt_details->total}}
@if(!empty($receipt_details->total_in_words))
({{$receipt_details->total_in_words}})
@endif
|
@if(empty($receipt_details->hide_price) && !empty($receipt_details->tax_summary_label) )
@if(!empty($receipt_details->taxes))
| {{$receipt_details->tax_summary_label}} |
@foreach($receipt_details->taxes as $key => $val)
| {{$key}} |
{{$val}} |
@endforeach
@endif
@endif
@if(!empty($receipt_details->additional_notes))
{!! nl2br($receipt_details->additional_notes) !!}
@endif
@if($receipt_details->show_barcode && $bar_code_pos)
@endif
@if($receipt_details->show_qr_code && !empty($receipt_details->qr_code_text) && $qr_code_pos)
@endif
@if($root_rights_saved_pos)
جميع الحقوق محفوظة root 2025
@endif
@if(!empty($receipt_details->footer_text))
{!! $receipt_details->footer_text !!}
@endif