project QadFinancials > class BConsolid > method AdditionalUpdatesConsolidationBlockDef

Description

Defaults.


Parameters


oiCountoutputinteger
ocDivisionCodeoutputcharacter
ocCostCentreCodeoutputcharacter
ocProjectCodeoutputcharacter
ocSafParentTypeoutputcharacter
ocSafStructureCodeoutputcharacter
ocSaf1Codeoutputcharacter
ocSaf2Codeoutputcharacter
ocSaf3Codeoutputcharacter
ocSaf4Codeoutputcharacter
ocSaf5Codeoutputcharacter
ocSafConcept1Codeoutputcharacter
ocSafConcept2Codeoutputcharacter
ocSafConcept3Codeoutputcharacter
ocSafConcept4Codeoutputcharacter
ocSafConcept5Codeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BConsolid.AdditionalUpdatesConsolidationBlock


program code (program1/bconsolid.p)

/* ======================================================================================================== */
/* This method determines the target SubAccount CC PRJ and SAFs to use                                      */
/* Input is                                                                                                 */
/*    - tConsCOACrossRefResult : unique combinations used in source for GL DIC CC PRJ + target mapping was  */
/*    - tqConsolidCycleByCompanyID : Consolidation Setup                                                    */
/*    - tqPostingHistByYPLayerCyForMov : Source transaction                                                 */
/* Output are data items oc*                                                                                */
/* ======================================================================================================== */
assign oiReturnStatus      = -98
       viLocalReturnStatus = 0
       ocDivisionCode      = '':U
       ocCostCentreCode    = '':U
       ocProjectCode       = '':U
       ocSafParentType     = '':U
       ocSafStructureCode  = '':U
       ocSaf1Code          = '':U
       ocSaf2Code          = '':U
       ocSaf3Code          = '':U
       ocSaf4Code          = '':U
       ocSaf5Code          = '':U
       ocSafConcept1Code   = '':U
       ocSafConcept2Code   = '':U
       ocSafConcept3Code   = '':U
       ocSafConcept4Code   = '':U
       ocSafConcept5Code   = '':U.

/* ================================================================ */
/* 1. Get the correct SubAccount                                    */
/* ================================================================ */
if tConsCOACrossRefResult.tlGLIsDivisionAccount = true
then do:
    if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithDiv = false or
       tConsCOACrossRefResult.tcTargetDivisionCode         = '':U  or
       tConsCOACrossRefResult.tcTargetDivisionCode         = ?
    then assign ocDivisionCode = tqConsolidCycleByCompanyID.tcDivisionCode.
    else assign ocDivisionCode = tConsCOACrossRefResult.tcTargetDivisionCode.
end.
else assign ocDivisionCode = '':U.

/* ================================================================ */
/* 2. Get the correct CostCentre and Project                        */
/* ================================================================ */
if tConsCOACrossRefResult.tlGLIsCostCentreAccount = false
then assign ocCostCentreCode = ''.

if tConsCOACrossRefResult.tlGLIsProjectAccount = false
then assign ocProjectCode = ''.

if tConsCOACrossRefResult.tlGLIsCostCentreAccount = true and
   tConsCOACrossRefResult.tlGLIsProjectAccount = true
then do:
    find tqGLAnalysisInfoForOperationals where
         tqGLAnalysisInfoForOperationals.tcGLCode = tConsCOACrossRefResult.tcTargetGLCode
         no-error.
    if available tqGLAnalysisInfoForOperationals and
       tqGLAnalysisInfoForOperationals.tcGLAnalysisLimitation = {&GLANALYSISLIMITATION-NONE}
    then assign ocCostCentreCode = tConsCOACrossRefResult.tcTargetCostCentreCode
                ocProjectCode    = tConsCOACrossRefResult.tcTargetProjectCode.
    else do:
        if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithCostCtr = false or
           tConsCOACrossRefResult.tcTargetCostCentreCode           = '':U  or 
           tConsCOACrossRefResult.tcTargetCostCentreCode           = ?  
        then assign ocCostCentreCode = tqConsolidCycleByCompanyID.tcCostCentreCode.
        else assign ocCostCentreCode = tConsCOACrossRefResult.tcTargetCostCentreCode.

        if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithProject = false or
           tConsCOACrossRefResult.tcTargetProjectCode              = '':U  or 
           tConsCOACrossRefResult.tcTargetProjectCode              = ?                     
        then assign ocProjectCode = tqConsolidCycleByCompanyID.tcProjectCode.
        else assign ocProjectCode = tConsCOACrossRefResult.tcTargetProjectCode.
    
    end.
