@if ($overviewBond['bond'])
@if (!$overviewBond['print'] && $overviewBond['bond']->post_status == false) @can('warehouses-salesInvoices-edit') @lang('general.edit') @endcan @endif

SALES INVOICE

Invoice #: {{ $overviewBond['bond']->bond_number }}
Invoice Date : {{ $overviewBond['bond']->date }}
Customer: {{ $overviewBond['bond']->client?->name ?? 'نقدي' }}
Account # : {{ $overviewBond['bond']->client?->id_by_receivable_type }}
F.O.Payment: {{ $overviewBond['bond']->client_type == 'cash' ? 'نقدي' : 'ذمة' }}
@foreach ($overviewBond['currencies'] as $currency) @if ($overviewBond['bond']->currency_id == $currency->id)
Currency: {{ $currency->name }}
@endif @endforeach
Sales Ex: @lang('warehouses/sales-invoices/show.sales_department')
Notes :{{ $overviewBond['bond']->notice }}
Order #: {{ $overviewBond['bond']->sales_order_id }}
Offer #: {{ $overviewBond['bond']->sales_price_offer_id }}

Items

@can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @php $total_amount_before_normal_discounts = 0; $total_extra_discounts = 0; $tax_amounts_total = 0; $client_discount = 0; @endphp @foreach ($overviewBond['bond']->items as $item) @php $total_amount_before_normal_discounts += $item->price_after_discount * $item->quantity; $total_extra_discounts += $item->extra_discount_amount ? $item->extra_discount_amount * $item->quantity : 0; $client_discount += ($overviewBond['bond']->client_discount_ratio / 100) * $item->total_final_price; $client_discount_amount = ($overviewBond['bond']->client_discount_ratio / 100) * $item->total_final_price; $taxable_amount = $item->total_final_price - $client_discount_amount; $tax_amount = $item->tax_ratio ? $taxable_amount * ($item->tax_ratio / 100) : 0; $tax_amounts_total += $tax_amount; @endphp @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @if ($item->bonus) @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @endif @endforeach
Barcode # Name Unit QtySale priceDis. amountGross PriceTaxAmountExpiry date Serial code Notes
{{ $item->barcode->number }} {{ $item->print_name ?: $item->barcode->ar_name }} {{ $item->barcode->unit->name }} {{ dn($item->quantity) }}{{ dn($item->price) }}{{ dn($item->total_discounts) }}{{ number_format($item->total_final_price, 2) }}{{isset($item->tax_ratio) ? $item->tax_ratio . '%' : '---' }} {{ number_format($item->total_final_price + $tax_amount, 2) }} {{ $item->expire_date }} @if (is_array($item->serial_items) && count($item->serial_items))
@csrf
@else --- @endif
{{ $item->notice }}
{{ $item->barcode->number }} {{ $item->barcode->ar_name }} {{ $item->barcode->unit->name }} {{ dn($item->bonus) }}{{ dn(0) }}{{ dn(0) }}{{ dn(0) }}{{ dn(0) }}{{ dn(0) }}{{ $item->expire_date }} --- {{ $item->notice }}
@if ($overviewBond['bond']->expenses->isNotEmpty())

Expenses

@php $total = 0; @endphp @foreach ($overviewBond['bond']->expenses as $item) @php $total+= $item->amount; @endphp @endforeach
Expenses Amount Account
{{ $item->standard_expenses->name }} {{ dn($item->amount) }} {{ $item->standard_expenses->account->name }}
Total {{ dn($total) }}
@endif
Cash Invoice
Invoice #:

{{ $overviewBond['bond']->bond_number }}

Branch:

{{ $overviewBond['bond']->branch->name }}

Invoice date:

{{ $overviewBond['bond']->date }}

Customer:

{{ $overviewBond['bond']->client?->name }}

Customer tax number

{{ $overviewBond['bond']->client?->tax_number }}

