@extends('layouts.app') @section('title', __('Invoice').' '.$invoice->invoice_number) @section('content') @php $businessName = $appSettings['business_name'] ?? 'TradeERP'; $customerName = $invoice->customer?->name ?? $invoice->walk_in_name ?? __('Walk-in Customer'); $customerPhone = $invoice->customer?->phone ?? $invoice->walk_in_phone; $qrEnabled = ($appSettings['qr_enabled'] ?? '1') !== '0'; $qrData = route('invoices.show', $invoice); $currentInvoiceAmount = max(0, (float) $invoice->total - (float) $invoice->previous_balance); $paymentReceived = (float) $invoice->payments->sum('amount'); $finalOutstanding = max(0, (float) $invoice->previous_balance + $currentInvoiceAmount - $paymentReceived); $waMessage = $businessName."\n".__('Invoice').': '.$invoice->invoice_number."\n".__('Customer').': '.$customerName."\n".__('Previous Balance').': '.number_format($invoice->previous_balance,2).' '.$invoice->currency_code."\n".__('Current Invoice Amount').': '.number_format($currentInvoiceAmount,2).' '.$invoice->currency_code."\n".__('Payment Received').': '.number_format($paymentReceived,2).' '.$invoice->currency_code."\n".__('Final Outstanding Balance').': '.number_format($finalOutstanding,2).' '.$invoice->currency_code."\n".($appSettings['whatsapp_footer'] ?? 'Thank you for your business.'); $waLink = \App\Support\WhatsApp::link($waMessage, $appSettings, $customerPhone, false); @endphp
| # | {{ __('Item') }} | {{ __('Qty') }} | {{ __('Unit') }} | {{ __('Base Qty') }} | {{ __('Price') }} | {{ __('Total') }} |
|---|---|---|---|---|---|---|
| {{ $loop->iteration }} | {{ $item->product_name }} | {{ $item->quantity }} | {{ $item->unit ?? $item->product?->unit }} | {{ $item->base_quantity ?: $item->quantity }} {{ $item->product?->unit }} | {{ number_format($item->unit_price, 2) }} | {{ number_format($item->line_total, 2) }} |
| {{ $invoice->items->count() + 1 }} | {{ __('Previous Invoice Balance') }} | - | - | - | {{ number_format($invoice->previous_balance, 2) }} | {{ number_format($invoice->previous_balance, 2) }} |
{{ $appSettings['invoice_footer'] }}
@endif