@php $total = (float) ($bill->supplier_bill_details_total ?? 0); $paid = (float) ($bill->supplier_bill_details_paid ?? 0); $returnedTotal = (float) ($bill->supplier_bill_details_returned_total ?? 0); $due = $total - $paid - $returnedTotal; $dueDisplay = max(0, $due); $status = $bill->supplier_bill_details_status ?? (($bill->supplier_bill_details_close_status ?? 0) == 1 ? 'closed' : 'open'); $paymentStatus = 'UNPAID'; if ($status === 'cancelled') { $paymentStatus = 'CANCELLED'; } elseif ($due <= 0.00001) { $paymentStatus = 'PAID'; } elseif ($paid > 0.00001 || $returnedTotal > 0.00001) { $paymentStatus = 'PARTIAL'; } @endphp
Reference No
{{ $bill->supplier_bill_details_billnumber }}
Date
{{ optional($bill->supplier_bill_details_create_date)->format('Y-m-d') }}
Location
{{ $bill->location->name ?? '' }}
Supplier
{{ $bill->supplier->supplier_name ?? '' }}
Purchase Status
{{ strtoupper($status) }}
Payment Status
{{ $paymentStatus }}
Grand Total
{{ number_format($total, 2) }}
Payment Due
{{ number_format($dueDisplay, 2) }}
Added By
{{ $bill->createdByUser->name ?? '' }}
@if(!empty($bill->supplier_bill_details_close_remark ?? null))
Note
{{ $bill->supplier_bill_details_close_remark }}
@endif
Items
@forelse($bill->items as $item) @php $lineTotal = (float) ($item->supp_bill_buy_price ?? 0) * (float) ($item->supp_bill_qty ?? 0); $productName = $item->product->name ?? $item->product->product_name ?? $item->product->product_code ?? null; $productSku = $item->product->sku ?? $item->product->product_code ?? null; $productBarcode = $item->product->barcode ?? null; @endphp @php $batchLabel = trim((string) ($item->supp_bill_batch_name ?? '')); if ($batchLabel === '') { $batchLabel = trim((string) ($item->badge->price_name ?? '')); } if ($batchLabel === '') { $batchLabel = (string) ($item->supp_bill_badge_id ?? ''); } @endphp @empty @endforelse
Product Batch MFD EXP Qty Unit Cost Line Total
{{ $productName ?? ('#'.(string) $item->supp_bill_product_id) }}
@if(!empty($productSku)) SKU: {{ $productSku }} @endif @if(!empty($productSku) && !empty($productBarcode)) ยท @endif @if(!empty($productBarcode)) Barcode: {{ $productBarcode }} @endif
{{ $batchLabel }} {{ optional($item->supp_bill_batch_mfg ?? null)->format('Y-m-d') }} {{ optional($item->supp_bill_batch_exp ?? null)->format('Y-m-d') }} {{ number_format((float) ($item->supp_bill_qty ?? 0), 3) }} {{ number_format((float) ($item->supp_bill_buy_price ?? 0), 2) }} {{ number_format($lineTotal, 2) }}
No items