project QadFinancials > class BConCheckProcessor > method ConCheckProcess

Description

This method is really to do process consistency check.


Parameters


iiSelCompanyIDinputinteger
iiConCheckPeriodYearinputinteger
iiConCheckPeriodPeriodinputinteger
icConCheckTypeinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BConCheckProcessor.ConCheckExecute


program code (program7/bconcheckprocessor.p)

/* ================================================================================= */
/* This method follows the consistency check list to execute reports and scripts in  */
/* two different ways.                                                               */
/* Reports: Call Process<Name>Report methods in BConCheckProcess.                    */
/* Scripts:  Call ProcessScript method which will then execute scripts sequentially  */
/*                                                                                   */
/* After all validation item being executed, update tConCheckRef, tConCheckLineRef   */
/* and tConCheckLineDetRef on execution result, startdate/starttime, duration.       */
/* ================================================================================= */
assign oiReturnStatus = -98
       viLocalReturn  = 0.

assign viConCheckDuration = 0
       viConCheckErrCount = 0.

for each tConCheckLineRef where
         tConCheckLineRef.ConCheckLineIsSel = yes :

    assign viConCheckLineDuration = 0
           viConCheckLineErrCount = 0.

    for each tConCheckLineDetRef where
             tConCheckLineDetRef.ConCheckLine_ID       = tConCheckLineRef.ConCheckLine_ID and
             tConCheckLineDetRef.ConCheck_ID           = tConCheckRef.ConCheck_ID         and
             tConCheckLineDetRef.ConCheckLineDetResult <> {&CONCHECKRESULT-NOTIMPLEMENTED} 
             by tConCheckLineDetRef.tiConCheckLineDetSeq:
        <M-90 run ConCheckProcessDet
           (input  iiSelCompanyID (iiSelCompanyID), 
            input  iiConCheckPeriodYear (iiConCheckPeriodYear), 
            input  iiConCheckPeriodPeriod (iiConCheckPeriodPeriod), 
            input  tConCheckLineRef.ConCheckLineType (icConCheckLineType), 
            input  tConCheckLineDetRef.ConCheckLineDetType (icConCheckLineDetType), 
            output viFcReturnSuper (oiReturnStatus)) in BConCheckProcessor> 

        if tConCheckLineRef.ConCheckLineResult       = {&CONCHECKRESULT-NOTEXECUTED} and
           tConCheckLineDetRef.ConCheckLineDetResult <> {&CONCHECKRESULT-NOTEXECUTED}
        then assign tConCheckLIneRef.ConCheckLineResult = tConCheckLineDetRef.ConCheckLineDetResult.
        else 
        if tConCheckLineDetRef.ConCheckLineDetResult =  {&CONCHECKRESULT-FAILED} and
           tConCheckLineRef.ConCheckLineResult       <> {&CONCHECKRESULT-FAILED}
        then assign tConCheckLineRef.ConCheckLineResult = {&CONCHECKRESULT-FAILED}.
        
        if (tConCheckLineRef.ConCheckLineStartDate = ?         and
            tConCheckLineRef.ConCheckLineStartTime = ?         and
            tConCheckLineDetRef.ConCheckLineDetStartDate <> ?  and
            tConCheckLineDetRef.ConCheckLineDetStartTime <> ?) or
           (tConCheckLineRef.ConCheckLineStartDate <> ?        and
            tConCheckLineRef.ConCheckLineStartTime <> ?        and
            tConCheckLineDetRef.ConCheckLineDetStartDate <> ?  and
            tConCheckLineDetRef.ConCheckLineDetStartTime <> ?  and
           (tConCheckLineRef.ConCheckLineStartDate > tConCheckLineDetRef.ConCheckLineDetStartDate or
           (tConCheckLineRef.ConCheckLineStartDate = tConCheckLineDetRef.ConCheckLineDetStartDate and
            tConCheckLineRef.ConCheckLineStartTime > tConCheckLineDetRef.ConCheckLineDetStartTime)))           
        then assign tConCheckLineRef.ConCheckLineStartDate = tConCheckLineDetRef.ConCheckLineDetStartDate
                    tConChecklineRef.ConCheckLineStartTime = tConCheckLineDetRef.ConCheckLineDetStartTime.
        
        assign viConCheckLineDuration = viConCheckLineDuration + tConCheckLineDetRef.ConCheckLineDetDuration
               viConCheckLineErrCount = viConCheckLineErrCount + tConCheckLineDetRef.ConCheckLineDetErrCount.
    end.

    assign tConCheckLineRef.ConCheckLineDuration = viConCheckLineDuration.
    
    if tConCheckRef.ConCheckResult       = {&CONCHECKRESULT-NOTEXECUTED} and
       tConCheckLineRef.ConCheckLineResult <> {&CONCHECKRESULT-NOTEXECUTED}
    then assign tConCheckRef.ConCheckResult = tConCheckLineRef.ConCheckLIneResult.
    else if tConCheckLineRef.ConCheckLineResult =  {&CONCHECKRESULT-FAILED} and
            tConCheckRef.ConCheckResult         <> {&CONCHECKRESULT-FAILED}
    then assign tConCheckRef.ConCheckResult = {&CONCHECKRESULT-FAILED}.
    
    if (tConCheckRef.ConCheckStartDate = ?         and
        tConCheckRef.ConCheckStartTime = ?         and
        tConCheckLineRef.ConCheckLineStartDate <> ?  and
        tConCheckLineRef.ConCheckLineStartTime <> ?) or
       (tConCheckRef.ConCheckStartDate <> ?        and
        tConCheckRef.ConCheckStartTime <> ?        and
        tConCheckLineRef.ConCheckLineStartDate <> ?  and
        tConCheckLineRef.ConCheckLineStartTime <> ?  and
       (tConCheckRef.ConCheckStartDate > tConCheckLineRef.ConCheckLineStartDate or
       (tConCheckRef.ConCheckStartDate = tConCheckLineRef.ConCheckLineStartDate and
        tConCheckRef.ConCheckStartTime > tConCheckLineRef.ConCheckLineStartTime)))           
    then assign tConCheckRef.ConCheckStartDate = tConCheckLineRef.ConCheckLineStartDate
                tConCheckRef.ConCheckStartTime = tConCheckLineRef.ConCheckLineStartTime.
                
    assign viConCheckDuration = viConCheckDuration + tConCheckLineRef.ConCheckLineDuration
           viConCheckErrCount = viConCheckErrCount + viConCheckLineErrCount.

