project QadFinancials > class BFRWAnalysisCode > method ValidateComponentPost


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWAnalysisCode.ValidateComponent


program code (program1/bfrwanalysiscode.p)

/* ============================================================================ *
 * Validate all data for FRW Analysis code                                      *
 * ============================================================================ */
for each t_sFRWAnCode where
         t_sFRWAnCode.tc_Status <> "D":U:

    assign vcLineNbr = "":U.
    find first tAnCodeExcelMapping where
        tAnCodeExcelMapping.tiQCode_ID = t_sFRWAnCode.FRWAnCode_ID
        no-error.
    if available tAnCodeExcelMapping then
    do:
        assign vcLineNbr = substitute(#T-69'(Excel Line &1)':255(264440525)T-69#, tAnCodeExcelMapping.tiRowNbr).
    end.

    /* Analysis type of CALCULATION */
    if t_sFRWAnCode.tc_Status           <> "":U and
       t_sFRWAnCode.FRWAnCodeAnalyseType = {&FRWANALYSISTYPE-CALCULATION}
    then do:
        /* Calculation formula has to be entered */
        if t_sFRWAnCode.FRWAnCodeCalcElement = ? or
           t_sFRWAnCode.FRWAnCodeCalcElement = '':U
        then do:
            assign vcMessage = #T-72'Calculation formula is mandatory for Analysis code &1 of type Calculation.':255(844403753)T-72#
                   vcMessage = substitute(vcMessage, t_sFRWAnCode.FRWAnCodeCode).
            if vcLineNbr <> "":U then assign vcMessage = vcMessage + vcLineNbr.
            <M-74 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWAnCode.FRWAnCodeCalcElement':U (icFieldName), 
                input  t_sFRWAnCode.FRWAnCodeCalcElement (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sFRWAnCode.tc_Rowid (icRowid), 
                input  'qadfin-317589':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
            assign oiReturnStatus = -1.
        end.
        else do:
            <M-52 run ValidateComponentPostCalculation
               (input  t_sFRWAnCode.FRWAnCodeCalcElement (icCalculationText), 
                input  ',':U (icSumCharacter), 
                input  t_sFRWAnCode.tc_Rowid (icRowId), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
            if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper <> 0
            then do:
                /* There were errors during validation of calculation formula */
                assign vcMessage = #T-30'Calculation formula contains errors, un-allowed characters.':255(397425801)T-30#.
                if vcLineNbr <> "":U then assign vcMessage = vcMessage + vcLineNbr.
                <M-80 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tFRWAnCode.FRWAnCodeCalcElement':U (icFieldName), 
                    input  t_sFRWAnCode.FRWAnCodeCalcElement (icFieldValue), 
                    input  if vifcreturnSuper < 0 then 'E':U else 'W':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sFRWAnCode.tc_Rowid (icRowid), 
                    input  'qadfin-553626':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
            end.
        end.            
    end. /* if t_sFRWAnCode.FRWAnCodeAnalyseType = {&FRWANALYSISTYPE-CALCULATION} */
    
    /* Analysis type of TEXT */
    if t_sFRWAnCode.tc_Status           <> "":U and
       t_sFRWAnCode.FRWAnCodeAnalyseType = {&FRWANALYSISTYPE-TEXT}
    then do:
        /* Text has to be entered */
        if t_sFRWAnCode.FRWAnCodeAnalyseText = ? or
           t_sFRWAnCode.FRWAnCodeAnalyseText = '':U
        then do:
            assign vcMessage = #T-49'Text of the Analysis code &1 is mandatory for text type analysis.':255(991038204)T-49#
                   vcMessage = substitute(vcMessage, t_sFRWAnCode.FRWAnCodeCode).
            if vcLineNbr <> "":U then assign vcMessage = vcMessage + vcLineNbr.
            <M-51 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWAnCode.FRWAnCodeAnalyseText':U (icFieldName), 
                input  t_sFRWAnCode.FRWAnCodeAnalyseText (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sFRWAnCode.tc_Rowid (icRowid), 
                input  'qadfin-121776':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
            assign oiReturnStatus = -1.
        end.
    end. /* if t_sFRWAnCode.FRWAnCodeAnalyseType = {&FRWANALYSISTYPE-TEXT} */
    
    /* Analysis type of ANALYSIS */
    if t_sFRWAnCode.tc_Status           <> "":U and
       t_sFRWAnCode.FRWAnCodeAnalyseType = {&FRWANALYSISTYPE-ANALYSIS}
    then do:
        /* At leaset one CAO dimentsion has to be selected */
        if not can-find(first t_sFRWAnCodeElem where
                              t_sFRWAnCodeElem.tc_ParentRowid = t_sFRWAnCode.tc_Rowid and
                              t_sFRWAnCodeElem.tc_Status     <> "D":U)
        then do:
            assign vcMessage = #T-34'Analysis type is Analysis, but no any dimension is selected.':255(122056100)T-34#.
            if vcLineNbr <> "":U then assign vcMessage = vcMessage + vcLineNbr.
            <M-87 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sFRWAnCode.tc_Rowid (icRowid), 
                input  'qadfin-724695':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
            assign oiReturnStatus = -1.
        end.    
    end.
    /* Validate Control Dimension */
    if t_sFRWAnCode.FRWAnCodeCtrlCOADim <> '':U and
        t_sFRWAnCode.FRWAnCodeCtrlCOADim <> ? 
    then do:
         if not can-find(first t_sFRWAnCodeElem where
                               t_sFRWAnCodeElem.tc_ParentRowid = t_sFRWAnCode.tc_Rowid and
                               t_sFRWAnCodeElem.tc_Status     <> "D":U and
                               t_sFRWAnCodeElem.FRWAnCodeElemCOAType = t_sFRWAnCode.FRWAnCodeCtrlCOADim)
         then do:
              assign vcMessage = trim(#T-26'Controlling Dimension is not valid, it should be in the COA types of the report analysis code.':255(542222070)T-26#) 
                     oiReturnStatus = -1.

               <M-41 run SetMessage
                      (input  vcMessage (icMessage), 
                       input  ? (icArguments), 
                       input  ? (icFieldName), 
                       input  t_sFRWAnCode.FRWAnCodeCtrlCOADim (icFieldValue), 
                       input  'E':U (icType), 
                       input  3 (iiSeverity), 
                       input  t_sFRWAnCode.tc_Rowid (icRowid), 
                       input  'qadfin-552382':U (icFcMsgNumber), 
                       input  ? (icFcExplanation), 
                       input  ? (icFcIdentification), 
                       input  ? (icFcContext), 
                       output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
         end. /* End if not can-find first t_sFRWAnCodeElem */
     end. /* End if t_sFRWAnCode.FRWAnCodeCtrlCOADim <> '':U */
    /* ======================================================================================= *
     * Validate FRWAnCodeElem records                                                          *
     * ======================================================================================= */
    <M-20 run ValidateComponentPostFRWAnCodeElem  (output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
    if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
    
end. /* for each tFRWAnCode where */