@php // Company info comes from selected client brand address (dynamic, admin-managed). $brandAddress = $invoice->client->brandAddress; $brandEntity = $invoice->client->brandEntity; $company = [ 'name' => $brandEntity?->name ?? $invoice->client->brand ?? config('app.name'), 'address' => $brandAddress?->address_line ?? '-', 'city' => $brandAddress?->city ?? '', 'email' => $brandAddress?->email ?? '-', ]; // Invoice calculations $items = $invoice->items ?? collect(); $subtotal = $items->count() ? $items->sum('total') : $invoice->amount; // Calculate discount $discountType = $invoice->discount_type; $discountValue = $invoice->discount_value ?? 0; $discountAmount = $invoice->discount_amount ?? 0; // Apply discount to subtotal $subtotalAfterDiscount = $subtotal - $discountAmount; // Use dynamic tax from invoice, or calculate if not set $taxRate = $invoice->tax_rate ?? 0; $tax = $invoice->tax_amount ?? ($subtotalAfterDiscount * $taxRate / 100); $total = $subtotalAfterDiscount + $tax; // Balance amount (if set) $balanceAmount = $invoice->balance_amount; $currency = strtoupper($invoice->currency); @endphp
{{-- Optional Logo --}} {{-- Company Logo --}}
{{ $company['name'] }}
{{ $company['address'] }}
{{ $company['city'] }}
{{ $company['email'] }}

INVOICE

Invoice #: {{ $invoice->id }}
Date: {{ $invoice->created_at->format('F d, Y') }}
Status: {{ ucfirst($invoice->status) }}
Bill To
Name: {{ $invoice->client->name }}
Email: {{ $invoice->client->email }}
@if($invoice->client->phone)
Phone: {{ $invoice->client->phone }}
@endif
Invoice Details
@if($items->count()) @foreach($items as $item) @endforeach @else @endif
Description Qty Unit Price Amount
{{ $item->description }} {{ $item->quantity }} {{ $currency }} {{ number_format($item->unit_price, 2) }} {{ $currency }} {{ number_format($item->total, 2) }}
Professional Service Charges 1 {{ $currency }} {{ number_format($subtotal, 2) }} {{ $currency }} {{ number_format($subtotal, 2) }}
@if($discountAmount > 0) @endif @if($taxRate > 0) @endif @if($balanceAmount !== null && $balanceAmount > 0) @endif
Subtotal: {{ $currency }} {{ number_format($subtotal, 2) }}
Discount @if($discountType === 'percent') ({{ number_format($discountValue, 2) }}%) @endif : -{{ $currency }} {{ number_format($discountAmount, 2) }}
Subtotal After Discount: {{ $currency }} {{ number_format($subtotalAfterDiscount, 2) }}
VAT/Tax ({{ number_format($taxRate, 2) }}%): {{ $currency }} {{ number_format($tax, 2) }}
Total: {{ $currency }} {{ number_format($total, 2) }}
Balance Amount: {{ $currency }} {{ number_format($balanceAmount, 2) }}
Authorized Signature
{{ $company['name'] }}