@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 --}} {{-- From (left) + Amount Due & invoice meta (right) — matches PDF layout --}} {{-- Bill To (full width) --}}
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
Invoice Items
{{-- Desktop: table layout --}}
@if($showLineDiscount) @endif @if($taxType === 'exclusive') @endif @foreach($invoice->line_items as $i => $item) @php $li = \App\Models\Invoice::computeLineItem($item, $taxType); $itemDesc = $invoice->lineItemDescriptionForDisplay($item, $loop->first); $gstRateShow = $li['gstRate'] > 0 || ($li['gstRate'] + $li['pstRate'] === 0.0 && ($item['tax_rate'] ?? 0) > 0) ? ($li['gstRate'] + $li['pstRate'] === 0.0 ? ($item['tax_rate'] ?? 0) : $li['gstRate']) : 0; @endphp @if($showLineDiscount) @endif @if($taxType === 'exclusive') @endif @endforeach
# Item & Description Qty PriceDisc%GST HST/PSTAmount
{{ $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($li['discPct'] > 0) {{ number_format($li['discPct'], 0) }}% @else @endif @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
${{ number_format($li['rowAmt'], 2) }}
{{-- Mobile: card layout --}} {{-- Summary + Terms (side by side on desktop) --}}
@include('emails.partials.footer')