end. /* for each tConCheckLineRef */

assign tConCheckRef.ConCheckDuration   = viConCheckDuration
       tConCheckRef.ConCheckErrCount   = viConCheckErrCount
       tConCheckRef.ConCheckVersion    = vcAppVersion
       tConCheckRef.ConCheckIsUpToDate = true.

/* to format the total duration time */
assign viMilliSecs = tConCheckRef.ConCheckDuration.
assign viSecs = TRUNCATE (viMilliSecs / 1000, 0).
assign viMilliSecs = viMilliSecs mod 1000.
assign vcTotalTime = string(viSecs, 'HH:MM:SS')  +  '.'  +  string(viMilliSecs).

output stream strout to value(vcFile) append.
put stream strout unformatted ' ' skip(3).
put stream strout unformatted '*********  The End  ************' skip.
put stream strout unformatted '--------------------------------' skip.
put stream strout unformatted 'GL Consistency Check End.' skip.
put stream strout unformatted 'Execution Duration: ' vcTotalTime skip. 
put stream strout unformatted 'Execution Result: ' tConCheckRef.ConCheckResult skip.
put stream strout unformatted '--------------------------------' skip.
put stream strout unformatted '********************************' skip.
output stream strout close.

output stream strout to value(vcSumFile) append.
put stream strout unformatted ' ' skip(2).
put stream strout unformatted '----- End of report -----' skip.
output stream strout close.

assign oiReturnStatus = viLocalReturn.