project QadFinancials > class BClosingPostingsReport > method ProcessRecurringEntries

Description

This method is to process recurring entries.


Parameters


iiPeriodYearinputintegerGL Period Year
iiPeriodPeriodinputintegerGL Period Period
icFileinputcharacter
ocConCheckLineDetResultoutputcharacter
otConCheckLineDetStartDateoutputdate
oiConCheckLineDetStartTimeoutputinteger
oiConCheckLineDetDurationoutputinteger
oiErrorNumbersoutputinteger
iiCompanyIDinputinteger
ocConCheckLineDetVersionoutputcharacter
icAppVersioninputcharacter
icSumFileinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BConCheckProcessor.ConCheckProcessDet


program code (program7/bclosingpostingsreport.p)

/* ==================================================================== */
/* This method is called by ConCheckProcessor to call recurring entries */
/* and log the result.                                                  */
/* ==================================================================== */
assign vdStartEtime2 = etime(no).
assign otConCheckLineDetStartDate = now
       oiConCheckLineDetStartTime = time
       oiErrorNumbers             = 0
       ocConCheckLineDetVersion   = icAppVersion + '.1'.

empty temp-table tFilter.
empty temp-table tqRecurringEntries.
 
create tFilter.
assign tFilter.tcBusinessFieldName = 'PeriodYear':U
       tFilter.tcOperator          = '='
       tFilter.tcParameterValue    = string(iiPeriodYear).

create tFilter.
assign tFilter.tcBusinessFieldName = 'PeriodPeriod':U
       tFilter.tcOperator          = '='
       tFilter.tcParameterValue    = string(iiPeriodPeriod).

<Q-47 run CompanyPrim (all) (Read) (NoCache)
   (input iiCompanyID, (LookupCompanyId)
    input ?, (CompanyCode)
    output dataset tqCompanyPrim) in BCompany >
find first tqCompanyPrim no-error.
if available tqCompanyPrim
then do:
    create tFilter.
    assign tFilter.tcBusinessFieldName = 'Company_CANDO':U
           tFilter.tcOperator          = '='
           tFilter.tcParameterValue    = tqCompanyPrim.tcCompanyCode.
end.
     
<M-9 run RecurringEntriesDet
   (output dcrRecurringEntries (dcrRecurringEntries), 
    output oiReturnStatus (oiReturnStatus)) in BClosingPostingsReport>

/* check pass or fail status */
if can-find(first tqRecurringEntries where tqRecurringEntries.tiExceptionNbr = -1)
then assign ocConCheckLineDetResult = {&CONCHECKRESULT-PASSED}.
else assign ocConCheckLineDetResult = {&CONCHECKRESULT-WARNING}.

/* try to get header information */
for each tqText:
    case tqText.tcCode:
    when 'coLblRecEntryCode':U
    then assign vcRecurringEntry = tqText.tcText.

    when 'coLblPostingTemplateCode':U
    then assign vcPostingTemplateCode = tqText.tcText.

    when 'coLblJournalCode':U
    then assign vcDaybookCode = tqText.tcText.

    when 'coLblRecEntryStartDate':U
    then assign vcRecEntryStartDate = tqText.tcText.

    when 'coLblRecEntryEndDate':U
    then assign vcRecEntryEndDate = tqText.tcText.

    when 'coLblRecEntryFreq':U
    then assign vcRecEntryFreq = tqText.tcText.

    when 'coLblRecEntryAmountLC':U
    then assign vcRecEntryAmountLC = tqText.tcText.

    when 'coLblRecEntryLineCode':U
    then assign vcRecEntryLineCode = tqText.tcText.

    when 'coLblRecEntryLinePostingDate':U
    then assign vcRecEntryLinePostingDate = tqText.tcText.

    when 'coLblRecEntryLineAmountLC':U
    then assign vcRecEntryLineAmountLC = tqText.tcText.

    when 'coLblRecEntryLineStatus':U
    then assign vcRecEntryLineStatus = tqText.tcText.
    end.
end.

/* set validation execution duration */
assign oiConCheckLineDetDuration = etime - vdStartEtime2.

/* open log file stream */
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 '##### Recurring Entries #####' skip.
PUT STREAM sCloseOut unformatted 'Version: ' ocConCheckLineDetVersion skip.
put stream sCloseOut unformatted 'Validation Start At: ' string(now, '99/99/9999 HH:MM:SS') skip.


/* log errors if validation failed */
if ocCOnCheckLineDetResult = {&CONCHECKRESULT-WARNING}
then do:
    /* Header Info */
    put stream sCloseOut unformatted vcRecurringEntry      at 1
                                     vcPostingTemplateCode at 30
                                     vcDaybookCode         at 60
                                     vcRecEntryStartDate   at 80
                                     vcRecEntryEndDate     at 100
                                     vcRecEntryFreq        at 120 
                                     vcRecEntryAmountLC    at 150 skip.

    put stream sCloseOut unformatted vcRecEntryLineCode        at 5
                                     vcRecEntryLinePostingDate at 35
                                     vcRecEntryLineAmountLC    at 55
                                     vcRecEntryLineStatus      at 95 skip.         

    /* Detail Info */
    for each tqRecurringEntries
        where tqRecurringEntries.tiExceptionNbr <> -1
        break by tqRecurringEntries.tcRecEntryCode:

        assign oiErrorNumbers = oiErrorNumbers + 1.
        
        /* output group info */
        if first-of(tqRecurringEntries.tcRecEntryCode)
        then do:
            put stream sCloseOut unformatted tqRecurringEntries.tcRecEntryCode        at 1
                                             tqRecurringEntries.tcPostingTemplateCode at 30
                                             tqRecurringEntries.tcJournalCode         at 60
                                             tqRecurringEntries.ttRecEntryStartDate   at 80
                                             tqRecurringEntries.ttRecEntryEndDate     at 100
                                             tqRecurringEntries.tcRecEntryFreq        at 120
                                             tqRecurringEntries.tdRecEntryAmountLC    at 150 skip.
        end.
    
        /* output line info */
        put stream sCloseOut unformatted tqRecurringEntries.tcRecEntryLineCode        at 5
                                         tqRecurringEntries.ttRecEntryLinePostingDate at 35
                                         tqRecurringEntries.tdRecEntryLineAmountLC    at 55
                                         tqRecurringEntries.tcRecEntryLineStatus      at 95 skip.
    
        /* output a blank line when group changed */
        if last-of(tqRecurringEntries.tcRecEntryCode)
        then do:
            put stream sCloseOut unformatted '' skip.
        end.

    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.
/* close log file stream */
output stream sCloseOut close.

/* Store summary result into the text file */
output stream sCloseOut to value(icSumFile) append.
put stream sCloseOut unformatted ' ':U skip.
put stream sCloseOut unformatted {&CONCHECKLINEDETTYPE-RECURENTRY-TR} skip.
put stream sCloseOut unformatted '-----------------' skip.
put stream sCloseOut unformatted trim(#T-4'Execution Result':255(510391963)T-4#) + ': ':U + ocConCheckLineDetResult skip.
if ocConCheckLineDetResult = {&CONCHECKRESULT-WARNING}
then put stream sCloseOut unformatted trim(#T-93'Total number of pending recurring entries':150(470268380)T-93#)+ ': ':U + string(oiErrorNumbers) skip.
put stream sCloseOut unformatted '____________________________________________________________' skip.
output stream sCloseOut close.