@php $invoiceSettings = $invoiceSettings ?? new stdClass(); $footerText = $invoiceSettings->footer_text ?? ''; $company_name = $company_name ?? config('app.name', 'Company Name'); $company_logo = $company_logo ?? null; $invoice = $invoice ?? null; $tenant = $tenant ?? null; $items = $items ?? collect(); @endphp @if ($invoice)
{{ strtoupper($invoice->status ?? 'NEW') }}
@endif
{{ $company_name }}
@if (isset($invoiceSettings->company_address) && !empty($invoiceSettings->company_address)){!! nl2br(e($invoiceSettings->company_address)) !!}@endif
@if ($invoice) {{ ucfirst($invoice->status ?? 'New') }}
{{ t('invoice') }}
#{{ $invoice->invoice_number ?? format_draft_invoice_number() }}
{{ $invoice->created_at ? $invoice->created_at->format('F j, Y') : date("F j, Y") }}
@endif
@if ($tenant)

{{ t('bill_to') }}

{{ $tenant->billing_name ?? ($tenant->company_name ?? 'Customer') }}
@if (!empty($tenant->billing_address)){!! nl2br(e($tenant->billing_address)) !!}
@endif @if (!empty($tenant->billing_city)){{ $tenant->billing_city }}@if (!empty($tenant->billing_state)), {{ $tenant->billing_state }}@endif {{ $tenant->billing_zip_code ?? '' }}
@endif @if (!empty($tenant->billing_phone)){{ $tenant->billing_phone }}
@endif @if (!empty($tenant->billing_email)){{ $tenant->billing_email }}@endif
@endif @if ($items && $items->count() > 0) @foreach ($items as $item) @endforeach
{{ t('description') }}{{ t('price') }}{{ t('quantity') }}{{ t('amount') }}
{{ $item->title ?? t('default_item_title') }}
@if (!empty($item->description))
{!! nl2br(e($item->description)) !!}
@endif
{{ $invoice ? $invoice->formatAmount($item->amount ?? 0) : number_format($item->amount ?? 0, 2) }} {{ $item->quantity ?? 1 }} {{ $invoice ? $invoice->formatAmount(($item->amount ?? 0) * ($item->quantity ?? 1)) : number_format(($item->amount ?? 0) * ($item->quantity ?? 1), 2) }}
@endif @if ($invoice)
@php $taxDetails = $invoice->getTaxDetails(); $subtotal = $invoice->subTotal(); $calculatedTaxAmount = 0; foreach ($taxDetails as $tax) { $amt = $tax['amount'] ?? 0; if ($amt <= 0 && ($tax['rate'] ?? 0) > 0) { $amt = $subtotal * (($tax['rate'] ?? 0) / 100); } $calculatedTaxAmount += $amt; } $fee = $invoice->fee ?? 0; $calculatedTotal = $subtotal + $calculatedTaxAmount + $fee; @endphp @if (count($taxDetails) > 0)@foreach ($taxDetails as $tax)@endforeach @else@endif @if ($fee > 0)@endif @if (count($creditTransactions) > 0) @endif
{{ t('subtotal') }}{{ $invoice->formatAmount($subtotal) }}
{{ $tax['name'] ?? t('tax_label') }} ({{ $tax['formatted_rate'] ?? '0%' }}){{ ($tax['amount'] ?? 0) <= 0 && ($tax['rate'] ?? 0) > 0 ? $invoice->formatAmount($subtotal * (($tax['rate'] ?? 0) / 100)) : $tax['formatted_amount'] ?? $invoice->formatAmount(0) }}
{{ t('tax') }} (0%){{ $invoice->formatAmount(0) }}
{{ t('fee') }}{{ $invoice->formatAmount($fee) }}
{{ t('credit_applied') }}@php $credits = $creditTransactions->sum('amount'); if ($credits > $calculatedTotal) { $credits = $calculatedTotal; } @endphp{{ '- ' . $invoice->formatAmount($credits) }}
{{ $invoice->status == 'paid' ? t('amount_paid') : t('amount_due') }}@php $finalamount = $calculatedTotal - $credits; @endphp{{ $invoice->formatAmount($finalamount) }}
{{ t('total') }}{{ $invoice->formatAmount($calculatedTotal) }}
@endif
@if ($invoice && $invoice->status === 'paid' && isset($transactions) && $transactions->count() > 0)

Transaction Details

@foreach ($transactions as $transaction)
Transaction ID: {{ $transaction->id }}
Payment Method: {{ ucfirst(str_replace('_', ' ', $transaction->type ?? '-')) }}
Reference: {{ $transaction->idempotency_key ?? '-' }}
Gateway Txn ID: {{ $transaction->metadata['transaction_id'] ?? $transaction->metadata['payment_reference'] ?? '-' }}
Payment Ref: {{ $transaction->metadata['exchange_reference_number'] ?? $transaction->metadata['order_no'] ?? '-' }}
Processed: {{ $transaction->created_at ? $transaction->created_at->format('M j, Y H:i') : '-' }}
@endforeach
@endif @if ($invoice && $invoice->status === 'paid')
{{ t('payment_information') }}
{{ t('paid_on') }} {{ $invoice->paid_at ? $invoice->paid_at->format('F j, Y') : 'N/A' }}
{{ t('payment_received_message') }}
@endif