@if (!$overviewBond['print'] && $overviewBond['bond']->post_status == false) @can('warehouses-salesInvoices-edit') Edit @endcan @endif
Customer Name: {{ $overviewBond['bond']->client_name }}
Account No: {{ ($overviewBond['bond']['client'])->id_by_receivable_type ?? '-----' }}
salesman
{{ $overviewBond['bond']['employee']['user_name'] }}
{{ $overviewBond['bond']['employee']['phone'] }}
Our ref.
{{ $overviewBond['company']['owner'] }}
{{ $overviewBond['company']['phone'] }}
Invoice No: {{ $overviewBond['bond']->bond_number }}
Sales Tax: {{ $overviewBond['company']['tax_number'] }}
Invoice Date: {{ $overviewBond['bond']->date }}
Due Date: {{ $overviewBond['bond']->selected_payment_way ?? '---' }}
@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 $index => $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_value = ($overviewBond['bond']->client_discount_ratio / 100) * $item->total_final_price; $client_discount += $client_discount_value; $tax_amount = $item->tax_ratio ? ($item->total_final_price - $client_discount_value) * ($item->tax_ratio / 100) : 0; $tax_amounts_total += $tax_amount; $rowBackground = $index % 2 == 0 ? '#ffffff' : '#f5f5f5'; @endphp @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @if ($item->bonus) @php $bonusRowBackground = ($index + 1) % 2 == 0 ? '#f9f9f9' : '#e0e0e0'; @endphp @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @endif @endforeach @php $total_after_extra_discount = $total_amount_before_normal_discounts - $total_extra_discounts - $client_discount; $expenses_amount = $overviewBond['bond']->expenses->sum('amount'); $the_total_number = $total_amount_before_normal_discounts - $total_extra_discounts - $client_discount + $tax_amounts_total + $expenses_amount; @endphp @php $total_after_extra_discount = $total_amount_before_normal_discounts - $total_extra_discounts - $client_discount; @endphp @php $the_total_number = $total_amount_before_normal_discounts - $total_extra_discounts - $client_discount + $tax_amounts_total + $expenses_amount; @endphp @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan @can('warehouses-salesInvoices-showSalesPrice') @endcan
Item no. Description Unit Warehouse QTY Unit PriceSales Tax Expiration Date Serial Numbers CommentsTotal
{{ $item->barcode->number }} {{ $item->print_name ?: $item->barcode->ar_name }} {{ $item->barcode->unit->name }} {{ $overviewBond['bond']['branch']['name'] }} {{ dn($item->quantity) }} {{ dn($item->price) }} {{ isset($item->tax_ratio)? $item->tax_ratio . '%' : '---' }} {{ $item->expire_date }} @if (is_array($item->serial_items) && count($item->serial_items))
@csrf
@else --- @endif
{{ $item->notice }} {{ dn($item->total_final_price + $tax_amount) }}
{{ $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 }}
SUBTOTAL {{ dn($total_amount_before_normal_discounts) }}
EXTRA DISCOUNT {{ dn($total_extra_discounts) }}
CLIENT DISCOUNT {{ dn($client_discount) }}
SUBTOTAL LESS DISCOUNT {{ dn($total_after_extra_discount) }}
TOTAL TAX {{ dn($tax_amounts_total) }}
SHIPPING/HANDLING {{ dn($expenses_amount) }}
Balance Due {{ dn($the_total_number) }}
INVOICE #{{ $overviewBond['bond']->bond_number }}
Thank you for your business!
@php $svgPath = storage_path( 'app/fotara/images/sales_invoice_' . $overviewBond['bond']->id . '_qr.svg', ); @endphp @if (file_exists($svgPath))
{!! file_get_contents($svgPath) !!}
Fotara
@else
{!! QrCode::size(90)->generate( route('tenant.show-document', ['type' => 'sales-invoice', 'id' => $overviewBond['bond']->id]), ) !!}
Misk
@endif
@if ($overviewBond['bond']->expenses->isNotEmpty())

@lang('warehouses/sales-invoices/show.expenses')

@php $total = 0; @endphp @foreach ($overviewBond['bond']->expenses as $item) @php $total+= $item->amount; @endphp @endforeach
@lang('warehouses/sales-invoices/show.expense') @lang('warehouses/sales-invoices/show.value') @lang('warehouses/sales-invoices/show.account')
{{ $item->standard_expenses->name }} {{ dn($item->amount) }} {{ $item->standard_expenses->account->name }}
@lang('warehouses/sales-invoices/show.total') {{ dn($total) }}
@endif
@lang('warehouses/sales-invoices/show.cash_invoice')
@lang('warehouses/sales-invoices/show.invoice_number') :

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

@lang('warehouses/sales-invoices/show.branch') :

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

@lang('warehouses/sales-invoices/show.date') :

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

@lang('warehouses/sales-invoices/show.client') :

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

@lang('warehouses/sales-invoices/show.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
@lang('warehouses/sales-invoices/show.account_receivable') @lang('warehouses/sales-invoices/show.debtor') @lang('warehouses/sales-invoices/show.creditor') @lang('warehouses/sales-invoices/show.cost_center') @lang('warehouses/sales-invoices/show.description')
{{ $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) }}
@php $signatures = App\Models\Warehouses\WarehousesSignature::byType('sales_invoice') ->active() ->get(); @endphp @if (count($signatures))

@lang('warehouses/sales-invoices/show.signature')

@foreach ($signatures as $signature)

{{ $signature->label }}

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

@endforeach
@endif

Attachments

@foreach ($overviewBond['bond']->attachments as $attachment)

{{ $attachment->file }}

@csrf
@endforeach
@push('script') @endpush