@extends('layouts.master') @section('css') @endsection @section('title') معاينة طباعة الفاتورة @stop @section('page-header') @endsection @section('content') @php $inv = $data['invoiceData']; $cust = $inv->customer; $val = function ($v) { return ($v === null || $v === '' || $v === 0 || $v === '0') ? '-' : $v; }; $isTaxInvoice = strlen((string) optional($cust)->tax_no) == 15; switch ($inv->Pay) { case 'Cash': $pay = __('report.cash'); break; case 'Shabka': $pay = __('report.shabka'); break; case 'Credit': $pay = __('report.credit'); break; case 'Bank_transfer': $pay = __('home.Bank_transfer'); break; default: $pay = __('home.Partition of the amount'); } // ===== الأصناف والإجماليات (نفس طريقة الحساب القديمة) ===== $avt = App\Models\Avt::find(1); $items = App\Models\sales::where('invoice_id', $inv->id)->where('quantity', '!=', 0)->get(); $invoicetotal_addedvalue = 0; $total_withoud_tax_row = 0; $discountreturn = 0; $rows = []; foreach ($items as $product) { $total_row_befor_tax = round(($product->Unit_Price * $product->quantity) - $product->Discount_Value, 2); $added_value_row = round($total_row_befor_tax * $product->tax_rate, 2); $invoicetotal_addedvalue += $added_value_row; $total_withoud_tax_row += $total_row_befor_tax; $rows[] = [$product, $total_row_befor_tax, $added_value_row]; } $invoicetotal_discount = $inv->discount + $discountreturn; // ===== QR (هيئة الزكاة - TLV) ===== $tlv = function ($tag, $value) { $value = (string) $value; return pack('H*', sprintf('%02X', $tag)) . pack('H*', sprintf('%02X', strlen($value))) . $value; }; $qrTime = substr($inv->created_at, 0, 10) . 'T' . substr($inv->created_at, 11); $qrTotal = number_format(round($invoicetotal_addedvalue + $total_withoud_tax_row, 2), 2, '.', ''); $qrTax = number_format(round($invoicetotal_addedvalue, 2), 2, '.', ''); $dataforQRcode = base64_encode($tlv(1, sallerQrCode) . $tlv(2, TaxQrCode) . $tlv(3, $qrTime) . $tlv(4, $qrTotal) . $tlv(5, $qrTax) . $tlv(6, '') . $tlv(7, '') . $tlv(8, '') . $tlv(9, '')); $money = function ($v) { return number_format(round((float) $v, 2), 2, '.', ','); }; $logo = camplogo; @endphp
{{-- الهيدر --}}
{{ Namear }} {{ describtionar }} {{ STar }} {{ Taxar }} {{ Nameen }} {{ describtionen }} {{ STen }} {{ Taxen }}
{{-- عنوان الفاتورة --}}

{{ $isTaxInvoice ? 'فاتورة ضريبية' : 'فاتورة ضريبية مبسطة' }}{{ $isTaxInvoice ? 'Tax Invoice' : 'Simplified Tax Invoice' }}

رقم الفاتورة · INVOICE NO#{{ $inv->id }}
{{-- بيانات الفاتورة + العميل --}}

بيانات الفاتورة INVOICE DETAILS

تاريخ الفاتورةINVOICE DATE{{ $inv->created_at }}
طريقة الدفعPAYMENT METHOD{{ $pay }}
الفرعBRANCH{{ optional($inv->branch)->name ?? '-' }}

بيانات العميل CUSTOMER DETAILS

اسم العميلCUSTOMER NAME{{ optional($cust)->name ?? '-' }}
رقم الجوالPHONE{{ $val(optional($cust)->phone) }}
{{-- الأصناف --}}
@if ($inv->display_number)@endif @forelse ($rows as $i => $r) @php [$product, $beforeTax, $vatRow] = $r; @endphp @if ($inv->display_number)@endif @empty @endforelse
#NOرقم المنتجITEM NOاسم الصنفITEM NAME السعرPRICE الكميةQTY الإجماليTOTAL الخصمDISCOUNT نسبة الضريبةVAT % الضريبةVAT الصافيNET
{{ $i + 1 }}{{ optional($product->productData)->Product_Code }}{{ $product->product_name ?? optional($product->productData)->product_name }} {{ $money($product->Unit_Price) }} {{ $product->quantity }} {{ $money($product->Unit_Price * $product->quantity) }} {{ $money($product->Discount_Value) }} {{ number_format($product->tax_rate * 100, 2) }}% {{ $money($vatRow) }} {{ $money($vatRow + $beforeTax) }}
لا توجد أصناف
{{-- QR + البنك | الإجماليات --}}
{!! QrCode::size(110)->generate($dataforQRcode) !!}
@if (Auth()->user()->branchs_id == 1)
{{ bankname }}
رقم الحساب · Acc: {{ bank_acount_number }}
IBAN: {{ bank_acount_iban }}
@endif
الإجماليSUB TOTAL{{ $money($total_withoud_tax_row) }}
الخصمDISCOUNT{{ $money($invoicetotal_discount) }}
الإجمالي بعد الخصمAFTER DISCOUNT{{ $money($total_withoud_tax_row) }}
ضريبة القيمة المضافةVAT{{ $money($invoicetotal_addedvalue) }}
الإجمالي الكليNET TOTAL{{ $money($total_withoud_tax_row + $invoicetotal_addedvalue) }} SAR
@if (!empty($data['totatextlriyales']) || !empty($data['totatextlrihalala']))
{{ $data['totatextlriyales'] }} {{ $data['totatextlrihalala'] }}
@endif
@if (!empty($inv->note))
{{ __('home.notesClient') }}: {!! $inv->note !!}
@endif
توقيع المستلم · Receiver
الختم والتوقيع · Stamp & Signature
{{ addressar }}|{{ addressen }}
@endsection @section('js') @endsection