{{ __('main.add_stock_adjustment') }}
@php $total_items = 0; @endphp
@if ($materials && count($materials) > 0)
    @foreach ($materials as $item)
  • {{ $item->name }}
  • @endforeach
@elseif($material_query != '' && count($materials) == 0)
  • {{ __('main.no_materials_found') }}
@endif
# {{ __('main.materials') }} {{ __('main.qty') }} {{ __('main.action_in_stock') }}
@foreach ($cartItems as $key => $item) @php $itemtotalquantity = 0; $total_items++; $isoutofstock = false; $openstock = \App\Models\Material::where('id', $item['id'])->first()->opening_stock ?? 0; $iteminpurchase = \App\Models\PurchaseDetail::where('material_id', $item['id'])->sum('purchase_quantity'); $iteminbills = \App\Models\InvoiceDetail::where('type', 2) ->where('item_id', $item['id']) ->sum('quantity'); $iteminadjustadd = \App\Models\StockAdjustmentDetail::where('material_id', $item['id']) ->where('type', 2) ->sum('quantity'); $iteminadjustsub = \App\Models\StockAdjustmentDetail::where('material_id', $item['id']) ->where('type', 1) ->sum('quantity'); $itemtransfer = \App\Models\StockTransferDetail::where('material_id', $item['id'])->sum('quantity'); $salesreturn = \App\Models\SalesReturnDetail::where('item_id', $item['id']) ->whereType(2) ->sum('quantity'); $itemtotalquantity = $iteminpurchase + $iteminadjustadd + $openstock + $salesreturn - ($iteminbills + $iteminadjustsub + $itemtransfer); $notenoughstock = false; if ($itemtotalquantity <= 0 && $type[$key] == 1) { $isoutofstock = true; } if ($type[$key] == 1 && $itemtotalquantity > 0) { if ($qty[$key] > $itemtotalquantity) { $notenoughstock = true; } } @endphp @endforeach
{{ $loop->index + 1 }}
{{ $item['name'] }}
{{ getUnitType($item['unit']) }}
@if ($isoutofstock == true || $notenoughstock == true)
@if ($notenoughstock == false) Material Is Out Of Stock @else Not Enough Material In Stock,
Quantity Left : {{ $itemtotalquantity }} @endif
@endif