static void Esh_ItemId_Test(Args _args)
{
InventTable inventTable;
InventTrans inventTrans;
InventTransOrigin inventTransOrigin;
PeriodStart periodStartDate;
PeriodEnd periodEndDate;
TransDate month,wkstart,wkend,d1;
boolean found;
periodStartDate = FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).StartDate;
periodEndDate = FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).EndDate;
month = dateMthFwd(systemDateGet(),-6);
d1 = dateStartMth(month);
while (month != periodEndDate)
{
if(month >= periodStartDate && month <= periodEndDate)
{
while (d1 != endmth(month))
{
wkstart = Global::dateStartWk(d1);
wkend = Global::dateEndWk(d1);
select ReferenceCategory from inventTransOrigin
where inventTransOrigin.ItemId=="100026" && inventTransOrigin.ReferenceCategory==InventTransType::Sales
exists join sum(qty) from inventTrans where inventTrans.inventTransOrigin == inventTransOrigin.RecId && (inventTrans.DatePhysical >= wkstart && inventTrans.DatePhysical <= wkend);
info(strFmt("%1-----%2-------%3---------%4",inventTransOrigin.ReferenceCategory,inventTrans.Qty,wkstart,wkend));
wkstart = wkend+1;
d1 = wkstart;
if(wkend >= endmth(month))
{
found = true;
break;
}
}
}
month = nextMth(month);
if(month >= systemDateGet())
{
found = true;
break;
}
}
}
{
InventTable inventTable;
InventTrans inventTrans;
InventTransOrigin inventTransOrigin;
PeriodStart periodStartDate;
PeriodEnd periodEndDate;
TransDate month,wkstart,wkend,d1;
boolean found;
periodStartDate = FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).StartDate;
periodEndDate = FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).EndDate;
month = dateMthFwd(systemDateGet(),-6);
d1 = dateStartMth(month);
while (month != periodEndDate)
{
if(month >= periodStartDate && month <= periodEndDate)
{
while (d1 != endmth(month))
{
wkstart = Global::dateStartWk(d1);
wkend = Global::dateEndWk(d1);
select ReferenceCategory from inventTransOrigin
where inventTransOrigin.ItemId=="100026" && inventTransOrigin.ReferenceCategory==InventTransType::Sales
exists join sum(qty) from inventTrans where inventTrans.inventTransOrigin == inventTransOrigin.RecId && (inventTrans.DatePhysical >= wkstart && inventTrans.DatePhysical <= wkend);
info(strFmt("%1-----%2-------%3---------%4",inventTransOrigin.ReferenceCategory,inventTrans.Qty,wkstart,wkend));
wkstart = wkend+1;
d1 = wkstart;
if(wkend >= endmth(month))
{
found = true;
break;
}
}
}
month = nextMth(month);
if(month >= systemDateGet())
{
found = true;
break;
}
}
}
No comments:
Post a Comment