@php $thermal = \App\Models\SystemSetting::getValue('grn_template', 'a4') === 'thermal'; $taxSummary = $purchase->items->groupBy(fn ($item) => ($item->tax_type ?: 'non_taxable').'|'.number_format((float) $item->tax_rate, 2, '.', '')); @endphp GRN {{ $purchase->purchase_no }}

Goods Received Note

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

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

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

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

GRN No: {{ $purchase->purchase_no }}

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

Supplier: {{ $purchase->supplier_name ?: '-' }}

@if($thermal && $purchase->supplier_invoice_no)

Supplier Invoice: {{ $purchase->supplier_invoice_no }}

@endif

Received By: {{ $purchase->user?->name ?: '-' }}

@if($thermal) @php $currency = \App\Models\SystemSetting::currencyCode(); $exchangeRate = \App\Models\SystemSetting::exchangeRate(); $amount = fn ($value) => number_format((float) $value * $exchangeRate, 2); $money = fn ($value) => $currency.' '.$amount($value); @endphp

Prices in {{ $currency }}

@foreach($purchase->items as $item) @php $barcode = $item->barcode ?: $item->product?->barcode; // Purchases save this same amount as the product's buying price. $buyingPrice = $item->unit_cost_after_tax; if ($buyingPrice === null || ((float) $buyingPrice === 0.0 && $item->line_total > 0)) { $buyingPrice = $item->quantity > 0 ? $item->line_total / $item->quantity : $item->unit_cost; } @endphp @endforeach
ProductQtyPriceTotal
{{ $item->product_name }}@if($barcode){{ $barcode }}@endif {{ rtrim(rtrim(number_format($item->quantity, 2), '0'), '.') }}@if($item->uom){{ $item->uom }}@endif {{ $amount($buyingPrice) }} {{ $amount($item->line_total) }}

VAT Summary

@foreach($taxSummary as $key => $items) @php([$type, $rate] = explode('|', $key))

{{ \App\Models\TaxRate::typeLabel($type, $rate) }}

Before VAT
{{ $money($items->sum('line_total') - $items->sum('tax_amount')) }}
VAT
{{ $money($items->sum('tax_amount')) }}
After VAT
{{ $money($items->sum('line_total')) }}
@endforeach
GRN Total
{{ $money($purchase->total_amount) }}
@if(filled($purchase->note))

Note: {{ $purchase->note }}

@endif @else @foreach($purchase->items as $item) @endforeach
Barcode Product Qty Received B.Price Before VAT VAT Type VAT Amount B.Price After VAT Total
{{ $item->barcode ?: ($item->product?->barcode ?: '-') }} {{ $item->product_name }} {{ number_format($item->quantity, 2) }} {{ \App\Models\SystemSetting::formatMoney($item->unit_cost) }} {{ \App\Models\TaxRate::typeLabel($item->tax_type ?: 'non_taxable', $item->tax_rate) }} {{ \App\Models\SystemSetting::formatMoney($item->tax_amount) }} {{ \App\Models\SystemSetting::formatMoney($item->unit_cost_after_tax) }} {{ \App\Models\SystemSetting::formatMoney($item->line_total) }}
Totals {{ number_format($purchase->items->sum('quantity'), 2) }} {{ \App\Models\SystemSetting::formatMoney($purchase->items->sum('tax_amount')) }} {{ \App\Models\SystemSetting::formatMoney($purchase->items->sum('line_total')) }}
@foreach($taxSummary as $key => $items) @php([$type, $rate] = explode('|', $key)) @endforeach
VAT SummaryBefore VATVATAfter VAT
{{ \App\Models\TaxRate::typeLabel($type, $rate) }} {{ \App\Models\SystemSetting::formatMoney($items->sum(fn ($item) => (float) $item->line_total - (float) $item->tax_amount)) }} {{ \App\Models\SystemSetting::formatMoney($items->sum('tax_amount')) }} {{ \App\Models\SystemSetting::formatMoney($items->sum('line_total')) }}
@endif