{{ $sale->branch?->name ?: 'JEVAPOS' }}

@if($showBranchDetails)

{{ $sale->branch?->address }}

{{ $sale->branch?->phone }}

{{ $sale->branch?->email }}

@endif @if($businessTaxPin)

PIN: {{ $businessTaxPin }}

@endif

{{ $documentTitle }}

{{ $documentTitle }} No: {{ $sale->invoice_no }}

Date: {{ $sale->sale_date?->format('Y-m-d H:i') }}

@if($showCashierName)

Cashier: {{ $sale->user?->name }}

@endif @if($showCustomerDetails)

Customer: {{ $sale->customer?->name ?: ($sale->customer_name ?: '-') }}

@if($showCustomerPin && $sale->customer?->tax_pin)

Customer PIN: {{ $sale->customer->tax_pin }}

@endif @endif
@foreach($sale->items as $item) @endforeach
Item Qty Price Total
{{ $item->product_name }}@if(\App\Services\ReceiptPresentationService::enabled('show_inline_vat_receipt'))
{{ \App\Models\TaxRate::typeLabel($item->tax_type,$item->tax_rate) }}: {{ \App\Models\SystemSetting::formatMoney($item->tax_amount) }}
@endif
{{ \App\Models\SystemSetting::formatNumber($item->quantity) }} {{ \App\Models\SystemSetting::formatMoney($item->unit_price) }} {{ \App\Models\SystemSetting::formatMoney($item->line_total) }}
@if($showDiscount)@endif @if($showTaxSummary) @php $receiptTaxSummary = $sale->items->groupBy(function ($item) { $type = $item->tax_type ?: ($item->product?->taxRate?->tax_type ?: $item->product?->vat_type ?: 'non_taxable'); $rate = (float) ($item->tax_rate ?: $item->product?->taxRate?->rate ?: $item->product?->vat_rate ?: 0); return $type.'|'.number_format($rate, 2, '.', ''); }); @endphp @foreach($receiptTaxSummary as $key => $items) @php([$type, $rate] = explode('|', $key)) @if(in_array($type, ['exempt', 'zero_rated', 'non_vat', 'non_taxable'], true)) @else @endif @endforeach @endif @if((float) $sale->balance_amount > 0) @endif @if(\App\Services\ReceiptPresentationService::enabled('show_payment_status_receipt','yes'))@endif @if($sale->customer_id && $sale->customer_id!=1 && \App\Services\ReceiptPresentationService::enabled('show_previous_balance_receipt'))@endif @if($sale->customer_id && $sale->customer_id!=1 && \App\Services\ReceiptPresentationService::enabled('show_total_balance_receipt'))@endif
{{ $showTaxSummary ? 'Taxable Amount' : 'Subtotal' }}{{ \App\Models\SystemSetting::formatMoney($sale->subtotal) }}
Discount{{ \App\Models\SystemSetting::formatMoney($sale->discount_amount) }}
{{ str($type)->replace('_', ' ')->title() }} Sales{{ \App\Models\SystemSetting::formatMoney($items->sum('line_total')) }}
{{ $items->first()->tax_name ?: 'VAT '.number_format((float) $rate, 2).'%' }}{{ \App\Models\SystemSetting::formatMoney($items->sum('tax_amount')) }}
Total{{ \App\Models\SystemSetting::formatMoney($sale->total_amount) }}
Tendered{{ \App\Models\SystemSetting::formatMoney($sale->tendered_amount) }}
Outstanding Balance{{ \App\Models\SystemSetting::formatMoney($sale->balance_amount) }}
Payment Status{{ ucfirst($sale->payment_status) }}
Previous Balance{{ \App\Models\SystemSetting::formatMoney($sale->receipt_previous_balance) }}
Total Balance{{ \App\Models\SystemSetting::formatMoney($sale->receipt_total_balance) }}
Change{{ \App\Models\SystemSetting::formatMoney($sale->change_amount) }}
@if($sale->payments->isNotEmpty())
@foreach($sale->payments as $payment) @if($payment->reference_no) @endif @endforeach
{{ $payment->paymentMethod?->name ?: 'Payment' }} {{ \App\Models\SystemSetting::formatMoney($payment->amount) }}
{{ str_contains(strtolower($payment->paymentMethod?->name ?? ''), 'mpesa') || str_contains(strtolower($payment->paymentMethod?->name ?? ''), 'm-pesa') ? 'M-Pesa Transaction Code' : 'Transaction Code' }}: {{ $payment->reference_no }}
@endif @if($showEtimsDetails && $sale->latestEtimsDocument) @php($etims = $sale->latestEtimsDocument)
@if($etims->environment === 'demo')

eTIMS DEMONSTRATION

NOT A KRA FISCAL INVOICE

@endif

eTIMS Status: {{ strtoupper($etims->status) }}

@if($etims->control_unit_invoice_no)

{{ $etims->environment === 'demo' ? 'Demo' : 'Control Unit' }} Invoice No: {{ $etims->control_unit_invoice_no }}

@endif @if($etims->kra_receipt_no)

{{ $etims->environment === 'demo' ? 'Demo' : 'Fiscal' }} Receipt No: {{ $etims->kra_receipt_no }}

@endif @if($etims->sdc_id)

SDC ID: {{ $etims->sdc_id }}

@endif @if($etims->internal_data)

Internal Data: {{ $etims->internal_data }}

@endif @if($etims->receipt_signature)

Receipt Signature: {{ $etims->receipt_signature }}

@endif @if($etimsQrCode) eTIMS verification QR code

Scan to verify

@endif @if($etims->verification_url)

Verify: {{ $etims->verification_url }}

@endif @if($etims->status === 'failed' && $etims->error_message)

eTIMS Error: {{ $etims->error_message }}

@endif @endif
{!! \App\Services\ReceiptPresentationService::footer($receiptFooter) !!}