Показать сообщение отдельно
Старый 12.09.2008, 09:24   #2  
CRASH_505 is offline
CRASH_505
Участник
Аватар для CRASH_505
 
74 / 10 (1) +
Регистрация: 09.09.2008
Доброе утро. Как правильно дописать условие."Если товар не разнесен, то какое его время простоя по сегодняшний день"--???

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 &&
          
ProdJournalTable.createdDate <= toDate &&
         (
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 &&
          
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;?????
        }
        else
        {
          ?????
        }

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