project QadFinancials > class BFRWAnalysisCode > method AdditionalUpdatesReportTree


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWAnalysisCode.AdditionalUpdates


program code (program1/bfrwanalysiscode.p)

/* Report Tree Node Description is duplicated field for FRWANCODEDESCRIPTION 
   When refresh analysis code description, the tree node descirption needs to
   be updated too. 
*/
assign vcFRWTreeNodeIDs   = '':U
       vlStartBReportTree = no.

for each tFRWAncode where tFRWAncode.tc_Status = 'C':U:
    find first t_iFRWAncode where t_iFRWAncode.FRWAnCode_ID = tFRWAnCode.FRWAnCode_ID no-error.
    if available t_iFRWAncode and tFRWAnCode.FRWAnCodeDescription <> t_iFRWAnCode.FRWAnCodeDescription 
    then do:
        <Q-96 run ReportTreeByAnalysisCodeId (all) (Read) (NoCache)
           (input tFRWAnCode.FRWAnCode_ID, (AnalysisCodeId)
            output dataset tqReportTreeByAnalysisCodeId) in BReportTree>
        if not can-find(first tqReportTreeByAnalysisCodeId) then
           next.
        for each tqReportTreeByAnalysisCodeId:          
            find first tReportTreeDeleteList where tReportTreeDeleteList.tiFRWTreeNode_ID = tqReportTreeByAnalysisCodeId.tiFRWTreeNode_ID no-error.
            if not available tReportTreeDeleteList then
            do:
                if vcFRWTreeNodeIDs <> '':U then
                assign vcFRWTreeNodeIDs = vcFRWTreeNodeIDs + chr(4).
            
                assign vcFRWTreeNodeIDs = vcFRWTreeNodeIDs + string(tqReportTreeByAnalysisCodeId.tiFRWTreeNode_ID).
            end.
        end.
        if vcFRWTreeNodeIDs <> '':U then
        do:
            if not vlStartBReportTree then
            do:
                /*start component BFRWTreeNode */
                if viBReportTreeID = 0 or viBReportTreeID = ? then
                do:
                    <I-16 {bFcStartAndOpenInstance
                         &ADD-TO-TRANSACTION   = "yes"
                         &CLASS                = "BReportTree"}>
                end.
                else do:
                    <I-7 {bFcOpenInstance
                         &CLASS           = "BReportTree"}>
                end.
                assign vlStartBReportTree = yes.
            end.
            <M-40 run UpdateReportTreeNodeDesc
               (input  vcFRWTreeNodeIDs (icFRWTreeNodeIDs), 
                input  tFRWAnCode.FRWAnCodeDescription (icFRWAnCodeDescription), 
                output viFcReturnSuper (oiReturnStatus)) in BReportTree>
            if viFcReturnSuper < 0 then 
            do:
                assign oiReturnStatus = viFcReturnSuper.
                <I-42 {bFcCloseInstance
                     &CLASS           = "BReportTree"}>
                return.
            end.
        end. /* end if vcFRWTreeNodeIDs <> '':U  */
        assign vcFRWTreeNodeIDs = '':U.
    end. /* end if available t_iFRWAncode and tFRWAnCode.FRWAnCodeDescription <> t_iFRWAnCode.FRWAnCodeDescription */
end. /* end for each tFRWAncode where tc_Status = 'C' */

if vlStartBReportTree then
do:
    
    <M-6 run DataSave  (output viFcReturnSuper (oiReturnStatus)) in BReportTree>
    
    If viFcReturnSuper <> 0
    Then Assign oiReturnStatus = viFcReturnSuper.

    if viFcReturnSuper < 0 then
    do:
        <I-33 {bFcCloseInstance
             &CLASS           = "BReportTree"}>
        return.
    end.

    <I-52 {bFcCloseInstance
         &CLASS           = "BReportTree"}>
end.

assign oiReturnStatus  = 0.