@php $companyLogo = $companyLogo ?? ''; $companyName = $companyName ?? ''; $companyAddress = $companyAddress ?? ''; $companyPhone = $companyPhone ?? ''; $companyEmail = $companyEmail ?? ''; $companyTaxCode = $companyTaxCode ?? ''; $brandColor = $brandColor ?? '#1a56db'; $cfg = array_merge([ 'accent_color' => $brandColor, 'show_logo' => true, 'show_company_info' => true, 'show_customer_info' => true, 'show_order_info' => true, 'show_items_table' => true, 'show_summary' => true, 'show_note' => true, 'footer_text' => 'Cảm ơn quý khách đã sử dụng dịch vụ.', 'footer_note' => 'Đây là hóa đơn điện tử được tạo tự động, không cần chữ ký số.', ], $cfg ?? []); @endphp Hóa đơn #{{ $invoice->invoice_number }}
{{-- ══ HEADER ══ --}}
@if(($cfg['show_logo'] ?? true) && $companyLogo) {{ $companyName }} @endif

HÓA ĐƠN ĐẶT HÀNG

(INVOICE ORDER)

@if($order) @endif
Mã hóa đơn: {{ $invoice->invoice_number }}
Mã đơn hàng: {{ $order->order_num }}
Hạn thanh toán: {{ $invoice->due_date ? \Carbon\Carbon::parse($invoice->due_date)->format('d/m/Y') : '—' }}
Trạng thái: @if($invoice->status == 2)Đã thanh toán @elseif($invoice->status == 1)Chưa thanh toán @elseĐã hủy@endif

{{-- ══ COMPANY ══ --}} @if($cfg['show_company_info'] ?? true)

{{ $companyName }}

@if($companyTaxCode)
Mã số thuế (Tax code): {{ $companyTaxCode }}
@endif @if($companyAddress)
Địa chỉ (Address): {{ $companyAddress }}
@endif @if($companyPhone)
Điện thoại (Tel): {{ $companyPhone }}
@endif @if($companyEmail)
Email: {{ $companyEmail }}
@endif

@endif {{-- ══ BUYER ══ --}} @if($cfg['show_customer_info'] ?? true)
Họ tên người mua hàng (Buyer): {{ $customer?->fullname ?? '—' }}
@if($customer?->company)
Tên đơn vị: {{ $customer->company }}
@endif @if($customer?->identity_number)
MST / CMND: {{ $customer->identity_number }}
@endif @if($customer?->address)
Địa chỉ (Address): {{ $customer->address }}
@endif
Hình thức thanh toán: {{ $invoice->payment_method ? strtoupper($invoice->payment_method) : 'TM/CK' }}
Email: {{ $customer?->email ?? '—' }}
@endif {{-- ══ ITEMS TABLE ══ --}} @if($cfg['show_items_table'] ?? true) @foreach($invoiceItems as $i => $item) @endforeach @if($cfg['show_summary'] ?? true) {{-- Sub-total --}} @if($invoice->discount_amount > 0) @endif @php $taxRate = ($invoice->total > 0 && $invoice->tax > 0) ? round($invoice->tax / ($invoice->total - $invoice->tax) * 100) : 0; @endphp @endif
STT Tên hàng hóa, dịch vụ Đơn vị tính Số lượng Đơn giá (đ) Thành tiền (đ)
{{ $i + 1 }} {{ $item->description ?? ($item->product?->name ?? 'Dịch vụ') }} {{ ($item->months && $item->months > 0) ? 'Tháng' : 'Lần' }} {{ number_format($item->quantity ?? 1, 2, ',', '.') }} {{ number_format($item->unit_price, 0, ',', '.') }} {{ number_format($item->total_price, 0, ',', '.') }}
Cộng tiền hàng (Total amount excl. VAT) {{ number_format($invoice->sub_total, 0, ',', '.') }}
Giảm giá (Discount) -{{ number_format($invoice->discount_amount, 0, ',', '.') }}
Thuế suất GTGT (VAT rate): {{ $taxRate > 0 ? $taxRate.'%' : 'Không áp dụng' }} Tiền thuế GTGT (VAT amount) {{ number_format($invoice->tax, 0, ',', '.') }}
Tổng tiền thanh toán (Total amount) {{ number_format($invoice->total, 0, ',', '.') }}
Số tiền viết bằng chữ (Total amount in words): {{ \App\Helpers\NumberToWords::convert((int) $invoice->total) }}.
@endif {{-- ══ NOTE ══ --}} @if(($cfg['show_note'] ?? true) && $invoice->note)
Ghi chú: {{ $invoice->note }}
@endif {{-- ══ SIGNATURE ══ --}}

Người mua hàng
(Buyer's signature)

Ký, ghi rõ họ tên

{{ $customer?->fullname ?? '' }}

Người bán hàng
(Seller's signature)

Ký, đóng dấu, ghi rõ họ tên

{{ $companyName }}

{{-- ══ FOOTER ══ --}}