@php $taxGroups = $sale->items->groupBy('tax_percent'); $hasTax = $sale->tax_total > 0; @endphp
{{-- ═══ HEADER ═══ --}}
Tax Invoice / Cash Memo
@if($company->logo_path) @endif
{{ $company->legal_name ?? $company->name }}
Manufacturers, Exporters & Importers
{{ $company->billing_address }}
Ph: {{ $company->phone }}
{{-- ═══ BUYER GSTIN ROW ═══ --}}
M/s. {{ $sale->party->name }} @if($sale->party->billing_address) — {{ $sale->party->billing_address }} @endif
Buyer's GSTIN: {{ $sale->party->gst_number ?? '' }}
No. {{ $sale->bill_no }} Date: {{ $sale->invoice_date->format('d/m/Y') }}
{{-- ═══ BUYER NAME ROW ═══ --}}
{{-- ═══ ITEMS TABLE ═══ --}} @foreach($sale->items as $index => $item) @endforeach {{-- Filler rows --}} @php $maxRows = 12; $usedSlots = 0; foreach ($sale->items as $itm) { $usedSlots += strlen($itm->product->name ?? 'Product') > 28 ? 2 : 1; } $fillerRows = max(0, $maxRows - $usedSlots); @endphp @for($f = 0; $f < $fillerRows; $f++) @endfor
QTY ITEM HSN RATE AMOUNT
{{ indian_number($item->qty, 0) }} {{ strtolower($item->unit) }} {{ $item->product->name ?? 'Product' }} {{ $item->hsn ?: ($item->product->hsn ?? '') }} {{ indian_number($item->rate, 2) }} {{ indian_number($item->line_amount, 2) }}
 
{{-- ═══ TOTALS ═══ --}} {{-- Sub Total --}} {{-- Tax lines (SGST + CGST per rate) --}} @if($hasTax) @foreach($taxGroups as $rate => $items) @if($rate > 0) @endif @endforeach @endif {{-- P&F --}} @if($sale->pf_amount > 0) @endif {{-- Adjustment (+ deducts, − adds) --}} @if(($sale->discount ?? 0) != 0) @endif {{-- Round Off --}} @if($sale->roundoff != 0) @endif {{-- Grand Total --}}
@if($sale->dispatched_through || $sale->party->transportation_name) Transport: {{ $sale->dispatched_through ?? $sale->party->transportation_name }}
@endif @if($sale->remarks) Narration: {{ $sale->remarks }} @endif
Sub Total {{ indian_number($sale->amount_total, 2) }}
SGST @ {{ indian_number($rate / 2, 1) }}% {{ indian_number($items->sum('line_tax_amount') / 2, 2) }}
CGST @ {{ indian_number($rate / 2, 1) }}% {{ indian_number($items->sum('line_tax_amount') / 2, 2) }}
P&F {{ indian_number($sale->pf_amount, 2) }}
Adjustment {{ $sale->discount > 0 ? '(-)' : '(+)' }}{{ indian_number(abs($sale->discount), 2) }}
R.Off {{ $sale->roundoff < 0 ? '(-)' : '' }}{{ indian_number(abs($sale->roundoff), 2) }}
Grand Total (Rs.) {{ indian_number($sale->grand_total, 2) }}
{{-- ═══ FOOTER ═══ --}}