@php $appName = \App\Models\SystemSetting::get('app_name', config('app.name', 'WaDesk')); $cur = strtoupper($invoice->currency ?: 'USD'); $sym = [ 'USD' => '$', 'EUR' => '€', 'GBP' => '£', 'INR' => '₹', 'AUD' => 'A$', 'CAD' => 'C$', 'AED' => 'AED ', 'SGD' => 'S$', 'ZAR' => 'R', 'BRL' => 'R$', ][$cur] ?? $cur . ' '; $money = fn($v) => $sym . number_format((float) $v, 2); $subtotal = (float) $invoice->amount; $discount = (float) ($invoice->discount_amount ?? 0); $taxRate = (float) ($invoice->tax_rate ?? 0); $taxAmt = (float) ($invoice->tax_amount ?? 0); $total = (float) ($invoice->total_amount ?: $subtotal - $discount + $taxAmt); $paidAmt = $invoice->status === 'paid' ? $total : 0.0; $balance = max(0, $total - $paidAmt); $badge = InvoicesController::badge($invoice); $invNo = $invoice->order_number ?: 'INV-' . $invoice->id; $issue = $invoice->created_at; $paidAt = $invoice->paid_at; $billToName = $invoice->billing_company ?: ($invoice->customer_name ?: (optional($invoice->workspace)->name ?: optional($invoice->user)->name ?: '—')); $billToEmail = $invoice->customer_email ?: optional($invoice->user)->email; $billLines = array_values( array_filter([ $invoice->billing_address, trim(implode(' ', array_filter([$invoice->billing_city, $invoice->billing_postal]))), $invoice->billing_country, ]), ); $gatewayName = optional($invoice->gateway)->name ?: ucfirst((string) ($invoice->gateway_slug ?: 'manual')); $lineDesc = $package->name ?? __('Plan purchase'); @endphp
{{ ucfirst($badge['label']) }} @if ($paidAt) · {{ $paidAt->format('Y-m-d') }} @endif
{{ __('Invoice') }} #{{ $invNo }} · {{ $gatewayName }}@if ($invoice->gateway_payment_id) · {{ $invoice->gateway_payment_id }} @endif
{{ $billToName }} · {{ $lineDesc }}
{{ __('Issued') }} {{ optional($issue)->format('Y-m-d') }}@if ($paidAt) · {{ __('settled') }} {{ $paidAt->diffForHumans($issue, true) }} @endif
{{ $money($total) }}
{{ $cur }} · {{ $invoice->status === 'paid' ? __('paid in full') : ucfirst($invoice->status) }}
{{ $billing['company'] }}
@if ($billing['address']) {!! nl2br(e($billing['address'])) !!}
@endif @if ($billing['tax_id']) GSTIN/VAT {{ $billing['tax_id'] }} @endif
{{ __('Tax invoice') }}
{{ __('INVOICE') }}
{{ __('Invoice #') }}
{{ $invNo }}
{{ __('Issue date') }}
{{ optional($issue)->format('d M Y') }}
@if ($paidAt)
{{ __('Paid date') }}
{{ $paidAt->format('d M Y') }}
@endif
{{ __('Status') }}
{{ ucfirst($badge['label']) }}
{{ __('Bill to') }}
{{ $billToName }}
@if ($billToEmail) {{ $billToEmail }}
@endif @foreach ($billLines as $bl) {{ $bl }}
@endforeach @if ($invoice->billing_tax_id) GSTIN/VAT {{ $invoice->billing_tax_id }} @endif
{{ __('Payment') }}
{{ __('Method') }}
{{ $gatewayName }}
@if ($invoice->gateway_payment_id)
{{ __('Txn ID') }}
{{ $invoice->gateway_payment_id }}
@endif @if ($paidAt)
{{ __('Captured at') }}
{{ $paidAt->format('d M Y, H:i') }}
@endif
{{ __('Currency') }}
{{ $cur }}
@if ($invoice->coupon_code)
{{ __('Coupon') }}
{{ $invoice->coupon_code }}
@endif
@if ($discount > 0) @endif
{{ __('Description') }} {{ __('Qty') }} {{ __('Unit') }} {{ __('Total') }}
{{ $lineDesc }}
{{ __('Order') }} {{ $invNo }}@if ($package && $package->id) · plan_{{ $package->id }} @endif
1 {{ $money($subtotal) }} {{ $money($subtotal) }}
{{ __('Discount') }}
@if ($invoice->coupon_code)
{{ __('code') }} {{ $invoice->coupon_code }}
@endif
1 -{{ $money($discount) }} -{{ $money($discount) }}
{{ __('Subtotal') }}{{ $money($subtotal) }}
@if ($discount > 0)
{{ __('Discount') }}-{{ $money($discount) }}
@endif @if ($taxAmt > 0 || $taxRate > 0)
{{ $billing['tax_label'] }} ({{ rtrim(rtrim(number_format($taxRate, 2), '0'), '.') }}%){{ $money($taxAmt) }}
@endif
{{ __('Total') }}{{ $money($total) }}
{{ __('Amount paid') }}{{ $money($paidAmt) }}
{{ __('Balance due') }}{{ $money($balance) }}
{{ __('Notes') }}

{{ __('Thank you for your business. This invoice covers the order referenced above. Reference the invoice number for any billing queries.') }}

{{ __('Need help?') }}

@if ($billing['email']) {{ __('Email') }} {{ $billing['email'] }} @endif @if ($billing['phone']) · {{ __('Phone') }} {{ $billing['phone'] }} @endif

{{ $billing['company'] }}@if ($billing['reg_no']) · {{ $billing['reg_no'] }} @endif · {{ __('This is a computer-generated invoice and does not require a signature.') }}