@php // Guard against a fatal "cannot redeclare function" error if this // template is ever rendered more than once in the same request. if (!function_exists('ConvertToHEX')) { function ConvertToHEX($value) { return pack('H*', sprintf('%02X', $value)); } } $logo = camplogo; @endphp
{{ Nameen }}
{{ describtionen }} {{ STen }} {{ Taxen }}
{{ Namear }}
{{ describtionar }} {{ STar }} {{ Taxar }}
@if ($data['invoiceData']->customer->id == 1)

فاتورة ضريبية مبسطةSimplified Tax Invoice

@else

فاتورة ضريبيةTax Invoice

@endif
@php $pay = ''; if ($data['invoiceData']->Pay == 'Cash') { $pay = __('report.cash'); } elseif ($data['invoiceData']->Pay == 'Shabka') { $pay = __('report.shabka'); } elseif ($data['invoiceData']->Pay == 'Credit') { $pay = __('report.credit'); } elseif ($data['invoiceData']->Pay == 'Bank_transfer') { $pay = __('home.Bank_transfer'); } else { $pay = __('home.Partition of the amount'); } @endphp
{{ $data['invoiceData']->id }} رقم الفاتورةINVOICE NUMBER {{ $data['invoiceData']->branch->name }} اسم الفرعBRANCH NAME
{{ $pay }} طريقة الدفعPAYMENT METHOD {{ $data['invoiceData']->created_at }} تاريخ الفاتورةINVOICE DATE
{{ $data['invoiceData']->p_o ?: '-' }} امر الشراءPURCHASE ORDER

@if ($data['invoiceData']->customer->address == '-') @else @endif
{{ Namear }} اسم البائعSELLER NAME {{ $data['invoiceData']->customer->name }} اسم العميلCLIENT NAME
{{ Taxen }} الرقم الضريبيTAX NUMBER {{ $data['invoiceData']->customer->tax_no == 0 ? '-' : $data['invoiceData']->customer->tax_no }} الرقم الضريبيTAX NUMBER
{{ defined('city') ? city : '-' }} المدينةCITY {{ $data['invoiceData']->customer->id == 1 ? '-' : $data['invoiceData']->customer->phone }} رقم الجوالPHONE
{{ defined('city') ? city : '-' }} المدينةCITY {{ $data['invoiceData']->customer->id == 1 ? '-' : $data['invoiceData']->customer->address }} العنوانADDRESS
{{ defined('region') ? region : '-' }} المنطقةREGION {{ $data['invoiceData']->customer->id == 1 ? '-' : $data['invoiceData']->customer->sub_city }} المنطقةREGION
{{ defined('street_name') ? street_name : '-' }} اسم الشارعSTREET NAME {{ $data['invoiceData']->customer->id == 1 ? '-' : $data['invoiceData']->customer->street_name }} اسم الشارعSTREET NAME
{{ defined('postal_number') ? postal_number : '-' }} الرمز البريديPOSTAL NUMBER {{ $data['invoiceData']->customer->postcode }} الرمز البريديPOSTAL NUMBER
{{ defined('building_number') ? building_number : '-' }} رقم المبنىBUILDING NUMBER {{ $data['invoiceData']->customer->id == 1 ? '-' : $data['invoiceData']->customer->building_number }} رقم المبنىBUILDING NUMBER

@php $i = 0; $discountreturn = 0; @endphp @foreach (App\Models\sales::where('invoice_id', $data['invoiceData']->id)->get() as $product) @if ($product->quantity != 0) @php $i++; @endphp @endif @endforeach @foreach (App\Models\return_sales::where('invoice_id', $data['invoiceData']->id)->get() as $product) @php $i++; $discountreturn += $product->discountvalue + $product->discountoninvoice; @endphp @if ($product->return_quantity != 0) @endif @endforeach
Total AFTER DISCOUNTالاجمالي بعد الخصم DISCOUNTالخصم Totalالاجمالي PRODUCT PRICEسعر القطعة QUANTITYالكمية ITEM NAMEاسم الصنف Item NOرقم منتج NOرقم
{{ number_format(($product->Unit_Price * $product->quantity) - $product->Discount_Value, 2, '.', '') }} {{ number_format($product->Discount_Value, 2, '.', '') }} {{ number_format($product->Unit_Price * $product->quantity, 2, '.', '') }} {{ number_format($product->Unit_Price, 2, '.', '') }} {{ $product->quantity }} {{ $product->productData->product_name }} {{ $product->productData->Product_Code }} {{ $i }}
{{ number_format((float) (($product->return_Unit_Price * $product->return_quantity) - $product->discountvalue), 2, '.', '') }} {{ number_format((float) $product->discountvalue, 2, '.', '') }} {{ number_format((float) $product->return_Unit_Price * $product->return_quantity, 2, '.', '') }} {{ number_format($product->return_Unit_Price, 2, '.', '') }} {{ $product->return_quantity }} {{ $product->productData->product_name }} {{ $product->productData->Product_Code }} {{ $i }}

