@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
{{ __('Invoices') }} {{ __('Edit') }}
@csrf @method('DELETE')
@if($waLink){{ __('Send WhatsApp') }}@endif
@if($invoice->due_amount > 0)
{{ __('Record Payment') }}
@csrf
@endif @endsection