Validate Inventory on hand in Sales Order

Hi Everyone

I need the following configuration to apply for BC wave 2. 

When sales reps are placing the orders. need to validate the Qty with inventory on hand by location. I know from the SO level we cant validate the Inventory. But need to apply this control. We required validation Specially on the sales order if the quantity is greater than the available inventory do not allow to create the sales order.

Please suggest logic and code ...

Appreciate your early response.

Regards

Sam

  • You need to put this check in 2 places one for quantity and one for location in sales line table. Below is the code, figure out where exactly you can plug this code,  you can also write a function and put a hook to call this code using the function.

    if currfieldno = fieldno(quantity) then begin

      If (type = type::item) and ("no." <> '') then begin

       itemrec.reset;

       itemrec.setrange("no.","no.");

       itemrec.setfilter("location filter","location code");

       if itemrec.find('-') then begin

        itemrec.calcfields(inventory);

        if quantity > itemrec.inventory then

         error('There is not enough qty. on hand for this item and location');

      end;

     end; 

    end;

Related
Recommended