@php // ZATCA simplified tax invoice QR payload — logic preserved exactly as original. $invoice = App\Models\invoices::find($data['invoiceData']->id); $price = $invoice->cashamount + $invoice->Bank_transfer + $invoice->bankamount + $invoice->creaditamount; $avt = App\Models\Avt::find(1); $price_befor_tax = ($price * 100) / (100 + $avt->AVT * 100); $invoicetotal_addedvalue = $price_befor_tax * $avt->AVT; $invoicetotal_price = $price_befor_tax; $invoicetotal_discount = $invoice->discount + $discountreturn; $sellerName = sallerQrCode; $varNumber = TaxQrCode; $time = $invoice->created_at; $issue_time = substr($time, 11); $issue_date = substr($time, 0, 10); $time = (string) $issue_date . 'T' . (string) $issue_time; $total = number_format(round($invoicetotal_addedvalue + $invoicetotal_price, 2), 2, '.', ''); $tax = number_format(round($invoicetotal_addedvalue, 2), 2, '.', ''); $HexSeller = ConvertToHEX(1) . ConvertToHEX(strlen($sellerName)); $seller = $HexSeller . $sellerName; $HexVAT = ConvertToHEX(2) . ConvertToHEX(strlen($varNumber)); $vat = $HexVAT . $varNumber; $HexTime = ConvertToHEX(3) . ConvertToHEX(strlen($time)); $time = $HexTime . $time; $HexTotal = ConvertToHEX(4) . ConvertToHEX(strlen($total)); $total = $HexTotal . $total; $HexVATN = ConvertToHEX(5) . ConvertToHEX(strlen($tax)); $VATN = $HexVATN . $tax; $empty = ''; $Hexempty = ConvertToHEX(6) . ConvertToHEX(strlen($empty)); $empty6 = $Hexempty . $empty; $Hexempty = ConvertToHEX(7) . ConvertToHEX(strlen($empty)); $empty7 = $Hexempty . $empty; $Hexempty = ConvertToHEX(8) . ConvertToHEX(strlen($empty)); $empty8 = $Hexempty . $empty; $Hexempty = ConvertToHEX(9) . ConvertToHEX(strlen($empty)); $empty9 = $Hexempty . $empty; $tobase = $seller . $vat . $time . $total . $VATN . $empty6 . $empty7 . $empty8 . $empty9; $dataforQRcode = base64_encode($tobase); @endphp

يمكن ارجاع القطع المباعة او استبدالها خلال 3 ايام من تاريخ الشراء وتكون بحالتها المباعة
والقطع الكهربائية لا ترد ولا تستبدل والطلبات الخاصة لا يمكن ارجاعها او استبدالها بعد تاكيد الطلب

{{ number_format((float) (round($invoicetotal_price, 2) + round($invoicetotal_discount, 2)), 2, '.', '') }} الاجماليSUB TOTAL
{{ number_format(round($invoicetotal_discount, 2), 2, '.', '') }} الخصمDISCOUNT
{{ number_format(round($invoicetotal_price, 2), 2, '.', '') }} الاجمالي بعد الخصمSUB TOTAL AFTER DISCOUNT
{{ number_format(round($invoicetotal_addedvalue, 2), 2, '.', '') }} ضريبة القيمة المضافة ({{ $avt->AVT * 100 }}%)VALUE ADDED TAX ({{ $avt->AVT * 100 }}%)
{{ number_format(round($invoicetotal_addedvalue + $invoicetotal_price, 2), 2, '.', '') }} الاجمالي الكليNET TOTAL
@if (Auth()->user()->branchs_id == 1)

{{ bankname }}
Account Number : {{ bank_acount_number }}
IBAN Number : {{ bank_acount_iban }}

@endif

{{ __('home.notesClient') }} : {{ $data['invoiceData']->note }}