@push('header') @endpush {{-- All products encoded for dynamic supplier→product filtering --}}
@if(!$hasFilter) @elseif($stocks->isEmpty()) @else @foreach ($stocks as $stock) @php $batches = $stock->relationLoaded('batches') ? $stock->batches : collect(); $batchCount = $batches->count(); @endphp @php $batchesJson = $batches->map(fn($b) => [ 'batch_code' => $b->stockBatch?->batch_code ?? '—', 'receipt_date' => $b->stockBatch?->receipt_date ? \Carbon\Carbon::parse($b->stockBatch->receipt_date)->format('d-M-Y') : '—', 'quantity' => rtrim(rtrim(number_format($b->quantity_on_hand, 2), '0'), '.'), 'unit_cost' => $b->quantity_on_hand > 0 ? rtrim(rtrim(number_format($b->total_value / $b->quantity_on_hand, 6), '0'), '.') : rtrim(rtrim(number_format($b->unit_cost, 6), '0'), '.'), 'selling_price' => $b->stockBatch?->selling_price ? number_format($b->stockBatch->selling_price, 2) : null, 'total_value' => number_format($b->total_value, 2), 'is_promotional' => $b->is_promotional, 'promotional_price' => $b->promotional_price ? number_format($b->promotional_price, 2) : null, 'status' => $b->status, 'priority_order' => $b->priority_order, ])->values()->toArray(); $productLabel = trim($stock->product->product_code) . ' - ' . $stock->product->product_name; @endphp {{-- Total Value — clickable if batches loaded --}} @endforeach @endif @if($hasFilter) @endif
# Product Warehouse Qty On Hand Qty Available Total Value Batches Actions
Apply filters above to view inventory.
No stock found.
{{ $loop->iteration + ($stocks->currentPage() - 1) * $stocks->perPage() }} {{ trim($stock->product->product_code) }} - {{ $stock->product->product_name }} {{ $stock->warehouse->warehouse_name }} {{ rtrim(rtrim(number_format($stock->quantity_on_hand, 2), '0'), '.') }} {{ rtrim(rtrim(number_format($stock->quantity_available, 2), '0'), '.') }} @if($batchCount > 0) {{ number_format($stock->total_value, 2) }} @else ₨ {{ number_format($stock->total_value, 2) }} @endif {{ $stock->total_batches }} @if($stock->promotional_batches > 0) P:{{ $stock->promotional_batches }} @endif @if($stock->priority_batches > 0) !:{{ $stock->priority_batches }} @endif View Batches
Grand Total: {{ rtrim(rtrim(number_format($stocks->sum('quantity_on_hand'), 2), '0'), '.') }} {{ rtrim(rtrim(number_format($stocks->sum('quantity_available'), 2), '0'), '.') }} ₨ {{ number_format($stocks->sum('total_value'), 2) }} {{ $stocks->sum('total_batches') }}
@if($stocks->hasPages())
{{ $stocks->withQueryString()->links() }}
@endif
{{-- Batch Cost Modal --}} @push('scripts') @endpush