Добрый день. Сделал программу, сделал дизайн прочитал про отчеты, но не как не пойму что надо прописать в fetch.Вот программа.
X++:
[SIZE=2]static void Job49(Args _args)
{
ProdJournalTable ProdJournalTable;
ProdJournalRoute ProdJournalRoute;
ProdJournalRoute ProdJournalRoute_1;
ProdJournalRoute ProdJOurnalRoute_2;
TmpProdJournalRouteOutTime tmpTable;
tmpprodjournalrouteouttime tmpTable_1;
tmpprodjournalrouteouttime tmpTable_2;
ProdTable ProdTable;
int nDay;
SysOperationProgress sop;
int cntItems;
date fromDate = 01\09\2008;
date toDate = 31\09\2008;
;
delete_from tmpTable;
select count (Recid)from Prodjournaltable
exists join ProdJournalRoute
where ProdJournalRoute.JournalId==ProdJournalTable.JournalId&&
ProdJournalTable.Createddate >= fromDate &&
ProdJournalTable.createdDate <= toDate &&
(ProdJournalRoute.WrkCtrId == '113' ||
ProdJournalRoute.WrkCtrId == '135');
cntItems = ProdJournalTable.RecId;
sop = SysOperationProgress::newGeneral('','',cntItems); // преоброзование шкалы
while select createddate,journalid,posted,posteddate
From ProdJournalTable
exists join ProdJournalRoute
where ProdJournalRoute.JournalId==ProdJournalTable.JournalId&&
ProdJournalTable.Createddate >= fromDate &&
ProdJournalTable.createdDate <= toDate &&
(ProdJournalRoute.WrkCtrId == '113' ||
ProdJournalRoute.WrkCtrId == '135')
{
select ProdJournalRoute_1
order by oprnum desc
where
ProdJournalRoute_1.JournalId == ProdJournalTable.JournalId;
select ProdTable
where
ProdTable.ProdId == ProdJournalRoute_1.ProdId;
select ProdJournalRoute_2
where
ProdJournalRoute_2.OprId like '045*' &&
ProdJournalRoute_2.JournalId == ProdJournalTable.JournalId;
sop.incCount();
/* info
(
strfmt("%1,%2,%3",
ProdJournalTable.createdDate,
ProdJournalTable.JournalId,
toDay() - ProdJournalTable.createdDate)
);*/
tmpTable.clear();
tmpTable.ITEMID =ProdTable.ItemId;
tmpTable.WRKCTRID=ProdjournalRoute_1.WrkCtrId;
tmpTable.Qty=ProdJournalRoute_1.QtyGood+ProdJournalRoute_1.QtyError;
if(ProdJournalTable.Posted==noyes::No)
{
tmpTable.Days= (toDay() - ProdJournalTable.createdDate)+1; //toDay() - ProdjournalRoute_1.transDate;
}
else
{
tmpTable.Days=(ProdJournalTable.PostedDate - ProdJournalTable.createdDate)+1 ;
}
tmpTable.Normal=noYes::No;
if ( tmpTable.WRKCTRID == '135')
{
nDay = 1;
}
if ( tmpTable.WRKCTRID == '113')
{
if (ProdJournalRoute_2 != NULL)
{
nDay=5;
}
else
{
nDay = 3;
}
}
if (tmpTable.Days > nDay)
tmpTable.Normal=NoYes::No;
else
tmpTable.Normal=NoYes::Yes ;
tmpTable.insert();
}
while select tmpTable
group by ItemId,WRKCTRID
{
select sum(Qty)from tmpTable_1
where tmpTable_1.Normal==noyes::Yes &&
tmpTable_1.ItemId == tmpTable.ItemId &&
tmpTable_1.WRKCTRID == tmpTable.WRKCTRID;
select sum (Qty) from tmpTable_2
where tmpTable_2.Normal==noYes::No &&
tmpTable_2.ItemId == tmpTable.ItemId &&
tmpTable_2.WRKCTRID == tmpTable.WRKCTRID;
info(strfmt("%1?%2?%3?%4",
tmpTable.ITEMID,
tmpTable.WRKCTRID,
tmpTable_1.Qty,
tmpTable_2.qty));
}
}
[/SIZE]