Receipt No:
{{ $data['invoice_no'] ?? $data['receipt_no'] ?? 'N/A' }}
Date:
{{ $data['date'] ?? date('Y-m-d') }}
Time:
{{ $data['time'] ?? date('H:i:s') }}
Cashier:
{{ $data['cashier'] ?? 'Cashier' }}
Customer:
{{ $customerName }}
@if(!empty($customer['phone']))
Phone:
{{ $customer['phone'] }}
@endif
@if(!empty($customer['vat_number']))
VAT No:
{{ $customer['vat_number'] }}
@endif
VAT Status:
{{ $isExempted ? 'EXEMPTED' : ($isZeroRated ? 'ZERO-RATED' : 'VATABLE') }}
@if($customerName === 'Walk-in Customer')
Customer:
Walk-in Customer
@endif
ITEMS
@if(count($items) > 0)
@foreach($items as $item)
@php
$quantity = $item['quantity'] ?? 1;
$unitPrice = $item['price'] ?? $item['unit_price'] ?? 0;
$itemTotal = $unitPrice * $quantity;
$taxRate = $item['tax_rate'] ?? 0;
$isItemVatable = $item['is_vatable'] ?? ($taxRate > 0);
@endphp
{{ $item['name'] ?? 'Product' }}
{{ $quantity }}
{{ number_format($unitPrice, 2) }}
{{ number_format($itemTotal, 2) }}
@if($isItemVatable && $taxRate > 0 && ($item['tax_amount'] ?? 0) > 0)
VAT {{ $taxRate }}%
KES {{ number_format($item['tax_amount'] ?? 0, 2) }}
@endif
@endforeach
@else
@endif
TOTALS
Subtotal:
KES {{ number_format($subtotal, 2) }}
@if($discount > 0)
Discount:
-KES {{ number_format($discount, 2) }}
@endif
@if(!$isExempted && !empty($vatBreakdown))
VAT BREAKDOWN
Amount
@foreach($vatBreakdown as $details)
@php
// Safely get values with defaults
$rate = $details['rate'] ?? 0;
$taxableAmt = $details['taxable_amount'] ?? $details['taxableAmount'] ?? 0;
$vatAmt = $details['vat_amount'] ?? $details['amount'] ?? 0;
$type = $details['type'] ?? 'standard';
@endphp
@if($taxableAmt > 0 && $rate >= 0)
@if($type === 'zero_rated')
Zero-Rated (0%)
@else
VAT {{ $rate }}%
@endif
on KES {{ number_format($taxableAmt, 2) }}:
KES {{ number_format($vatAmt, 2) }}
@endif
@endforeach
@if($vatAmount > 0)
Total VAT:
KES {{ number_format($vatAmount, 2) }}
@endif
@endif
@if($taxableAmount > 0 || $zeroRatedAmount > 0 || $exemptedAmount > 0 || $nonTaxableAmount > 0)
@if($taxableAmount > 0)
Taxable Amount:
KES {{ number_format($taxableAmount, 2) }}
@endif
@if($zeroRatedAmount > 0)
Zero-Rated Amount:
KES {{ number_format($zeroRatedAmount, 2) }}
@endif
@if($exemptedAmount > 0)
Exempted Amount:
KES {{ number_format($exemptedAmount, 2) }}
@endif
@if($nonTaxableAmount > 0)
Non-Taxable Amount:
KES {{ number_format($nonTaxableAmount, 2) }}
@endif
@endif
@if($vatAmount > 0 && !$isExempted)
VAT Amount:
KES {{ number_format($vatAmount, 2) }}
@endif
TOTAL:
KES {{ number_format($grandTotal, 2) }}
PAYMENT
{{ strtoupper($paymentMethod) }}
Amount Paid: KES {{ number_format($amountPaid, 2) }}
@if($paymentMethod === 'cash' && isset($payment['cash_received']))
Cash Received: KES {{ number_format($payment['cash_received'], 2) }}
@endif
@if($change > 0)
Change: KES {{ number_format($change, 2) }}
@endif
@if($transactionId)
Transaction ID: {{ $transactionId }}
@endif
@if($mpesaDetails)
Phone: {{ $mpesaDetails['phone'] ?? '' }}
@if(!empty($mpesaDetails['receipt_no']))
M-Pesa Receipt: {{ $mpesaDetails['receipt_no'] }}
@endif
@endif
@endif
@if($isExempted || $isZeroRated)