If you were forced to make manual updates to the InventTrans table, your on-hand inventory counts may look off. Fortunately, there’s a built-in class to recalculate the InventSum table:
InventSumRecalcItem InventSumRecalcItem;
InventSumRecalcItem = new InventSumRecalcItem(“ItemID”, TRUE, checkfix::fix);
InventSumRecalcItem.updatenow();
Replace “ItemID” with the ItemID of the item you wish to correct.
The second parameter (TRUE or FALSE) indicates whether to show errors.
The third parameter indicates whether to recalculate (checkfix::fix), or just check for discrepancies (checkfix::check).
You can also run this on the entire InventSum table:
InventTable InventTable;
InventSumRecalcItem InventSumRecalcItem;
WHILE SELECT InventTable
WHERE (InventTable.ItemType == ItemType::Item) || (InventTable.ItemType == ItemType::BOM)
{
InventSumRecalcItem = new InventSumRecalcItem(InventTable.ItemId, TRUE, checkfix::fix);
InventSumRecalcItem.updatenow();
}