end. /* Both */    
/* Fill in default cost centre when necessary */
else 
if tConsCOACrossRefResult.tlGLIsCostCentreAccount = true and
   tConsCOACrossRefResult.tlGLIsProjectAccount    = false
then do:
    if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithCostCtr = false or
       tConsCOACrossRefResult.tcTargetCostCentreCode           = '':U  or 
       tConsCOACrossRefResult.tcTargetCostCentreCode           = ?
    then assign ocCostCentreCode = tqConsolidCycleByCompanyID.tcCostCentreCode.
    else assign ocCostCentreCode = tConsCOACrossRefResult.tcTargetCostCentreCode.
    assign ocProjectCode = '':U.
end.
/* else assign ocCostCentreCode = '':U. */    
/* Fill in default project when necessary */
else 
if tConsCOACrossRefResult.tlGLIsProjectAccount = true and
   tConsCOACrossRefResult.tlGLIsCostCentreAccount = false
then do:
    if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithProject = false or
       tConsCOACrossRefResult.tcTargetProjectCode              = '':U  or 
       tConsCOACrossRefResult.tcTargetProjectCode              = ?                     
    then assign ocProjectCode = tqConsolidCycleByCompanyID.tcProjectCode.
    else assign ocProjectCode = tConsCOACrossRefResult.tcTargetProjectCode.
    assign ocCostCentreCode = '':U.
end.
/* else assign ocProjectCode = '':U. */
else 
if tConsCOACrossRefResult.tlGLIsCostCentreAccount = false   and
   tConsCOACrossRefResult.tlGLIsProjectAccount    = false
then assign ocCostCentreCode = '':U
            ocProjectCode = '':U.

/* ================================================================ */
/* 3. Get the correct SAFs  and SafConcepts                         */
/* ================================================================ */
if tConsCOACrossRefResult.tlGLIsSafAccount = true
then do:
     /* Take the default SAFs in case consolidation cycle is setup this way, or in case the source has no SAFs */
     if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithSaf = false or
        tqPostingHistByYPLayerCyForMov.tlGLIsSafAccount      = false
     then do:
         for each tqConsolidCycleSafByParentType where
                  tqConsolidCycleSafByParentType.tcConsolidCycleSafParentType = {&POSTINGSAFPARENTTYPE-GL}
                  by tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq:

            if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 1      
            then assign ocSaf1Code         = tqConsolidCycleSafByParentType.tcSafCode
                        ocSafConcept1Code  = tqConsolidCycleSafByParentType.tcSafConceptCode
                        ocSafStructureCode = tqConsolidCycleSafByParentType.tcSafStructureCode
                        ocSafParentType    = {&POSTINGSAFPARENTTYPE-GL}.
            if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 2
            then assign ocSaf2Code         = tqConsolidCycleSafByParentType.tcSafCode
                        ocSafConcept2Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
            if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 3      
            then assign ocSaf3Code         = tqConsolidCycleSafByParentType.tcSafCode
                        ocSafConcept3Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
            if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 4      
            then assign ocSaf4Code         = tqConsolidCycleSafByParentType.tcSafCode
                        ocSafConcept4Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
            if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 5      
            then assign ocSaf5Code        = tqConsolidCycleSafByParentType.tcSafCode
                        ocSafConcept5Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
         end.
     end.
     else do:
         /* Take the SAFs of the source transaction */
         <Q-1 run PostingSafCombinedForGLSaf (all) (Read) (Cache)
            (input tqPostingHistByYPLayerCyForMov.tiPostingSafCombined_ID, (PostingSafCombinedID)
             output dataset tqPostingSafCombinedForGLSaf) in BPostingSafHist>
         find tqPostingSafCombinedForGLSaf where
              tqPostingSafCombinedForGLSaf.tiPostingSafCombined_ID = tqPostingHistByYPLayerCyForMov.tiPostingSafCombined_ID
              no-error.
         if available tqPostingSafCombinedForGLSaf
         then do:
             assign ocSafStructureCode = tqPostingSafCombinedForGLSaf.tcGLSafStructureCode
                    ocSafParentType    = {&POSTINGSAFPARENTTYPE-GL}
                    ocSaf1Code         = tqPostingSafCombinedForGLSaf.tcGLSAFCode1
                    ocSaf2Code         = tqPostingSafCombinedForGLSaf.tcGLSAFCode2
                    ocSaf3Code         = tqPostingSafCombinedForGLSaf.tcGLSAFCode3
                    ocSaf4Code         = tqPostingSafCombinedForGLSaf.tcGLSAFCode4
                    ocSaf5Code         = tqPostingSafCombinedForGLSaf.tcGLSAFCode5
                    ocSafConcept1Code  = tqPostingSafCombinedForGLSaf.tcGLSafConceptCode1
                    ocSafConcept2Code  = tqPostingSafCombinedForGLSaf.tcGLSafConceptCode2
                    ocSafConcept3Code  = tqPostingSafCombinedForGLSaf.tcGLSafConceptCode3 
                    ocSafConcept4Code  = tqPostingSafCombinedForGLSaf.tcGLSafConceptCode4
                    ocSafConcept5Code  = tqPostingSafCombinedForGLSaf.tcGLSafConceptCode5.

         end. /* if available tqPostingSafCombinedForGLSaf */
     end. /* else do */
