Per-Location Availability

@if(isset($grandTotals))
Grand totals (all pages, current filters)
Qty: {{ (int)($grandTotals->qty ?? 0) }} Value +: ₦{{ number_format((float)($grandTotals->pos_value ?? 0), 2) }} Value -: ₦{{ number_format((float)($grandTotals->neg_value ?? 0), 2) }} Current valuation: ₦{{ number_format((float)($currentValuation ?? 0), 2) }}
@endif @php // Build chart data: sum qty per location from current page rows $chartByLocation = []; foreach ($rows as $r) { $lname = $r->location_name ?? 'Unassigned'; $chartByLocation[$lname] = ($chartByLocation[$lname] ?? 0) + (int)$r->qty; } $chartMax = max(1, collect($chartByLocation)->max() ?? 1); @endphp @if(count($chartByLocation))

Totals by Location (current page)

Simple inline chart
@php $i=0; @endphp @foreach($chartByLocation as $locName => $total) @php $barWidth = $chartMax > 0 ? (int)( ($total / $chartMax) * 520 ) : 0; @endphp {{ Str::limit($locName, 14) }} {{ $total }} @php $i++; @endphp @endforeach
@endif
@php // Build totals by dish from the current page rows (UI-level). For full totals, export CSV. $totalsByDish = []; $pageTotalQty = 0; $pageTotalValue = 0.0; foreach ($rows as $r) { $key = $r->dish_id.'|'.$r->dish_name; if (!isset($totalsByDish[$key])) { $totalsByDish[$key] = 0; } $totalsByDish[$key] += (int)$r->qty; $pageTotalQty += (int)$r->qty; $pageTotalValue += max(0, (int)$r->qty) * (float)$r->price; } @endphp
@php $currentDishKey = null; @endphp @forelse($rows as $row) @php $dishKey = $row->dish_id.'|'.$row->dish_name; @endphp @if($currentDishKey !== $dishKey) @php $currentDishKey = $dishKey; @endphp @endif @empty @endforelse
Dish Location Qty Threshold Value
{{ $row->dish_name }} — Total across locations (this page): {{ (int)($totalsByDish[$dishKey] ?? 0) }} All locations total:
ID: {{ $row->dish_id }}
{{ $row->location_name ?? '—' }} {{ (int)$row->qty }} {{ (int)$row->low_stock_threshold }} ₦{{ number_format(max(0, (int)$row->qty) * (float)$row->price, 2) }}
No data
Page totals
Qty: {{ (int)$pageTotalQty }} Value: ₦{{ number_format($pageTotalValue, 2) }}
{{ $rows->links() }}
@push('scripts') @endpush