...
WITH ProdOrderComp DO BEGIN
SETCURRENTKEY("Item No.","Variant Code","Location Code",Status,"Due Date");
SETRANGE("Location Code",LocationCode);
SETRANGE("Item No.",ItemNo);
SETRANGE("Variant Code",VariantCode);
// Delete the following lines.
CALCSUMS("Qty. Picked (Base)");
QtyAssgndToProdComp := "Qty. Picked (Base)";
// End of the lines.
END;
...
...
WITH ProdOrderComp DO BEGIN
SETCURRENTKEY("Item No.","Variant Code","Location Code",Status,"Due Date");
SETRANGE("Location Code",LocationCode);
SETRANGE("Item No.",ItemNo);
SETRANGE("Variant Code",VariantCode);
// Add the following lines.
SETRANGE(Status,Status::Released);
CALCSUMS("Qty. Picked (Base)","Expected Qty. (Base)","Remaining Qty. (Base)");
QtyAssgndToProdComp := "Qty. Picked (Base)" - ("Expected Qty. (Base)" - "Remaining Qty. (Base)");
// End of the lines.
END;
...