end. /* if tConsCOACrossRefResult.tlGLIsSafAccount = true */
else do:
    /* ================================================================================ */
    /* 3. Get the correct SAFs and SafConcepts in case target CostCentre is SAF enabled */
    /* ================================================================================ */
    if tConsCOACrossRefResult.tlCostCentreIsWithSaf = true
    then do:
         /* Take the default SAFs in case consolidation cycle is setup this way, or in case the source has no SAFs */
         if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithSaf = false or
            tqPostingHistByYPLayerCyForMov.tlCostCentreIsWithSaf = false
         then do:
             for each tqConsolidCycleSafByParentType where
                      tqConsolidCycleSafByParentType.tcConsolidCycleSafParentType = {&POSTINGSAFPARENTTYPE-COSTCENTRE}
                      by tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq:

                if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 1      
                then assign ocSaf1Code         = tqConsolidCycleSafByParentType.tcSafCode
                            ocSafConcept1Code  = tqConsolidCycleSafByParentType.tcSafConceptCode
                            ocSafStructureCode = tqConsolidCycleSafByParentType.tcSafStructureCode
                            ocSafParentType    = {&POSTINGSAFPARENTTYPE-COSTCENTRE}.
                if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 2
                then assign ocSaf2Code         = tqConsolidCycleSafByParentType.tcSafCode
                            ocSafConcept2Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
                if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 3      
                then assign ocSaf3Code         = tqConsolidCycleSafByParentType.tcSafCode
                            ocSafConcept3Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
                if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 4      
                then assign ocSaf4Code         = tqConsolidCycleSafByParentType.tcSafCode
                            ocSafConcept4Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
                if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 5      
                then assign ocSaf5Code         = tqConsolidCycleSafByParentType.tcSafCode
                            ocSafConcept5Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
             end.
         end.
         else do:
             /* Take the SAFs of the source transaction */
             <Q-3 run PostingSafCombinedForCCSaf (all) (Read) (Cache)
                (input tqPostingHistByYPLayerCyForMov.tiPostingSafCombined_ID, (PostingSafCombinedID)
                 output dataset tqPostingSafCombinedForCCSaf) in BPostingSafHist>
             find tqPostingSafCombinedForCCSaf where
                  tqPostingSafCombinedForCCSaf.tiPostingSafCombined_ID = tqPostingHistByYPLayerCyForMov.tiPostingSafCombined_ID
                  no-error.
             if available tqPostingSafCombinedForCCSaf
             then do:
                 assign ocSafStructureCode = tqPostingSafCombinedForCCSaf.tcCostCentreSafStructureCode
                        ocSafParentType    = {&POSTINGSAFPARENTTYPE-COSTCENTRE}
                        ocSaf1Code         = tqPostingSafCombinedForCCSaf.tcCostCentreSAFCode1
                        ocSaf2Code         = tqPostingSafCombinedForCCSaf.tcCostCentreSAFCode2
                        ocSaf3Code         = tqPostingSafCombinedForCCSaf.tcCostCentreSAFCode3
                        ocSaf4Code         = tqPostingSafCombinedForCCSaf.tcCostCentreSAFCode4
                        ocSaf5Code         = tqPostingSafCombinedForCCSaf.tcCostCentreSAFCode5
                        ocSafConcept1Code  = tqPostingSafCombinedForCCSaf.tcCCSafConceptCode1
                        ocSafConcept2Code  = tqPostingSafCombinedForCCSaf.tcCCSafConceptCode2
                        ocSafConcept3Code  = tqPostingSafCombinedForCCSaf.tcCCSafConceptCode3 
                        ocSafConcept4Code  = tqPostingSafCombinedForCCSaf.tcCCSafConceptCode4
                        ocSafConcept5Code  = tqPostingSafCombinedForCCSaf.tcCCSafConceptCode5.
             end. /* if available tqPostingSafCombinedForCostCentreSaf */
         end. /* else do */
    end. /* if tConsCOACrossRefResult.tlCostCentreIsWithSaf = true */
    else do:

        /* ============================================================================= */
        /* 3. Get the correct SAFs and SafConcepts in case target Project is SAF enabled */
        /* ============================================================================= */
        if tConsCOACrossRefResult.tlProjectIsWithSaf = true
        then do:
             /* Take the default SAFs in case consolidation cycle is setup this way, or in case the source has no SAFs */
             if tqConsolidCycleByCompanyID.tlConsolidCycleIsWithSaf = false or
                tqPostingHistByYPLayerCyForMov.tlProjectIsWithSaf    = false
             then do:
                 for each tqConsolidCycleSafByParentType where
                          tqConsolidCycleSafByParentType.tcConsolidCycleSafParentType = {&POSTINGSAFPARENTTYPE-PROJECT}
                          by tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq:

                    if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 1      
                    then assign ocSaf1Code         = tqConsolidCycleSafByParentType.tcSafCode
                                ocSafConcept1Code  = tqConsolidCycleSafByParentType.tcSafConceptCode
                                ocSafStructureCode = tqConsolidCycleSafByParentType.tcSafStructureCode
                                ocSafParentType    = {&POSTINGSAFPARENTTYPE-PROJECT}.
                    if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 2
                    then assign ocSaf2Code         = tqConsolidCycleSafByParentType.tcSafCode
                                ocSafConcept2Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
                    if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 3      
                    then assign ocSaf3Code         = tqConsolidCycleSafByParentType.tcSafCode
                                ocSafConcept3Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
                    if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 4      
                    then assign ocSaf4Code         = tqConsolidCycleSafByParentType.tcSafCode
                                ocSafConcept4Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
                    if tqConsolidCycleSafByParentType.tiConsolidCycleSafInputSeq = 5      
                    then assign ocSaf5Code         = tqConsolidCycleSafByParentType.tcSafCode
                                ocSafConcept5Code  = tqConsolidCycleSafByParentType.tcSafConceptCode.
                 end.
             end.
             else do:
                 /* Take the SAFs of the source transaction */
                 <Q-5 run PostingSafCombinedForPrjSaf (all) (Read) (Cache)
                    (input tqPostingHistByYPLayerCyForMov.tiPostingSafCombined_I, (PostingSafCombinedID)
                     output dataset tqPostingSafCombinedForPrjSaf) in BPostingSafHist>
                 find tqPostingSafCombinedForPrjSaf where
                      tqPostingSafCombinedForPrjSaf.tiPostingSafCombined_ID = tqPostingHistByYPLayerCyForMov.tiPostingSafCombined_ID
                      no-error.
                 if available tqPostingSafCombinedForPrjSaf
                 then do:
                     assign ocSafStructureCode = tqPostingSafCombinedForPrjSaf.tcProjectSafStructureCode
                            ocSafParentType    = {&POSTINGSAFPARENTTYPE-PROJECT}
                            ocSaf1Code         = tqPostingSafCombinedForPrjSaf.tcProjectSAFCode1
                            ocSaf2Code         = tqPostingSafCombinedForPrjSaf.tcProjectSAFCode2
                            ocSaf3Code         = tqPostingSafCombinedForPrjSaf.tcProjectSAFCode3
                            ocSaf4Code         = tqPostingSafCombinedForPrjSaf.tcProjectSAFCode4
                            ocSaf5Code         = tqPostingSafCombinedForPrjSaf.tcProjectSAFCode5
                            ocSafConcept1Code  = tqPostingSafCombinedForPrjSaf.tcPrjSafConceptCode1
                            ocSafConcept2Code  = tqPostingSafCombinedForPrjSaf.tcPrjSafConceptCode2
                            ocSafConcept3Code  = tqPostingSafCombinedForPrjSaf.tcPrjSafConceptCode3 
                            ocSafConcept4Code  = tqPostingSafCombinedForPrjSaf.tcPrjSafConceptCode4
                            ocSafConcept5Code  = tqPostingSafCombinedForPrjSaf.tcPrjSafConceptCode5.
                 end. /* if available tqPostingSafCombinedForProjectSaf */
             end. /* else do */
        end. /* if tConsCOACrossRefResult.tlProjectIsWithSaf = true */
    end. /* else do */
end. /* else do */
               
assign oiReturnStatus = viLocalReturnStatus.