project QadFinancials > class BFRWChart > method AdditionalUpdateCOACrossRef

Description

AdditionalUpdate for COACrossRef


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWChart.AdditionalUpdates


program code (program5/bfrwchart.p)

/* ====================================================================================== *
 * Method       : AdditionalUpdateCOACrossRef                                             *
 * ====================================================================================== */
 
MAIN_BLOCK:
do on error undo, throw: 

    for each tChartCOACrossRef:
        find first tFRWShSetComb where tFRWShSetComb.FRWShSetComb_ID = tChartCOACrossRef.tiFRWShSetCombId no-error.
        if available tFRWShSetComb 
        then do:
            case tChartCOACrossRef.tcSharedSetType:
                when {&SHAREDSETTYPE-GL} then 
                assign tFRWShSetComb.FRWShSetCombGLCOACRCode = tChartCOACrossRef.tcCOACrossRefCode
                       tFRWShSetComb.GLCOACrossRef_ID = tChartCOACrossRef.tiCOACrossRefId.
                when {&SHAREDSETTYPE-DIVISION} then 
                assign tFRWShSetComb.FRWShSetCombDivCOACRCode = tChartCOACrossRef.tcCOACrossRefCode
                       tFRWShSetComb.DivCOACOACrossRef_ID = tChartCOACrossRef.tiCOACrossRefId.     
                when {&SHAREDSETTYPE-COSTCENTRE} then 
                assign tFRWShSetComb.FRWShSetCombCCCOACRCode = tChartCOACrossRef.tcCOACrossRefCode
                       tFRWShSetComb.CCCOACOACrossRef_ID = tChartCOACrossRef.tiCOACrossRefId.                                
                when {&SHAREDSETTYPE-PROJECT} then 
                assign tFRWShSetComb.FRWShSetCombPrjCOACRCode = tChartCOACrossRef.tcCOACrossRefCode
                       tFRWShSetComb.PrjCOACOACrossRef_ID = tChartCOACrossRef.tiCOACrossRefId.  
                when {&COACROSSREFTYPE-COMBINED} then 
                assign tFRWShSetComb.FRWShSetCombCombCOACRCode = tChartCOACrossRef.tcCOACrossRefCode
                       tFRWShSetComb.CombCOACOACrossRef_ID = tChartCOACrossRef.tiCOACrossRefId. 
            end case.
        end. /* if available sFRWShSetComb */ 
    end. /*  for each tChartCOACrossRef */

    if can-find (first tCOACrossRefForSave)
    then do:
    
        /* Update COACrossRef */
        if viBCOACrossRef10ID = 0 or viBCOACrossRef10ID = ?
        then do:
            <I-73 {bFcStartAndOpenInstance
                 &ADD-TO-TRANSACTION   = "true"
                 &CLASS                = "BCOACrossRef"}>
    
        end. /* if viBCOACrossRef10ID = 0 or viBCOACrossRef10ID = ? */
        else do:
            <I-84 {bFcOpenInstance
                 &CLASS           = "BCOACrossRef"}>
        end. /* else do */
    
        <M-40 run UpdateCOACrossRef
           (input-output tCOACrossRefForSave (tCOACrossRefForSaveFromChart), 
            output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef>
    
        if viFcReturnSuper < 0 or oiReturnStatus  = 0
        then assign oiReturnStatus = viFcReturnSuper.      
    
         <I-6 {bFcCloseInstance
              &CLASS           = "BCOACrossRef"}>
        
    end. /* if can-find (first tChartCOACrossRef) */

    for each tCOACrossRefForSave where tCOACrossRefForSave.tcStatus = "N":U:
        find first tFRWShSetComb where tFRWShSetComb.FRWShSetComb_ID = tCOACrossRefForSave.tiFRWShSetCombId no-error.
        if available tFRWShSetComb
        then do:
            case tCOACrossRefForSave.tcSharedSetType:
            when {&SHAREDSETTYPE-GL} then assign tFRWShSetComb.GLCOACrossRef_ID = tCOACrossRefForSave.tiCOACrossRefId.
            when {&SHAREDSETTYPE-DIVISION} then assign tFRWShSetComb.DivCOACOACrossRef_ID = tCOACrossRefForSave.tiCOACrossRefId.
            when {&SHAREDSETTYPE-COSTCENTRE} then assign tFRWShSetComb.CCCOACOACrossRef_ID = tCOACrossRefForSave.tiCOACrossRefId.
            when {&SHAREDSETTYPE-PROJECT} then assign tFRWShSetComb.PrjCOACOACrossRef_ID = tCOACrossRefForSave.tiCOACrossRefId.
            when {&COACROSSREFTYPE-COMBINED} then assign tFRWShSetComb.CombCOACOACrossRef_ID = tCOACrossRefForSave.tiCOACrossRefId. 
            end.
        end.
    end.

end. /* MAIN_BLOCK */