@push('email-styles') @endpush @include('emails.partials.header', [ 'title' => 'Invoice ' . $invoice->invoice_number . ' – MJ VAC Services', 'containerClass' => 'invoice-email-container', 'containerStyle' => 'max-width:820px;margin:20px auto;background-color:#ffffff;padding:32px 36px;border-radius:8px;box-shadow:0 4px 8px rgba(0,0,0,0.1);', 'hideHeaderLogo' => true, ]) @php function numberToWordsEmail($number) { $ones = ['','One','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten', 'Eleven','Twelve','Thirteen','Fourteen','Fifteen','Sixteen','Seventeen','Eighteen','Nineteen']; $tens = ['','','Twenty','Thirty','Forty','Fifty','Sixty','Seventy','Eighty','Ninety']; if ($number == 0) return 'Zero'; $words = ''; $num = (int) $number; if ($num >= 1000) { $words .= numberToWordsEmail((int)floor($num/1000)) . ' Thousand '; $num %= 1000; } if ($num >= 100) { $words .= $ones[(int)floor($num/100)] . ' Hundred '; $num %= 100; } if ($num >= 20) { $words .= $tens[(int)floor($num/10)] . ' '; $num %= 10; } if ($num > 0) { $words .= $ones[$num] . ' '; } return trim($words); } $taxType = $invoice->tax_type ?? 'exclusive'; $overallDiscount = (float)($invoice->discount_amount ?? 0); $totals = \App\Models\Invoice::computeTotals($invoice->line_items, $taxType, $overallDiscount); $itemsSubtotal = $totals['itemsSubtotal']; $lineDiscountTotal = $totals['lineDiscountTotal']; $gstAmount = $totals['gstAmount']; $pstAmount = $totals['pstAmount']; $gstLabel = \App\Models\Invoice::taxSummaryLabel('GST', $totals['gstRateTotal'] ?? 0); $pstLabel = \App\Models\Invoice::taxSummaryLabel('HST/PST', $totals['pstRateTotal'] ?? 0); $totalExact = $totals['totalExact']; $totalRounded = $totals['totalRounded']; $roundedOff = $totals['roundedOff']; $showLineDiscount = $setting->usesLineItemDiscount(); $dueDate = $invoice->due_date ? $invoice->due_date->format('M d, Y') : $invoice->invoice_date->copy()->addDays(30)->format('M d, Y'); $rawNum = $invoice->invoice_number; $numOnly = ltrim(preg_replace('/^INV-0*/i', '', $rawNum), '0') ?: '0'; $displayNum = '#' . $numOnly; $termsContent = $setting->terms_conditions ?? ''; $termsHtml = (strip_tags($termsContent) === $termsContent) ? nl2br(e($termsContent)) : $termsContent; $metaLabel = 'padding:4px 0; color:#666666; font-size:12px;'; $metaValue = 'padding:4px 0; color:#111111; font-size:12px; font-weight:600; text-align:right;'; $rowLabel = 'padding:8px 16px; color:#666666; font-size:14px; border-bottom:1px solid #eeeeee;'; $rowValue = 'padding:8px 16px; color:#111111; font-size:14px; font-weight:600; text-align:right; border-bottom:1px solid #eeeeee;'; $itemLabel = 'padding:6px 0; color:#666666; font-size:13px;'; $itemValue = 'padding:6px 0; color:#111111; font-size:13px; font-weight:600; text-align:right;'; @endphp
Hi {{ $invoice->customer_name }},
Please find your invoice details below. A PDF copy is attached to this email.
{{-- Header: Logo | INVOICE | #num — matches PDF --}}
@if($setting->logo_path)
@endif
|
INVOICE |
{{ $displayNum }}
Original Copy
|
|
{{ $setting->business_name }}
@if($setting->address)
{{ $setting->address }} @endif
@if($setting->phone)Phone: {{ $setting->phone }} @endif
@if($setting->email)Email: {{ $setting->email }} @endif
@if($setting->website)Website: {{ $setting->website }} @endif
@foreach($setting->displayTaxNumbers($invoice->gst_number ?? null) as $taxLine)
{{ $taxLine['label'] }}: {{ $taxLine['value'] }}
@endforeach
|
|
|
Bill To
{{ $invoice->customer_name }}
@if($invoice->customer_phone){{ $invoice->customer_phone }} @endif
@if($invoice->customer_email){{ $invoice->customer_email }} @endif
@if($invoice->customer_address){{ $invoice->customer_address }} @endif
@if($invoice->customer_country){{ $invoice->customer_country }} @endif
|
| # | Item & Description | Qty | Price | @if($showLineDiscount)Disc% | @endif @if($taxType === 'exclusive')GST | HST/PST | @endifAmount |
|---|---|---|---|---|---|---|---|
| {{ $i + 1 }} |
{{ $item['description'] }}
@if($itemDesc)
{!! nl2br(e($itemDesc)) !!}
@endif
@if($loop->first && ($linkedItems = $invoice->linkedItemsLabel()))
Item(s): {{ $linkedItems }}
@endif
|
{{ $li['qty'] % 1 == 0 ? (int)$li['qty'] : $li['qty'] }} | ${{ number_format($li['displayRate'], 2) }} | @if($showLineDiscount)@if($li['discPct'] > 0) {{ number_format($li['discPct'], 0) }}% @else — @endif | @endif @if($taxType === 'exclusive')
@if($gstRateShow > 0)
${{ number_format($li['gstAmt'], 2) }} {{ number_format($gstRateShow, 0) }}% @else — @endif |
@if($li['pstRate'] > 0)
${{ number_format($li['pstAmt'], 2) }} {{ number_format($li['pstRate'], 0) }}% @else — @endif |
@endif
${{ number_format($li['rowAmt'], 2) }} |
@if($termsContent)
Please send E-Transfer payment to {{ $setting->email }}. @endif |
* {{ numberToWordsEmail($totalRounded) }} Dollars Only |