@php $debit_sum = 0; $credit_sum = 0; $salesInvoiceService = new App\Services\Tenant\Warehouses\SalesInvoiceService(); $entry_accounts = null; $entry_error_message = ''; $automated_receipt_entry = null; try { $entry_accounts = $salesInvoiceService->buildBondAsEntry($overviewBond['bond']); $automated_receipt_entry = App\Models\Accounting\AutomatedEntry::with( 'items', 'items.account', 'items.receivable_account', ) ->where('builder_model', 'SalesInvoice') ->where('builder_model_id', $overviewBond['bond']->id) ->first(); } catch (\Throwable $th) { $entry_error_message = 'لا يمكن بناء القيد, قد يكون عائلات المواد غير مرتبطة بحسابات على الشجرة !'; } @endphp @if ($entry_accounts) @if ($entry_accounts['debit_accounts']) @foreach ($entry_accounts['debit_accounts'] as $debit_key => $accounts_list) @foreach ($accounts_list as $debit_item_id => $account_info) @php $debit_sum+= $account_info['amount']; @endphp @endforeach @endforeach @endif @if ($entry_accounts['credit_accounts']) @foreach ($entry_accounts['credit_accounts'] as $credit_key => $accounts_list) @foreach ($accounts_list as $credit_item_id => $account_info) @php $credit_sum+= $account_info['amount']; @endphp @endforeach @endforeach @endif @if ($automated_receipt_entry) @foreach ($automated_receipt_entry->items as $automated_item) @endforeach @php $credit_sum += $automated_receipt_entry->amount; $debit_sum += $automated_receipt_entry->amount; @endphp @endif @else @endif
Account Debit Cedit Cost Center Note
{{ $account_info['account']->name }} {{ dn($account_info['amount']) }} --- ---
{{ $account_info['account']->name }} --- {{ dn($account_info['amount']) }} ---
{{ $automated_item->account ? $automated_item->account->name : $automated_item->receivable_account->name }} {{ $automated_item->debit ? dn($automated_item->debit) : '---' }} {{ $automated_item->credit ? dn($automated_item->credit) : '---' }} --- {{ $automated_receipt_entry->notice }}
{{ $entry_error_message }}
{{ dn($debit_sum) }} {{ dn($credit_sum) }}

I received the goods after inspecting them and ensuring their suitability, and that the company is not responsible after receiving them

@php $total_after_extra_discount = $total_amount_before_normal_discounts - $total_extra_discounts - $client_discount; @endphp
@can('warehouses-salesInvoices-showSalesPrice')
Ammount befor addtional discount: {{ number_format($total_amount_before_normal_discounts, 2) }}
@endcan
Additional discount : {{ dn($total_extra_discounts) }}
Client's discount : {{ dn($client_discount) }}
@can('warehouses-salesInvoices-showSalesPrice')
Amount after additional discount: {{ number_format($total_after_extra_discount, 2) }}
@endcan
Tax {{ dn($tax_amounts_total) }}
@php $expenses_amount = $overviewBond['bond']->expenses->sum('amount'); @endphp Expenses amount {{ dn($expenses_amount) }}
@can('warehouses-salesInvoices-showSalesPrice')
@php $the_total_number = $total_amount_before_normal_discounts - $total_extra_discounts - $client_discount + $tax_amounts_total + $expenses_amount; @endphp Total {{ number_format($the_total_number, 2) }}
@endcan
@php $signatures = App\Models\Warehouses\WarehousesSignature::byType('sales_invoice') ->active() ->get(); @endphp @if (count($signatures))

Signature

@foreach ($signatures as $signature)

{{ $signature->label }}

----------------------------

@endforeach
@endif

Accured name

Accoured Signature ------------------------

{!! QrCode::size(100)->generate( route('tenant.show-document', ['type' => 'sales-invoice', 'id' => $overviewBond['bond']->id]), ) !!}
@if (Session::get('print_data')['under_tax']) All prices above are subject to general tax @endif
@endif @push('script') @endpush