@php $tx = $sale ?? null; $title = 'Sales Invoice'; $toLabel = 'Invoice To (Customer)'; $statusText = ($tx?->status ?? 'open') === 'closed' ? 'Paid' : 'Unpaid'; $statusColor = ($tx?->status ?? 'open') === 'closed' ? 'green' : 'red'; if ($invoiceType === 'purchase') { $tx = $purchase ?? null; $title = 'Purchase Invoice'; $toLabel = 'Invoice To (Vendor)'; $statusText = ($tx?->status ?? 'open') === 'closed' ? 'Paid' : 'Unpaid'; $statusColor = ($tx?->status ?? 'open') === 'closed' ? 'green' : 'red'; } elseif ($invoiceType === 'sale_return') { $tx = $salesReturn ?? null; $title = 'Sales Return Invoice'; $toLabel = 'Return From (Customer)'; $statusText = ($tx?->status ?? 'open') === 'closed' ? 'Refunded' : 'Pending Refund'; $statusColor = ($tx?->status ?? 'open') === 'closed' ? 'green' : 'red'; } elseif ($invoiceType === 'purchase_return') { $tx = $purchaseReturn ?? null; $title = 'Purchase Return Invoice'; $toLabel = 'Return To (Vendor)'; $statusText = ($tx?->status ?? 'open') === 'closed' ? 'Received' : 'Pending Receipt'; $statusColor = ($tx?->status ?? 'open') === 'closed' ? 'green' : 'red'; } $fromName = $systemSetting->name ?? ($tx->company?->name ?? 'Company'); $fromAddress = $systemSetting->address ?? '-'; $fromEmail = $systemSetting->email ?? ''; $fromPhone = $systemSetting->phone ?? ''; @endphp {{ $fromName }} - {{ $title }} @if (!empty($systemSetting?->favicon)) @endif

Invoice No: {{ $tx->transaction_no }}

Date: {{ optional($tx->date)->format('M d, Y') }}

Status: {{ $statusText }}

@if (!empty($systemSetting?->logo)) @endif
Invoice From:

{{ $fromName }}
{{ $fromAddress }}

{{ $toLabel }}:

{{ $tx->party?->name ?? '-' }}

Invoice Meta
Type: {{ ucwords(str_replace('_', ' ', (string) $invoiceType)) }}
Company: {{ $tx->company?->name ?? '-' }}
@foreach ($tx->items as $key => $item) @endforeach
Invoice Details
# Product Qty Price Total
{{ $key + 1 }} {{ $item->product?->name ?? '-' }} {{ number_format((float) $item->quantity, 2) }} {{ number_format((float) $item->price, 2) }} {{ number_format((float) $item->total, 2) }}

Note:

This is computer generated invoice and does not require physical signature.