@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
Glossy IT
INVOICE
Invoice # {{ $number }}
Invoice Date: {{ $issued->format('M d, Y') }}
Due Date: {{ $issued->format('M d, Y') }}
Bill From
GLOSSY IT
2nd Floor, H 549, Rd 8, Ave 6,
Mirpur DOHS, Dhaka 1216,
Dhaka Division, Bangladesh
+8801718828272
Bill To
{{ $billToName }}
@foreach ($billToLines as $line) {{ $line }}
@endforeach
@forelse ($rows as $index => $row) @empty @endforelse
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) }}
@if ($invoice->status === 'paid') @elseif ($invoice->status === 'carried_forward') @endif
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 }}

@else

Please pay this invoice in BDT. Contact us if you have any questions about this bill.

@endif

Thank you for your business!

2nd Floor, House 549, Road 08, Avenue 06, Mirpur DOHS, Dhaka - 1216, Bangladesh
Hotline: +8809638-400200, Phone: +8801811-548379, Mobile: +8801718-828272
Email: info@glossyit.com Website: www.glossyit.com