Inventory Summary Recalculation - InventSumReCalc

Saturday, February 17, 2018

Sometimes over time especially in a environment where a lot of stock transactions are taking place, the stock numbers go out of sync. Sales , purchases , stock adjustments and reconciliations are just some of the transactions which affect your stock numbers. The stock transactions themselves and stored in the inventrans tabes , we also have a stock summary table which displays the stock totals for an item. This table can sometimes display the wrong information and needs to be adjusted. The code below will call the InventSumRecalItem table which will run through all the transactions in the invent trans table and recalculate the stock totals.

Recalculate InventSum

InventSum is needed to recalculate sometimes.We should use InventSumRecalcItem class in Dynamic

InventSumRecalcItem InventSumRecalcItem;
;
InventSumRecalcItem = new InventSumRecalcItem("ITM00001", true, checkfix::fix);
InventSumRecalcItem.updatenow();


If you want to calculate for all items :

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();
}