Цитата:
Сообщение от
lev
Вообще не понял суть проблемы
Не все норм просто я ступил немного.Во смотрите что у меня получилось
PHP код:
{
ProdJournalTable ProdJournalTable;
ProdJournalRoute ProdJournalRoute;
ProdJournalRoute ProdJournalRoute_1;
ProdJournalRoute ProdJOurnalRoute_2;
TmpProdJournalRouteOutTime tmpTable;
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 &&
(ProdJournalRoute.WrkCtrId == '113' ||
ProdJournalRoute.WrkCtrId == '135');
cntItems = ProdJournalTable.RecId;
sop = SysOperationProgress::newGeneral('','',cntItems); // преоброзование шкалы
while select createddate,journalid,posted
from ProdJournalTable
exists join ProdJournalRoute
where ProdJournalRoute.JournalId==ProdJournalTable.JournalId&&
ProdJournalTable.Createddate >= fromdate &&
(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;
tmpTable.Days= toDay() - ProdJournalTable.createdDate;
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();
}
}