project QadFinancials > class TConCheck > method UnpostedTransactionCheck


Parameters


icFileinputcharacter
ocConCheckLineDetResultoutputcharacter
otConCheckLineDetStartDateoutputdate
oiConCheckLineDetStartTimeoutputinteger
oiConCheckLineDetDurationoutputinteger
iiCompanyIDinputinteger
iiPeriodIDinputinteger
iiSessionIDinputinteger
oiErrorNumbersoutputinteger
ocConCheckLineDetVersionoutputcharacter
icAppVersioninputcharacter
icSumFileinputcharacter
ihTranslationHandleinputhandle
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method TConCheck.MainEntry


program code (program1/tconcheck.p)

/* ================================================================================= */
/* This is the check for unposted transactions                                       */
/* ================================================================================= */

assign oiReturnStatus = -98.

assign vdStartEtime               = etime(no)
       otConCheckLineDetStartDate = now
       oiConCheckLineDetStartTime = time
       oiErrorNumbers             = 0
       ocConCheckLineDetVersion   = icAppVersion + '.1'.

/* open logfile stream */
OUTPUT STREAM sTechOut TO value(icFile) APPEND.
OUTPUT STREAM sSumOut TO value(icSumFile) APPEND. 

PUT STREAM sTechOut unformatted ' ' skip.
PUT STREAM sTechOut unformatted '##### Unposted Transactions Check #####' skip.
PUT STREAM sTechOut unformatted 'Version: ' ocConCheckLineDetVersion skip.
PUT STREAM sTechOut unformatted 'Validation Start At: ' string(now, '99/99/9999 HH:MM:SS') skip. 
   
MAIN_BLOCK: 
do on error undo, throw: 
    /* Get CompanyCode by iiCompanyId */
    find first Company where 
               Company.Company_id = iiCompanyID 
               no-lock no-error.     
    if iiCompanyID = ? or iiCompanyID = 0 or not available Company
    then do:
       assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
       PUT STREAM sTechOut unformatted "**Error** Input parameter CompanyID is null or Company not found." skip. 
       LEAVE MAIN_BLOCK.
    end.

    /* Get YearPeriod by iiPeriodID */
    find first Period of Company where 
               Period_id = iiPeriodID 
               no-lock no-error.    
    if iiPeriodID = ? or iiPeriodID = 0 or not available Period
    then do:
       assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
       PUT STREAM sTechOut unformatted "**Error** Input parameter PeriodID is null or Period not found." skip. 
       LEAVE MAIN_BLOCK.
    end.

    find first Domains of Company no-lock no-error.
    if not available Domains
    then do:
       assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
       PUT STREAM sTechOut unformatted "**Error** Domains of the input entity not found." skip. 
       LEAVE MAIN_BLOCK.
    end.

    for each glt_det where glt_domain = Domains.DomainCode and
                           glt_entity = Company.CompanyCode and 
                           glt_effdate <= Period.PeriodEndDate no-lock:
       assign oiErrorNumbers = oiErrorNumbers + 1. 
    end.  

    if oiErrorNumbers = 0
    then assign ocConCheckLineDetResult = {&CONCHECKRESULT-PASSED}.
    else assign ocConCheckLineDetResult = {&CONCHECKRESULT-WARNING}.
end. /* main_block */
assign oiConCheckLineDetDuration = etime - vdStartEtime.

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


PUT STREAM sSumOut unformatted ' ' skip.
PUT STREAM sSumOut unformatted trim({&CONCHECKLINEDETTYPE-UNPOSTTRANS-TR}) skip.
PUT STREAM sSumOut unformatted '---------------------' skip.
put stream sSumOut unformatted trim(#T-78'Execution Result':255(510391963)T-78#) + ': ' + ocConCheckLineDetResult skip. 

if ocConCheckLineDetResult = {&CONCHECKRESULT-WARNING} 
then do:
    put stream sTechOut unformatted 'Number of unposted transactions with effective date before the selected period end: ' oiErrorNumbers skip.
    put stream sSumOut unformatted  trim(#T-98'Number of unposted transactions with effective date before the selected period end':200(431919454)T-98#)
                                    ': ' oiErrorNumbers skip.                                                     
end.
else do:
    put stream sTechOut unformatted 'There are no unposted transactions with an effective date before the selected period end.' skip.
    put stream sSumOut unformatted trim(#T-71'There are no unposted transactions with an effective date before the selected period end.':200(188968231)T-71#)
    skip.
end.
put stream sTechOut unformatted 'Execution Duration: ' vcTotalTime  skip. 
put stream sTechOut unformatted 'Execution Result: ' ocConCheckLineDetResult skip.
put stream sTechOut unformatted '**********************************************************************' skip.
output stream sTechOut close.

put stream sSumOut unformatted "____________________________________________________________" skip.
output stream sSumOut close.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.