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