{{ t('invoice_details') }}

{{ t('invoice_details') }}

{{ t('back_to_invoices') }}

{{ t('invoice') }} #{{ $invoice->invoice_number ?? format_draft_invoice_number() }}

{{ $invoice->created_at->format('F j, Y') }}
@switch($invoice->status) @case('paid') {{ t('paid') }} @break @case('cancelled') {{ t('cancelled') }} @break @case('failed') {{ t('failed') }} @break @case('pending') {{ t('pending') }} @break @case('new') {{ t('new') }} @break @default {{ ucfirst($invoice->status) }} @endswitch
@if ($invoice->status === 'paid') {{ t('view_pdf') }} {{ t('download') }} @elseif($invoice->status === 'new') {{ t('view_pdf') }} {{ t('download') }} @if (auth()->user()->user_type === 'tenant' && !$invoice->transactions->contains('status', 'pending')) {{ t('pay_now') }} @endif @else {{ t('view_pdf') }} {{ t('download') }} @endif

From

@php $systemSettings = get_batch_settings([ 'system.company_name', 'system.company_address', 'system.company_city', 'system.company_state', 'system.company_zip_code', 'system.company_country_id', 'system.company_email', ]); @endphp

{{ $systemSettings['system.company_name'] ?? config('app.name') }}

{{ $systemSettings['system.company_address'] }}

{{ $systemSettings['system.company_city'] }} {{ $systemSettings['system.company_state'] }} {{ $systemSettings['system.company_zip_code'] }}

{{ get_country_name($systemSettings['system.company_country_id']) }}

{{ $systemSettings['system.company_email'] }}

To

{{ $tenant->billing_name ? $tenant->billing_name : $tenant->company_name }}

{{ $tenant->billing_address }}

{{ $tenant->billing_city }} {{ $tenant->billing_state }} {{ $tenant->billing_zip_code }}

{{ get_country_name($tenant->billing_country) }}

{{ $tenant->billing_email }}

{{ t('invoice_summary') }}

@foreach ($invoice->items as $item) @endforeach
{{ t('description') }} {{ t('price') }} {{ t('qty') }} {{ t('amount') }}
{{ $item->title }}
@if ($item->description)
{{ $item->description }}
@endif
{{ $invoice->formatAmount($item->amount) }} {{ $item->quantity }} {{ $invoice->formatAmount($item->amount * $item->quantity) }}
@php $subtotal = $invoice->subTotal(); $taxDetails = $invoice->getTaxDetails(); // Create price breakdown display $priceBreakdown = $invoice->formatAmount($subtotal); $taxBreakdown = []; foreach ($taxDetails as $tax) { $taxBreakdown[] = $tax['formatted_rate'] . ' ' . $tax['name']; } @endphp
{{ t('subtotal') }} {{ $invoice->formatAmount($subtotal) }}
@if (count($taxDetails) > 0) @foreach ($taxDetails as $tax) @php // Calculate tax amount based on rate and subtotal if it's showing as 0 $taxAmount = $tax['amount']; if ($taxAmount <= 0 && $tax['rate'] > 0) { $taxAmount = $subtotal * ($tax['rate'] / 100); $formattedTaxAmount = $invoice->formatAmount($taxAmount); } else { $formattedTaxAmount = $tax['formatted_amount']; } @endphp
{{ $tax['name'] }} ({{ $tax['formatted_rate'] }}) : {{ $formattedTaxAmount }}
@endforeach @else
{{ t('tax') }} (0%): {{ $invoice->formatAmount(0) }}
@endif @if ($invoice->fee > 0)
{{ t('fee') }}: {{ $invoice->formatAmount($invoice->fee) }}
@endif @php // Ensure we calculate and display the correct total with tax $taxAmount = 0; // Calculate actual tax amount if needed foreach ($taxDetails as $tax) { $amount = $tax['amount']; if ($amount <= 0 && $tax['rate'] > 0) { $amount = $subtotal * ($tax['rate'] / 100); } $taxAmount += $amount; } $fee = $invoice->fee ?: 0; $calculatedTotal = $subtotal + $taxAmount + $fee; // Use calculated total if different from invoice total if (abs($calculatedTotal - $invoice->total()) > 0.01) { $totalDisplay = $invoice->formatAmount($calculatedTotal); } else { $totalDisplay = $invoice->formattedTotal(); } @endphp @if (count($creditTransactions ?? []) > 0)
{{ t('credit_applied') }}: {{ $invoice->formatAmount($creditTransactions->sum('amount')) }}
{{ $invoice->status == 'paid' ? t('amount_paid') : t('amount_due') }}: @php $final = $calculatedTotal - $creditTransactions->sum('amount'); @endphp {{ $invoice->formatAmount($final ?? 0) }}
@endif
{{ t('total') }}: {{ $totalDisplay }}
@if ($invoice->transactions->count() > 0)

{{ t('transaction_history') }}

@foreach ($invoice->transactions as $transaction) @endforeach
{{ t('date') }} {{ t('type') }} {{ t('status') }} {{ t('amount') }}
{{ format_date_time($transaction->created_at) }} {{ ucfirst($transaction->type) }} {{ ucfirst($transaction->status) }} {{ $transaction->formattedAmount() }}
@endif