获取物料指定日期的库存

How to get On-Hand inventory of past years (by date)
Many a times we come accross a requirement from customer to show on hand inventory of last year or some other report of this type as it is not included in the out of box package. I found a very interesting job from the community web site related to this.

static void findingOnHandByDate(Args _args)
{
ItemId itemId;
InventDim inventDimCriteria;
InventDimParm inventDimParm;
InventSumDateDim inventSumDateDim;
TransDate start, finish;
int c;
int onHandTotal;
;
start = str2date("1/1/2010", 213);
finish = str2date("12/31/2010", 213);
onHandTotal = 0;
while(start != finish)
{
c++;
// Specify the item to get onhand info on
itemId = "00017470";

inventSumDateDim =
InventSumDateDim::newParameters(start,
itemId,
inventDimCriteria,
inventDimParm);

info(strfmt("Date: %1 on hand: %2", start, num2str(inventSumDateDim.postedQty() + inventSumDateDim.receivedQty() - inventSumDateDim.deductedQty(), 0, 2, 1, 1)));
onHandTotal += (inventSumDateDim.postedQty() + inventSumDateDim.receivedQty() - inventSumDateDim.deductedQty());
start += 1;
}
info(strfmt("Avg on hand per year: %1", onHandTotal / 365));
}

原文链接: https://www.cnblogs.com/perock/archive/2012/07/26/2609581.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/56867

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月9日 上午7:40
下一篇 2023年2月9日 上午7:41

相关推荐