@php use App\Support\TakaWords; $number = $number ?? ($invoice->external_id ?? $invoice->id); if (! isset($billToName)) { $billToName = method_exists($invoice, 'company') ? (string) ($invoice->company->name ?? '') : ''; } if (! isset($billToLines)) { $billToLines = method_exists($invoice, 'company') ? array_values(array_filter([$invoice->company->base_url ?? null])) : []; } $issued = ($invoice->created_at ?? now())->timezone('Asia/Dhaka'); $gross = (float) $invoice->total; $due = $invoice->status === 'unpaid' ? $gross : 0.0; $rows = []; foreach ($invoice->lines as $line) { $amount = (float) $line->amount; $qty = 1; $price = $amount; if (preg_match('/\((\d+) active users × ([0-9,]+\.\d{2})\)/', (string) $line->description, $match)) { $count = (int) $match[1]; $fee = (float) str_replace(',', '', $match[2]); if ($count > 0 && $fee > 0 && abs(($count * $fee) - $amount) < 0.02) { $qty = $count; $price = $fee; } } $rows[] = [ 'description' => $line->description, 'qty' => $qty, 'price' => $price, 'total' => $amount, ]; } $logo = ($forPdf ?? false) ? str_replace('\\', '/', public_path('images/glossyit-logo.png')) : asset('images/glossyit-logo.png'); $money = fn ($amount) => number_format((float) $amount, 2, '.', ','); @endphp
|
|
INVOICE
Invoice # {{ $number }}
Invoice Date: {{ $issued->format('M d, Y') }}
Due Date: {{ $issued->format('M d, Y') }}
|
|
Bill From
GLOSSY IT2nd Floor, H 549, Rd 8, Ave 6, Mirpur DOHS, Dhaka 1216, Dhaka Division, Bangladesh +8801718828272 |
Bill To
{{ $billToName }}@foreach ($billToLines as $line) {{ $line }} @endforeach |
| ID | DESCRIPTION | QTY | PRICE | TOTAL |
|---|---|---|---|---|
| {{ sprintf('%02d', $index + 1) }} | {{ $row['description'] }} | {{ $row['qty'] }} | {{ $money($row['price']) }} | {{ $money($row['total']) }} |
| 01 | {{ $invoice->type === 'installation' ? 'Installation fee' : 'Monthly subscription' }} | 1 | {{ $money($gross) }} | {{ $money($gross) }} |
| Total | {{ $money($gross) }} | |
| Paid | {{ $money($gross) }} | |
| Carried Forward | {{ $money($gross) }} | |
| Total Due | {{ $money($due) }} |
In Words: {{ TakaWords::format($due) }}
@if ($invoice->payment_note){{ $invoice->payment_note }}
@elsePlease pay this invoice in BDT. Contact us if you have any questions about this bill.
@endifThank you for your business!