Invoice - Quick Phone
@php $currency = $all_settings->currency ?? 'BDT'; @endphp
@if($all_settings && $all_settings->logo_path) @endif
{{ $all_settings->company_name ?? 'Quick Phone' }}
@if($all_settings && $all_settings->company_registration_name)
{{ $all_settings->company_registration_name }}
@endif @if($all_settings && $all_settings->company_registration_number)
📋 Reg No: {{ $all_settings->company_registration_number }}
@endif
@if($all_settings && $all_settings->address) 📍 {{ $all_settings->address }}
@endif @if($all_settings && $all_settings->number) � Phone: {{ $all_settings->number }} @endif @if($all_settings && $all_settings->company_email) | ✉️ {{ $all_settings->company_email }}
@endif @if($all_settings && $all_settings->website) 🌐 {{ $all_settings->website }}
@endif
Invoice No: INV-{{ $sale->id }}
Date: {{ $sale->created_at->format('d/m/Y') }}
Time: {{ $sale->created_at->format('H:i:s') }}
Payment Method: {{ ucfirst($sale->payment_method) }}
Payment Status: {{ ucfirst($sale->payment_status) }}
Bill To:
{{ $sale->customer->name ?? 'Walk-in Customer' }}
@if($sale->customer && $sale->customer->phone) Phone: {{ $sale->customer->phone }}
@endif @if($sale->customer && $sale->customer->address) Address: {{ $sale->customer->address }} @endif
@php $itemCount = 1; @endphp @foreach ($sale->sellTransactions as $transaction) @endforeach @if($sale->exchanges && $sale->exchanges->count() > 0) @foreach ($sale->exchanges as $exchange) @endforeach @endif
# Product Brand Model IMEI/SN Qty Price Subtotal
{{ $itemCount++ }} {{ $transaction->name ?? 'N/A' }} {{ $transaction->product->ProductBrand->name ?? 'N/A' }} {{ $transaction->product->ProductModel->name ?? 'N/A' }} {{ $transaction->product->imei_or_sn ?? 'N/A' }} {{ $transaction->sold_quantity ?? 0 }} {{ $currency }} {{ number_format($transaction->sell_price, 2) }} {{ $currency }} {{ number_format($transaction->sell_price * $transaction->sold_quantity, 2) }}
{{ $itemCount++ }} Exchanged: {{ $exchange->brand->name ?? 'N/A' }} {{ $exchange->mobileModel->name ?? 'N/A' }} {{ $exchange->brand->name ?? 'N/A' }} {{ $exchange->mobileModel->name ?? 'N/A' }} {{ $exchange->imei ?? 'N/A' }} 1 {{ $currency }} {{ number_format($exchange->price, 2) }} {{ $currency }} {{ number_format($exchange->price, 2) }}
@if ($sale->discount > 0) @endif @if ($sale->due_amount > 0) @endif @php // Calculate customer total outstanding $customerTotalDue = 0; if ($sale->customer) { // Get customer's previous due amount (before this sale) $previousDue = \App\Models\Sale::where('customer_id', $sale->customer->id) ->where('id', '!=', $sale->id) ->where('return_status', '!=', 'returned') ->sum('due_amount'); // Add current sale's due amount (0 for paid invoices, amount for credit invoices) $currentSaleDue = $sale->due_amount ?? 0; // Subtract any payments made towards previous due $previousDuePayments = \App\Models\CustomerPayment::where('customer_id', $sale->customer->id) ->where('type', 'due_payment') ->sum('amount'); // For paid invoices: currentSaleDue = 0, so only previous due remains // For credit invoices: currentSaleDue = sale amount, so total increases $customerTotalDue = $previousDue + $currentSaleDue - $previousDuePayments; } @endphp @if ($sale->customer && $customerTotalDue > 0) @endif
Subtotal: {{ $currency }} {{ number_format($sale->total_amount, 2) }}
Exchange Discount: -{{ $currency }} {{ number_format($sale->discount, 2) }}
Net Amount: {{ $currency }} {{ number_format($sale->net_amount, 2) }}
Paid Amount: {{ $currency }} {{ number_format($sale->paid_amount, 2) }}
Due Amount: {{ $currency }} {{ number_format($sale->due_amount, 2) }}
Customer Total Outstanding: {{ $currency }} {{ number_format($customerTotalDue, 2) }}