Minimum Quatity on Sales Order

Hi Everybody.

I setup Minimum Quantity on table Sales Price (ID-7002) but it’s no work. I have write customize function check Minimum Quantity on Sales Order but no work .


Quantity - OnValidate()
IF ("Document Type"="Document Type"::Order) THEN
SalesLine.RESET;
SalesLine.SETRANGE("No.",SalesPrice."Item No.");
SalesLine.SETRANGE("Sell-to Customer No.",SalesPrice."Sales Code");
SalesLine.SETFILTER(SalesLine.Type,'%1',SalesLine.Type::Item);
SalesLine.SETFILTER(Type, '>1');
SalesPrice.RESET;
SalesPrice.SETFILTER("Sales Type",'%1',SalesPrice."Sales Type"::Customer);
SalesPrice.SETFILTER("Ending Date",'%1',0D);
SalesPrice.SETFILTER("Minimum Quantity",'<>0');
IF SalesLine.FINDSET THEN BEGIN
      IF SalesPrice.GET("Sell-to Customer No.","No.") THEN
        BEGIN
          QuantityLine:=SalesLine.Quantity;
          QtyMin:=SalesPrice."Minimum Quantity";
          CustomerNo:=SalesPrice."Sales Code";
          ItemNo:=SalesPrice."Item No.";
       END;
            IF QtyMin > Quantity THEN
            ERROR(Txt0001,"Line No.",ItemNo,CustomerNo,QtyMin);
END;

Please help me fix code. Thanks so much

Best Regards,

dinhson

What exactly you want to do OR achieve?

Minimum Quantity field is standard field and has its functionality. why do you have to customize?

Thanks RockWithNAV & Mohana reply.

Specifically I want to do the following :

Is it possible to enforce a minimum sales quantity on a particular item in NAV when raising a Sales Order manually (not through the planning worksheet)? We have an item which we must sales a minimum of 15 units to our Customer (they will not accept the sales order with any quantities less than 15 units).
Is this possible?

then you should add this field on Item table and do the customization accordingly.
Sales Price minimum quantity field has different functionality…