{{-- resources/views/sale/bills/print-invoice-smart.blade.php --}} @extends('master.app') @section('title', 'Invoice Print') @section('pageCSS') @endsection @section('body') @php // ===== Safe defaults (no bugs if controller forgets) ===== $currencyTitle = optional($bill->currency)->title_en ?? ''; $invoiceBalance = (float)($bill->final_amount ?? 0) - (float)($bill->received ?? 0); // previous_balance + current_balance (recommended to be calculated in controller) $previous_balance = $previous_balance ?? 0; $current_balance = $current_balance ?? ($previous_balance + $invoiceBalance); // Payment label fixed (your old view had cash/bank swapped) $payLabel = 'Other'; if(($bill->transaction_id ?? null) == 1) $payLabel = 'Cash'; elseif(($bill->transaction_id ?? null) == 2) $payLabel = 'Bank'; elseif(($bill->transaction_id ?? null) == 3) $payLabel = 'Sarafi'; elseif(($bill->transaction_id ?? null) == 4) $payLabel = 'Other'; // Pacha Logo (change path to your real logo) // Option A: If you have a stored logo in DB like $blogo, use it: // $pachaLogo = isset($blogo) ? asset('storage/'.$blogo) : asset('images/pacha-logo.png'); $pachaLogo = asset('images/pacha-logo.png'); // <-- ✅ replace if your path is different // OomClick info $oomPhone = '0704172665'; $oomWhats = '0702172665'; $oomEmail = 'info@oomclick.com'; $oomAddr = 'Kart-e-now, First Street'; @endphp
{{-- ACTION BUTTONS --}}
PACHA
{{-- HEADER --}}

Pacha Invoice

Professional Invoice • International Style
{{ $bill->invoice_number }} {{ $bill->invoice_date }} {{ $payLabel }}
{{-- BODY --}}
{{-- META --}}
Customer
Name{{ $bill->customer->name ?? '-' }}
Phone{{ $bill->customer->phone ?? '-' }}
Address{{ $bill->customer->address ?? '-' }}
Received By{{ $bill->received_by ?? '-' }}
Invoice Barcode
{{ $bill->title ?? 'Invoice' }}
Scan for quick reference (Invoice No).
Currency: {{ $currencyTitle }} @if(!empty($bill->ex_rate)) ExRate: {{ $bill->ex_rate }} @endif
{{-- ITEMS TABLE --}}
@if($bill->type_id == 1) @endif @forelse($items as $row) {{-- Item name / category --}} @if($bill->type_id == 1) @endif @empty @endforelse
# ItemSub/Cat WeightUnit Qty Price Total
{{ $loop->iteration }}
{{ optional($row->category)->title_en ?? '-' }}
@if(!empty($row->stock_id))
Stock ID: {{ $row->stock_id }}
@endif
{{ optional($row->sub_category)->title_en ?? '-' }} {{ optional($row->weight)->title_en ?? '-' }}{{ optional($row->unit)->title_en ?? '-' }} {{ $row->qty ?? 0 }} @if($bill->type_id == 1) {{ number_format((float)($row->sale_price ?? 0), 2) }} @else {{ number_format((float)($row->spi ?? 0), 2) }} @endif {{ number_format((float)($row->total ?? 0), 2) }}
No items found.
{{-- TOTALS + BALANCE --}}
Balance Overview
Previous Balance {{ $currencyTitle }} {{ number_format((float)$previous_balance, 2) }}
Current Invoice Balance {{ $currencyTitle }} {{ number_format((float)$invoiceBalance, 2) }}
Current Total Balance {{ $currencyTitle }} {{ number_format((float)$current_balance, 2) }}
* Current Total Balance = Previous Balance + (Final Amount - Received)
Invoice Totals
Grand Total {{ $currencyTitle }} {{ number_format((float)($bill->grand_total ?? 0), 2) }}
Discount {{ $currencyTitle }} {{ number_format((float)($bill->discount ?? 0), 2) }}
Final Amount {{ $currencyTitle }} {{ number_format((float)($bill->final_amount ?? 0), 2) }}
Received {{ $currencyTitle }} {{ number_format((float)($bill->received ?? 0), 2) }}
Invoice Balance {{ $currencyTitle }} {{ number_format((float)$invoiceBalance, 2) }}
Note: Please verify this invoice before payment. Thanks for your business.
{{-- FOOTER --}}
@endsection @section('pageJs') {{-- JsBarcode --}} {{-- SweetAlert2 (optional but nice for share errors) --}} @endsection