project QadFinancials > class BFRWAnalysisCode > method ValidateComponentPreFRWAnCode


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWAnalysisCode.ValidateComponentPre


program code (program1/bfrwanalysiscode.p)

for each t_sFRWAnCode where
         t_sFRWAnCode.tc_Status <> "D":U
    break by t_sFRWAnCode.FRWAnCodeFRWChartCode:
    
    /* Because the data created by this maintenance are used by operational programs, we have to *
     * replace unknown values by empty values                                                    */
    if t_sFRWAnCode.FRWAnCodeAnalyseText  = ? then t_sFRWAnCode.FRWAnCodeAnalyseText  = "":U.
    if t_sFRWAnCode.FRWAnCodeAnalyseType  = ? then t_sFRWAnCode.FRWAnCodeAnalyseType  = "":U.
    if t_sFRWAnCode.FRWAnCodeCalcElement  = ? then t_sFRWAnCode.FRWAnCodeCalcElement  = "":U.
    if t_sFRWAnCode.FRWAnCodeCalcType     = ? then t_sFRWAnCode.FRWAnCodeCalcType     = "":U.
    if t_sFRWAnCode.FRWAnCodeELR          = ? then t_sFRWAnCode.FRWAnCodeELR          = "":U.
    if t_sFRWAnCode.FRWAnCodeFRWChartCode = ? then t_sFRWAnCode.FRWAnCodeFRWChartCode = "":U.
    if t_sFRWAnCode.FRWAnCodeInfo         = ? then t_sFRWAnCode.FRWAnCodeInfo         = "":U.
    if t_sFRWAnCode.FRWAnCodeTaxoName     = ? then t_sFRWAnCode.FRWAnCodeTaxoName     = "":U.
    if t_sFRWAnCode.FRWAnCodeXBRElement   = ? then t_sFRWAnCode.FRWAnCodeXBRElement   = "":U.
    
    /* Retrive FRWChart code ID */
    if first-of(t_sFRWAnCode.FRWAnCodeFRWChartCode) and
       t_sFRWAnCode.FRWAnCodeFRWChartCode <> '':U   and
       t_sFRWAnCode.FRWAnCodeFRWChartCode <> ?
    then do:
        <Q-63 run FRWChartByCodeForCube (all) (Read) (NoCache)
           (input t_sFRWAnCode.FRWAnCodeFRWChartCode, (FRWChartCode)
            output dataset tqFRWChartByCodeForCube) in BFRWChart>
        find first tqFRWChartByCodeForCube where
             tqFRWChartByCodeForCube.tcFRWChartCode = t_sFRWAnCode.FRWAnCodeFRWChartCode
             no-error.
        if not available tqFRWChartByCodeForCube
        then do:
            assign vcMessage = #T-76'Invalid Report Chart code.':255(357779274)T-76#.

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

            <M-85 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'FRWAnCode.FRWAnCodeFRWChartCode':U (icFieldName), 
                input  t_sFRWAnCode.FRWAnCodeFRWChartCode (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sFRWAnCode.tc_Rowid (icRowid), 
                input  'qadfin-887010':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
            assign oiReturnStatus = -1.
        end.
    end. /* if first-of(tFRWAnCode.FRWAnCodeFRWChartCode) and */
    
    if t_sFRWAnCode.FRWAnCodeFRWChartCode <> '':U   and
       t_sFRWAnCode.FRWAnCodeFRWChartCode <> ?
    then do:
        if available tqFRWChartByCodeForCube
        then assign t_sFRWAnCode.FRWChart_ID = tqFRWChartByCodeForCube.tiFRWChart_ID.
    end.
    else assign t_sFRWAnCode.FRWChart_ID = tqFRWChartByCodeForCube.tiFRWChart_ID.


    /* ======================================================================== *
     * Clear out those values, that are not compatible with Analysis Type       *
     * ======================================================================== */
    if t_sFRWAnCode.FRWAnCodeAnalyseType <> {&FRWANALYSISTYPE-ANALYSIS}
    then do:
        for each t_sFRWAnCodeElem where
                 t_sFRWAnCodeElem.tc_ParentRowid = t_sFRWAnCode.tc_Rowid and
                 t_sFRWAnCodeElem.tc_Status     <> "D":U:
            if t_SFRWAnCodeElem.tc_Status = "N":U
            then do:
                find first t_oFRWAnCodeElem where
                     t_oFRWAnCodeElem.tc_Rowid = t_sFRWAnCodeElem.tc_Rowid
                     no-error.
                if available t_oFRWAnCodeElem
                then delete t_oFRWAnCodeElem.

                delete t_sFRWAnCodeElem.
            end.
        end.
    end.

    if t_sFRWAnCode.FRWAnCodeAnalyseType <> {&FRWANALYSISTYPE-CALCULATION}
    then assign t_sFRWAnCode.FRWAnCodeCalcElement = "":U.

    if t_sFRWAnCode.FRWAnCodeAnalyseType <> {&FRWANALYSISTYPE-TEXT}
    then assign t_sFRWAnCode.FRWAnCodeAnalyseText = "":U.

    
    /* ======================================================================== *
     * Fill in correct value to the field FRWAnCode.FRWAnCodeInfo               *
     * ======================================================================== */
    <M-77 run ValidateComponentPreFRWAnCodeInfo  (output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
    if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
    
    
    /* ======================================================================== *
     * Report chart can define Shared sets for GL, Division, CC and Project     *
     * These Shared sets have to be used for validateion of Elements entered    *
     * for COA types. To do that, we just get any entity using the SS, and this *
     * entity is used to executed all validations                               *
     * ======================================================================== */
    if available tqFRWChartByCodeForCube
    then do:
        if t_sFRWAnCode.tiFRWChartGLSharedSet_ID = 0 or t_sFRWAnCode.tiFRWChartGLSharedSet_ID = ?
        then assign t_sFRWAnCode.tiFRWChartGLSharedSet_ID = tqFRWChartByCodeForCube.tiGLSharedSet_ID.
        if t_sFRWAnCode.tiFRWChartDivisionSharedSet_ID = 0 or t_sFRWAnCode.tiFRWChartDivisionSharedSet_ID = ?
        then assign t_sFRWAnCode.tiFRWChartDivisionSharedSet_ID = tqFRWChartByCodeForCube.tiDivisionSharedSet_ID.
        if t_sFRWAnCode.tiFRWChartCostCentreSharedSet_ID = 0 or t_sFRWAnCode.tiFRWChartCostCentreSharedSet_ID = ?
        then assign t_sFRWAnCode.tiFRWChartCostCentreSharedSet_ID = tqFRWChartByCodeForCube.tiCostCentreSharedSet_ID.
        if t_sFRWAnCode.tiFRWChartProjectSharedSet_ID = 0 or t_sFRWAnCode.tiFRWChartProjectSharedSet_ID = ?
        then assign t_sFRWAnCode.tiFRWChartProjectSharedSet_ID = tqFRWChartByCodeForCube.tiProjectSharedSet_ID.
    end.

    <M-2 run GetEntityForSharedSet
       (input  t_sFRWAnCode.tiFRWChartGLSharedSet_ID (iiGLSharedSet_ID), 
        output viGLSSCompany_ID (oiGLSSCompany_ID), 
        input  t_sFRWAnCode.tiFRWChartDivisionSharedSet_ID (iiDivisionSharedSet_ID), 
        output viDivisionSSCompany_ID (oiDivisionSSCompany_ID), 
        input  t_sFRWAnCode.tiFRWChartCostCentreSharedSet_ID (iiCostCentreSharedSet_ID), 
        output viCostCentreSSCompany_ID (oiCostCentreSSCompany_ID), 
        input  t_sFRWAnCode.tiFRWChartProjectSharedSet_ID (iiProjectSharedSet_ID), 
        output viProjectSSCompany_ID (oiProjectCompany_ID), 
        output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
    if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper. 


    /* ======================================================================== *
     * Pre validation of the FRWAnCodeElem record                               *
     * ======================================================================== */
    <M-54 run ValidateComponentPreFRWAnCodeElem
       (input  viGLSSCompany_ID (iiGLSSCompany_ID), 
        input  viDivisionSSCompany_ID (iiDivisionSSCompany_ID), 
        input  viCostCentreSSCompany_ID (iiCostCentreSSCompany_ID), 
        input  viProjectSSCompany_ID (iiProjectSSCompany_ID), 
        output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
    if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
    if oiReturnStatus < 0 then return.

end. /* for each tFRWAnCode where */