ProdOrderHead.RESET; ProdOrderHead.SETRANGE("Sales Order No.","No."); ProdOrderHead.SETFILTER(Status, '<>Archived'); IF ProdOrderHead.FIND('-') THEN BEGIN IF NOT CONFIRM(Text50012,FALSE) THEN EXIT; REPEAT //Save No. of Production order and Rec ProdOrderNo := ProdOrderHead.Number; ProdOrderHead2 := ProdOrderHead; //Save current status ProdNewStatus := ProdOrderHead.Status; WHILE ProdNewStatus < 5 DO BEGIN ProdOrderHead2.RESET; ProdOrderHead2.GET(ProdOrderNo); //Set new status ProdNewStatus := ProdNewStatus + 1; //Post production if new status = Completed IF ProdNewStatus = ProdNewStatus::Completed THEN BEGIN IF ProdOrderHead."Remaining Qty." <> 0 THEN BEGIN ProdPost.PostProduction(ProdOrderHead2); END; END; //Reload record ProdOrderHead2.RESET; ProdOrderHead2.GET(ProdOrderNo); //Update status ProdOrderStatus. ChangeStatusArchived(ProdOrderHead2,ProdNewStatus); END; ProdOrderNo := ''; ProdOrderHead2.RESET; UNTIL ProdOrderHead.NEXT = 0; END ELSE BEGIN ERROR(Text50013); END;
Comments
Try this:
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!