project QadFinancials > class BBudget > method BudgetCheckInfoResolveReadWBSSub

Description

This instanceless method is just a submethod of BudgetCheckInfoResolveReadWBS that remove the tBudgetCheckInfoWBSTemp-records that have a FDS-code (list, matching, ...) or budgetgroup that does not fit the info in tBudgetCheckInfo.


Parameters


icCodeinputcharacterFDSCode
iiSafStructureIDinputintegerSafStructureID
iiSafConceptIDinputintegerSafConceptId
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBudget.BudgetCheckInfoResolveReadWBS


program code (program8/bbudget.p)

/* ========================= */
    /* Set default Return Status */
    /* ========================= */
    assign oiReturnStatus = -98.
                                                                                        
    /* ======================================================================================== */
    /* Prerequisites;                                                                           */
    /* - tBudgetCheckInfoWBSTemp is empty                                                       */
    /* - This method should be in the same segment as the caller                                */
    /* - Following records should be available:                                                 */
    /*  tBudgetByBudgetIDCodeStatus, tBudgetCheckInfo, tqBudgetPeriodByBudgetIDDate,           */
    /*  tqBudgetVersionByBudgetIDStat, tqBudgetFDSByBudgetIDType and tqBudgetCompanyByBudgetID  */
    /* - Table tBudgetCheckInfoWBSTemp shold exist                                              */
    /* ======================================================================================== */
    /* =============================================================================================== */
    /* Actions;                                                                                        */
    /* 001: State the saf-information and state the Code-value (always needed)                                                  */
    /* 101: Read all the WBS-records of the FDS-type and create tBudgetCheckInfoWBSTemp-records for    */
    /*      the tq-records                                                                             */ 
    /* 102: Read the WBS-records of the FDS-type for the parents in tBudgetCheckInfoWBS and create     */
    /*      tBudgetCheckInfoWBSTemp-records for the tq-records                                         */
    /* 103: Read the WBS-records of the FDS-type based for parents in tBudgetCheckInfoWBS and create   */
    /*      tBudgetCheckInfoWBSTemp-records of the tBudgetCheckInfoWBS-records but set the WBS-ID of   */
    /*      these newly created records equal the WBS-ID of the tq-records                             */
    /* 201: Remove the tBudgetCheckInfoWBSTemp-records that have a FDS-code (list, matching, ...) or   */
    /*      budgetgroup that does not fit the info in tBudgetCheckInfo                                 */
    /*      This can be split into several mechanisms:                                                 */
    /*      201-1: Equal Match (FDSCode - no *, no #)                                                  */
    /*      201-2: Matches (FDSCode with *)                                                            */
    /*      201-3: All - except the defined ones of the same parent (FDSCode with #)                   */
    /*      201-4: FromTo (FDSFromCode+FDSToCode)                                                      */
    /*      201-5: List (FDSList)                                                                      */
    /*      201-6: BudgetGroup (BudgetGroupID)                                                         */
    /* =============================================================================================== */
    
    /* ============================================================================= */
    /* 201: Remove the tBudgetCheckInfoWBSTemp-records that have a FDS-code (list,   */
    /* matching, ...) or budgetgroup that does not fit the info in tBudgetCheckInfo  */
    /* ============================================================================= */
    if can-find (first tBudgetCheckInfoWBSTemp) and 
       tqBudgetFDSByBudgetIDType.tcBudgetFDSType <> {&BUDGETFDSTYPE-TOTAL}
    then do :
        
        for each tBudgetCheckInfoWBSTemp : 
            if tBudgetCheckInfoWBSTemp.tcFDSCode <> "":U and 
               tBudgetCheckInfoWBSTemp.tcFDSCode <> ?
            then do :
                if index(tBudgetCheckInfoWBSTemp.tcFDSCode,"*":U) <> 0 
                then do :
                    /* =============================== */
                    /* 201-2: Matches (FDSCode with *) */
                    /* =============================== */
                    if not icCode matches tBudgetCheckInfoWBSTemp.tcFDSCode
                    then delete tBudgetCheckInfoWBSTemp.
                end. /* if index(tBudgetCheckInfoWBSTemp.tcFDSCode,"*":U) <> 0  */
                else do :
                    if index(tBudgetCheckInfoWBSTemp.tcFDSCode,"#":U) <> 0
                    then do :
                        /* ======================================================================== */
                        /* 201-3: All - except the defined ones of the same parent (FDSCode with #) */
                        /* ======================================================================== */
                        if icCode <> "":U and 
                           icCode <> ?
                        then delete tBudgetCheckInfoWBSTemp.
                    end. /* if index(tBudgetCheckInfoWBSTemp.tcFDSCode,"#":U) <> 0 */
                    else do :                                          
                        /* ========================================= */
                        /* 201-1: Equal Match (FDSCode - no *, no #) */
                        /* ========================================= */
                        if icCode <> tBudgetCheckInfoWBSTemp.tcFDSFromCode
                        then delete tBudgetCheckInfoWBSTemp.
                    end. /* if index(tBudgetCheckInfoWBSTemp.tcFDSCode,"#":U) = 0 */
                end. /* if index(tBudgetCheckInfoWBSTemp.tcFDSCode,"*":U) = 0  */
            end. /* if tBudgetCheckInfoWBSTemp.tcFDSCode <> "":U and */
            else do :
                if tBudgetCheckInfoWBSTemp.tcFDSFromCode <> "":U and 
                   tBudgetCheckInfoWBSTemp.tcFDSFromCode <> ?    and 
                   tBudgetCheckInfoWBSTemp.tcFDSToCode   <> "":U and 
                   tBudgetCheckInfoWBSTemp.tcFDSToCode   <> ?
                then do :
                    /* ========================================= */
                    /* 201-4: FromTo (FDSFromCode+FDSToCode)     */
                    /* ========================================= */
                    if icCode < tBudgetCheckInfoWBSTemp.tcFDSFromCode or
                       icCode > tBudgetCheckInfoWBSTemp.tcFDSToCode
                    then delete tBudgetCheckInfoWBSTemp.
                end. /* if tBudgetCheckInfoWBSTemp.tcFDSFromCode <> "":U and */
                else do :
                    if tBudgetCheckInfoWBSTemp.tcFDSList <> "":U and 
                       tBudgetCheckInfoWBSTemp.tcFDSList <> ?
                    then do :
                        /* ========================================= */
                        /* 201-5: List (FDSList)                     */
                        /* ========================================= */
                        if lookup(icCode,tBudgetCheckInfoWBSTemp.tcFDSList) = 0
                        then delete tBudgetCheckInfoWBSTemp.
                    end. /* if tBudgetCheckInfoWBSTemp.tcFDSList <> "":U and */
                    else do :
                        if tBudgetCheckInfoWBSTemp.tiBudgetGroupID <> 0 and 
                           tBudgetCheckInfoWBSTemp.tiBudgetGroupID <> ?
                        then do :
                            /* ========================================= */
                            /* 201-6: BudgetGroup (BudgetGroupID)        */
                            /* ========================================= */
                            assign vcBudgetGroupResolved = "":U.
                            case tBudgetCheckInfoWBSTemp.tcFDSType : 
                            when {&BUDGETFDSTYPE-SAF}
                            then do:
                                if vlResolveStartedSafBySSOthers = false
                                then do :
                                    assign vlResolveStartedSafBySSOthers = true.
                                    <Q-11 run SafBySSOthers  (Start) in BSaf >
                                end. /* if vlResolveStartedSafBySSOthers = false */
                                <Q-10 run SafBySSOthers (all) (Read) (Cache)
          (input ?, (FromSafCode)
           input ?, (ToSafCode)
           input ?, (SafConceptCode)
           input iiSafConceptID, (SafConceptID)
           input ?, (MatchingSafCode)
           input ?, (SafCode)
           input tBudgetCheckInfoWBSTemp.tiBudgetGroupID, (BudgetGroupID)
           output dataset tqSafBySSOthers) in BSaf >
                                for each tqSafBySSOthers no-lock :
                                    assign vcBudgetGroupResolved = vcBudgetGroupResolved + ",":U + tqProjectBySSOthers.tcProjectCode.
                                end. /* for each tqSafBySSOthers no-lock */
                            end. /* SAF */
                            when {&BUDGETFDSTYPE-GL}
                            then do:
                                if vlResolveStartedGLBySSOthers = false
                                then do :
                                    assign vlResolveStartedGLBySSOthers = true.
                                    <Q-12 run GLBySSOthers  (Start) in BGL >
                                end.
                                <Q-6 run GLBySSOthers (all) (Read) (Cache)
          (input tqBudgetCompanyByBudgetID.tiCompany_ID, (CompanyId)
           input ?, (FromGLCode)
           input ?, (ToGLCode)
           input ?, (GLSharedSetID)
           input ?, (MatchingGLCode)
           input ?, (GLCode)
           input tBudgetCheckInfoWBSTemp.tiBudgetGroupID, (BudgetGroupID)
           output dataset tqGLBySSOthers) in BGL >
                                for each tqGLBySSOthers no-lock :
                                    assign vcBudgetGroupResolved = vcBudgetGroupResolved + ",":U + tqGLBySSOthers.tcGLCode.
                                end. /* for each tqGLBySSOthers no-lock */
                            end. /* GL */
                            when {&BUDGETFDSTYPE-DIVISION}
                            then do:
                                if vlResolveStartedDivBySSOthers = false
                                then do :
                                    assign vlResolveStartedDivBySSOthers = true.
                                    <Q-7 run DivisionBySSOthers  (Start) in BDivision >
                                end.
                                <Q-13 run DivisionBySSOthers (all) (Read) (Cache)
          (input tqBudgetCompanyByBudgetID.tiCompany_ID, (CompanyId)
           input ?, (DivisionSharedSetID)
           input ?, (FromDivisionCode)
           input ?, (ToDivisionCode)
           input ?, (MatchingDivisionCode)
           input ?, (DivisionCode)
           input tBudgetCheckInfoWBSTemp.tiBudgetGroupID, (BudgetGroupID)
           output dataset tqDivisionBySSOthers) in BDivision > 
                                for each tqDivisionBySSOthers no-lock :
                                    assign vcBudgetGroupResolved = vcBudgetGroupResolved + ",":U + tqDivisionBySSOthers.tcDivisionCode.
                                end. /* for each tqDivisionBySSOthers no-lock */
                            end. /* Div */
                            when {&BUDGETFDSTYPE-PROJECT}
                            then do:
                                if vlResolveStartedPrjBySSOthers = false
                                then do :
                                    assign vlResolveStartedPrjBySSOthers = true.
                                    <Q-14 run ProjectBySSOthers  (Start) in BProject >
                                end.
                                <Q-8 run ProjectBySSOthers (all) (Read) (Cache)
          (input tqBudgetCompanyByBudgetID.tiCompany_ID, (CompanyId)
           input ?, (ProjectSharedSetID)
           input ?, (FromProjectCode)
           input ?, (ToProjectCode)
           input ?, (MatchingProjectCode)
           input ?, (ProjectCode)
           input tBudgetCheckInfoWBSTemp.tiBudgetGroupID, (BudgetGroupID)
           output dataset tqProjectBySSOthers) in BProject >
                                for each tqProjectBySSOthers no-lock :
                                    assign vcBudgetGroupResolved = vcBudgetGroupResolved + ",":U + tqProjectBySSOthers.tcProjectCode.
                                end. /* for each tqProjectBySSOthers no-lock */
                            end. /* Proj */
                            when {&BUDGETFDSTYPE-COSTCENTRE}
                            then do:
                                if vlResolveStartedCCBySSOthers = false
                                then do :
                                    assign vlResolveStartedCCBySSOthers = true.
                                    <Q-15 run CostCentreBySSOthers  (Start) in BCostCentre >
                                end.
                                <Q-9 run CostCentreBySSOthers (all) (Read) (Cache)
          (input tqBudgetCompanyByBudgetID.tiCompany_ID, (CompanyId)
           input ?, (CostCentreSharedSetID)
           input ?, (FromCostCentreCode)
           input ?, (ToCostCentreCode)
           input ?, (MatchingCostCentreCode)
           input ?, (CostCentreCode)
           input tBudgetCheckInfoWBSTemp.tiBudgetGroupID, (BudgetGroupID)
           output dataset tqCostCentreBySSOthers) in BCostCentre >
                                for each tqCostCentreBySSOthers no-lock :
                                    assign vcBudgetGroupResolved = vcBudgetGroupResolved + ",":U + tqCostCentreBySSOthers.tcCostCentreCode.
                                end. /* for each tqCostCentreBySSOthers no-lock */
                            end. /* CC */
                            end case.
                            if vcBudgetGroupResolved <> "":U 
                            then assign vcBudgetGroupResolved = substring(vcBudgetGroupResolved,2,-1,"CHARACTER":U).
                            if lookup(icCode,vcBudgetGroupResolved) = 0
                            then delete tBudgetCheckInfoWBSTemp.
                        end. /* if tBudgetCheckInfoWBSTemp.tiBudgetGroupID <> 0 and */
                    end. /* if tBudgetCheckInfoWBSTemp.tcFDSList = "":U and */
                end. /* if tBudgetCheckInfoWBSTemp.tcFDSFromCode = "":U and */
            end. /* if tBudgetCheckInfoWBSTemp.tcFDSCode = "":U */
        end. /* for each tBudgetCheckInfoWBSTemp */
        
    end. /* if can-find (first tBudgetCheckInfoWBSTemp) and */
    
    /* =========================== */
    /* Reset default Return Status */
    /* =========================== */
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.