project QadFinancials > class BClosingPostingsReport > method ProcessIsGLAutoBalClear

Description

This method is to process Journal Enery Balance Report


Parameters


icFileinputcharacter
iiPeriodPeriodinputinteger
iiPeriodYearinputinteger
ocConCheckLineDetResultoutputcharacter
oiConCheckLineDetDurationoutputinteger
oiConCheckLineDetStartTimeoutputinteger
otConCheckLineDetStartDateoutputdate
oiErrorNumbersoutputinteger
iiCompanyIDinputinteger
ocConCheckLineDetVersionoutputcharacter
icAppVersioninputcharacter
icSumFileinputcharacter
icNumericFormatinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BConCheckProcessor.ConCheckProcessDet


program code (program7/bclosingpostingsreport.p)

/* ====================================================================================== *
 * Method       : ProcessIsGLAutoBalClear                                                 *
 * Description  : This method does validation for a period, whether a posted amount on    *
 *                the Auto-balance account was cleared by accountant or not               *
 * -------------------------------------------------------------------------------------- *
 * Parameters   : icFile    - hanndle to file, where result is stored                     *
 *                iiPeriodPeriod - accounting period for which check is executed          *
 *                iiPeriodYear   - accounting year for which check is executed            *
 *                ocConCheckLineDetResult - result of the check                           *
 *                oiConCheckLineDetDuration - duration of the check                       *
 *                oiConCheckLineDetStartTime - start time of the check                    *
 *                otConCheckLineDetStartDate - start date of the check                    *
 *                oiErrorNumbers - number of the errors                                   *
 *                iiCompanyId - Entity ID for which check is executed                     *
 *                ocConCheckLineDetVersion -                                              *
 *                icAppVersion - Version of the application                               *
 * ====================================================================================== */
 
assign oiReturnStatus = -98
       viLocalReturn  = 0.

MAIN_BLOCK:
do on error undo, return:

    /* Log start of the Auto-balance GL account check */
    assign vdStartEtime2 = etime(no).
    assign otConCheckLineDetStartDate = now
           oiConCheckLineDetStartTime = time
           oiErrorNumbers             = 0
           ocConCheckLineDetVersion   = icAppVersion + '.1'.

    /* Execute the real check */
    <M-19 run IsGLAutoBalClear
       (input  iiCompanyID (iiCompanyId), 
        input  iiPeriodYear (iiPeriodYear), 
        input  iiPeriodPeriod (iiPeriodPeriod), 
        output vlIsAutoBalClear (olIsGLAutoBalClear), 
        output tGLAutoBalClear (tGLAutoBalClear), 
        input  icNumericFormat (icNumericFormat), 
        input  '' (icLayerCode), 
        input  '' (icLayerTypeCode), 
        output viFcReturnSuper (oiReturnStatus)) in BClosingPostingsReport>

    if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
    if viFcReturnSuper <  0 then leave MAIN_BLOCK.

    /* Log result of the execution */
    assign ocConCheckLineDetResult   = if vlIsAutoBalClear then {&CONCHECKRESULT-PASSED} else {&CONCHECKRESULT-FAILED}
           oiConCheckLineDetDuration = etime - vdStartEtime2.

    /* Store result also in the text file */
    output stream sCloseOut to value(icFile) append.
    
    /* to format the total duration time */
    assign viMilliSecs2 = oiConCheckLineDetDuration.
    assign viSecs2 = TRUNCATE (oiConCheckLineDetDuration / 1000, 0).
    assign viMilliSecs2 = viMilliSecs2 mod 1000.
    assign vcTotalTime2 = string(viSecs2, 'HH:MM:SS')  +  '.'  +  string(viMilliSecs2).
    
    put stream sCloseOut unformatted ' 'skip.
    put stream sCloseOut unformatted '##### Auto-balance GL account clear validation #####' skip.
    PUT STREAM sCloseOut unformatted 'Version: ' ocConCheckLineDetVersion skip.
    put stream sCloseOut unformatted 'Validation Start At: ' string(now, '99/99/9999 HH:MM:SS') skip.
    
    if ocCOnCheckLineDetResult = {&CONCHECKRESULT-FAILED} 
    then do:
        put stream sCloseOut 'Period':U     at 1
                             'Daybook':U    at 9
                             'Voucher':U    at 18
                             'Text':U       at 29
                             'Credit SC':U  to 60
                             'Debit SC':U   to 75
                             'Credit BC':U  to 90
                             'Debit BC'     to 105 skip.
    
        for each tGLAutoBalClear:
            put stream sCloseOut substitute("&1/&2":U, tGLAutoBalClear.tiPeriodYear, tGLAutoBalClear.tiPeriodPeriod) format "x(7)" at 1
                                 tGLAutoBalClear.tcJournalCode     at 9
                                 tGLAutoBalClear.tiPostingVoucher  at 18
                                 substring(tGLAutoBalClear.tcPostingText, 1, 12, "CHARACTER") at 29
                                 tGLAutoBalClear.tdCreditCC        to 60
                                 tGLAutoBalClear.tdDebitCC         to 75
                                 tGLAutoBalClear.tdCreditLC        to 90
                                 tGLAutoBalClear.tdDebitLC         to 105 skip.
            assign oiErrorNumbers = oiErrorNumbers + 1.
        end.
    end.

    put stream sCloseOut unformatted 'Execution Duration: ' vcTotalTime2 skip.
    put stream sCloseOut unformatted 'Execution Result: ' ocConCheckLineDetResult skip.
    put stream sCloseOut unformatted '<Error Count:> ' oiErrorNumbers skip.
    put stream sCloseOut unformatted '**********************************************************************' skip.
    output stream sCloseOut close.

    /* Store summary result into the text file */
    output stream sCloseOut to value(icSumFile) append.
    put stream sCloseOut unformatted ' 'skip.
    put stream sCloseOut unformatted {&CONCHECKLINEDETTYPE-GLAUTOBAL-TR} skip.
    put stream sCloseOut unformatted '----------------------------------------' skip.
    if not can-find(first tGLAutoBalClearSum)
    then do:
        put stream sCloseOut unformatted trim(#T-90'Execution Result':255(510391963)T-90#) + ': ' + {&CONCHECKRESULT-PASSED} skip.
        put stream sCloseOut unformatted trim(#T-35'Balance of the Auto-balancing GL account in BC/SC is zero.':150(145217869)T-35#) skip.
    end.
    else do:
        put stream sCloseOut unformatted trim(#T-78'Execution Result':255(510391963)T-78#) + ': ':U + {&CONCHECKRESULT-WARNING} skip.
        for each tGLAutoBalClearSum:
            put stream sCloseOut unformatted tGLAutoBalClearSum.tcGLAutoBalClearSumErr skip. 
        end.
    end.
    put stream sCloseOut unformatted '____________________________________________________________' skip.
    output stream sCloseOut close.
    
end. /* MAIN_BLOCK */

assign oiReturnStatus = viLocalReturn.