project QadFinancials > class BConCheckProcessor > method ConCheckProcessInit

Description

This method is to do preparation for consistency check processing.


Parameters


ocFileoutputcharacter
ocFileNameoutputcharacter
ocSumFileoutputcharacter
ocSumFileNameoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BConCheckProcessor.ConCheckExecute


program code (program7/bconcheckprocessor.p)

/* ================================================================================ */
/* This method does the preparation work the consistency check process.             */
/* The tasks mainly focus on two areas:                                             */
/* 1.Compare the selected consistency check items with the system consistency check */
/*   list. Compare the selected consistency check items with the                    */
/*   predefined business/regional validation list.                                  */
/* 2.Create Consistency Check Log in pdf format in DB.                              */
/*                                                                                  */
/* It allows to user to set Regional Consistency Check list in the                  */
/* ConCheckProcessInit.before() method.                                             */
/* ================================================================================ */

assign oiReturnStatus = -98.

/* Check if system consistency check iteams are all included */
assign vcSysConCheckList = {&CONCHECKLINEDETTYPE-UTSYSCNP-TR}  + chr(2) +
                           {&CONCHECKLINEDETTYPE-UTSYSCNP}     + chr(2) +
                           {&CONCHECKLINEDETTYPES}             + chr(2) +
                           {&CONCHECKLINEDETTYPE-NUMBERING-TR} + chr(2) +
                           {&CONCHECKLINEDETTYPE-NUMBERING}.

do viSysConCheckCount = 1 to 23:

    assign vcConCheckTemp = entry(viSysConCheckCount * 2, vcSysConCheckList, chr(2)).
    /*As these business check will be removed to the tech part, will skip this check in business. 
      Not implemented check will be removed too.
    */
    if vcConCheckTemp = {&CONCHECKLINEDETTYPE-GLBALANCEPOSTING}
        or vcConCheckTemp = {&CONCHECKLINEDETTYPE-APMATCHPO}
        or vcConCheckTemp = {&CONCHECKLINEDETTYPE-HISTINVOICE}
        or vcConCheckTemp = {&CONCHECKLINEDETTYPE-ARINVOICE}
        or vcConCheckTemp = {&CONCHECKLINEDETTYPE-UNMARKPOSTING}
        or vcConCheckTemp = {&CONCHECKLINEDETTYPE-TAXSUBGL} 
        or vcConCheckTemp = {&CONCHECKLINEDETTYPE-FINOPERPOSTING} 
    then next.

    find first tConCheckLineDetRef
        where tConCheckLineDetRef.ConCheckLineDetType = vcConCheckTemp no-error.
    if not available tConCheckLineDetRef
    then do:
        assign vcMessage = substitute(trim(#T-58'System consistency check item &1 in the consistency check list is missed.':255(49078790)T-58#),vcConCheckTemp).
        <M-72 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-823440':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BConCheckProcessor>
        assign oiReturnStatus = -1.
        return.
    end.            
end.

/* ===================================================== */
/* Get the Logging Folder where we keep the output files */
/* ===================================================== */
assign vcFolderName = ''.
<M-22 run Main  (output vcFolderName (ocFolderName)) in tLogger>
if vcFolderName = ''
then assign vcFolderName = session:temp-directory.
assign vcFolderName = right-trim(vcFolderName, "~\/") + (if opsys = "Win32":U then "~\" else "/").

assign tConCheckRef.ConCheckStartDate = now
       ocFileName                     = substitute("&1_&2_&3_&4&5&6_&7_TECHNICAL.txt":U,
                                                   tConCheckRef.tcCompanyCode,
                                                   string(tConCheckRef.tiPeriodYear,'9999':U),
                                                   string(tConCheckRef.tiPeriodPeriod,'99':U),
                                                   string(year(tConCheckRef.ConCheckStartDate),'9999':U),
                                                   string(month(tConCheckRef.ConCheckStartDate),'99':U),
                                                   string(day(tConCheckRef.ConCheckStartDate),'99':U),
                                                   tConCheckRef.ConCheckSeq)
       ocSumFileName                     = substitute("&1_&2_&3_&4&5&6_&7_BUSINESS.txt":U,
                                                   tConCheckRef.tcCompanyCode,
                                                   string(tConCheckRef.tiPeriodYear,'9999':U),
                                                   string(tConCheckRef.tiPeriodPeriod,'99':U),
                                                   string(year(tConCheckRef.ConCheckStartDate),'9999':U),
                                                   string(month(tConCheckRef.ConCheckStartDate),'99':U),
                                                   string(day(tConCheckRef.ConCheckStartDate),'99':U),
                                                   tConCheckRef.ConCheckSeq).
                  
assign ocFile    = vcFolderName + ocFileName
       ocSumFile = vcFolderName + ocSumFileName.

/* ===================================================== */
/* Get Version information for the business layer        */
/* ===================================================== */
find first tConCheckRef no-error.

if available tConCheckRef
then assign vcAppVersion = tConCheckRef.ConCheckVersion.

/* ===================================================== */
/* Start the Main section of the log                     */
/* ===================================================== */
output stream strout to value(ocFile) CONVERT TARGET "UTF-8".
put stream strout unformatted "~357~273~277". /* BOM for UTF-8 */.

put stream strout unformatted '*********************************'  skip.
put stream strout unformatted '* Automated GL Consistency Check '  skip.
put stream strout unformatted '*                                '  skip.
put stream strout unformatted '* Release Version: ' + vcAppVersion skip.
put stream strout unformatted '*                                '  skip.
put stream strout unformatted '*********************************'  skip.
put stream strout unformatted 'Execution Start:'                   skip (2).

output stream strout close.

output stream strout to value(ocSumFile) CONVERT TARGET "UTF-8".
put stream strout unformatted "~357~273~277". /* BOM for UTF-8 */.

<Q-73 run CompanyPrim (all) (Read) (NoCache)
   (input ?, (LookupCompanyId)
    input tConCheckRef.tcCompanyCode, (CompanyCode)
    output dataset tqCompanyPrim) in BCompany>
    
find first tqCompanyPrim no-error.
if available tqCompanyPrim
then assign vcConCheckExecCompanyDesc = tqCompanyPrim.tcCompanyDescription.

put stream strout unformatted #T-42'Consistency check for Entity':80(978920497)T-42#': ' + tConCheckRef.tcCompanyCode + ' ' + vcConCheckExecCompanyDesc skip.
put stream strout unformatted #T-37'Period':40(50780)T-37#': ' + string(tConCheckRef.tiPeriodYear,"9999") + '/' + string(tConCheckRef.tiPeriodPeriod,"99") skip.
put stream strout unformatted '____________________________________________________________' skip.

output stream strout close.

assign tConCheckRef.ConCheckStartDate = now
       tConCheckRef.ConCheckStartTime = time.

if oiReturnStatus = -98
then assign oiReturnStatus = 0.