@extends('layouts.app') @section('title', __('lang_v1.current_stock')) @section('content')

@lang('lang_v1.current_stock') @lang('lang_v1.supplier_portal')

@if(! $is_warehouse)

@lang('lang_v1.warehouse_not_provisioned')

@else

@lang('lang_v1.current_stock') — {{ $business->name }}

@lang('lang_v1.warehouse_stock_help')

{{-- On-hand is not the same as shippable: inbound batches sit in Goods QC until passed, and recalled batches never ship. These two columns show that split so this page agrees with the Available to Promise figure on order approval. --}} @forelse($rows as $r) @php $base = (float) $r->base_qty; $m = ! empty($r->purchase_multiplier) ? (float) $r->purchase_multiplier : null; $purchaseQty = $m ? $base / $m : null; // Supplier min/max are summed store base-unit values; show in the // purchase unit (ceil min so we never under-provision, floor max). $minBase = (float) ($r->supplier_min ?? 0); $maxBase = (float) ($r->supplier_max ?? 0); $minPU = $m ? ceil($minBase / $m) : $minBase; $maxPU = $m ? floor($maxBase / $m) : $maxBase; $below = $m ? ($purchaseQty < $minPU) : ($base < $minBase); @endphp @php $blocked = (float) ($r->blocked_qty ?? 0); $reserved = (float) ($r->reserved_qty ?? 0); $dispatchable = max(0, $base - $blocked); $atp = $dispatchable - $reserved; @endphp @empty @endforelse
@lang('sale.product') @lang('lang_v1.stock_in_purchase_unit') @lang('lang_v1.supplier_min') @lang('lang_v1.supplier_max') @lang('lang_v1.stock_in_base_unit')@lang('lang_v1.in_qc') @lang('lang_v1.dispatchable') @lang('lang_v1.reserved') @lang('lang_v1.available_to_promise')
{{ $r->product_name }} @if(!empty($r->variation_name) && $r->variation_name !== 'DUMMY') ({{ $r->variation_name }})@endif @if($m) {{ @format_quantity($purchaseQty) }} {{ $r->purchase_unit }} @else @endif @if($m) {{ @format_quantity($minPU) }} {{ $r->purchase_unit }} @else {{ @format_quantity($minBase) }} @endif @if($m) {{ @format_quantity($maxPU) }} {{ $r->purchase_unit }} @else {{ @format_quantity($maxBase) }} @endif {{ @format_quantity($base) }} {{ $r->base_unit }} @if($blocked > 0) {{ @format_quantity($blocked) }} @else @endif 0) class="text-yellow" @endif>{{ @format_quantity($dispatchable) }} @if($reserved > 0) {{ @format_quantity($reserved) }} @else @endif {{ @format_quantity($atp) }} {{ $r->base_unit }}
@lang('lang_v1.no_records_found')
{{ $rows->links() }}
@endif
@endsection