project QadFinancials > class BFRWChart > method AdditionalUpdateBudgetCompany

Description

When report chart entities are updated, in budget, the companies should also been updated.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWChart.AdditionalUpdates


program code (program5/bfrwchart.p)

/* ====================================================================================== *
 * Method       : AdditionalUpdateBudgetCompany                                           *
 * ====================================================================================== */
 
MAIN_BLOCK:
do on error undo, throw: 
    empty temp-table tBudgetCompanyInFRW.
    assign vcBudgetIDs = '':U.
    if viBBudgetBFRWChartID = 0 or viBBudgetBFRWChartID = ? 
    then do:
        <I-74 {bFcStartAndOpenInstance
             &ADD-TO-TRANSACTION   = "true"
             &CLASS                = "BBudget"}>
    end.
    else do:
        <I-50 {bFcOpenInstance
               &CLASS           = "BBudget"}>
    end.
    
    /* DataLoad budget linked by this report chart */
    for each tFRWChart:
        
        <Q-19 run BudgetByFRWChartId (all) (Read) (NoCache)
            (input tFRWChart.FRWChart_ID, (FRWChartId)
             output dataset tqBudgetByFRWChartId) in BBudget>
        if (not can-find(first tqBudgetByFRWChartId)) then 
            next.
        for each tqBudgetByFRWChartId:
            if vcBudgetIDs <> '':U then
                assign vcBudgetIDs = vcBudgetIDs + ",":U.
            assign vcBudgetIDs = vcBudgetIDs + string(tqBudgetByFRWChartId.tiBudget_ID).
        end.
        for each tFRWCompany where tFRWCompany.tc_ParentRowid = tFRWChart.tc_Rowid AND 
                                   (tFRWCompany.tc_Status = 'N':U or tFRWCompany.tc_Status = 'D':U):
            create tBudgetCompanyInFRW.
            assign tBudgetCompanyInFRW.Company_ID = tFRWCompany.Company_ID
                   tBudgetCompanyInFRW.tcCompanyCode = tFRWCompany.FRWCompanyCode
                   tBudgetCompanyInFRW.tc_Status = tFRWCompany.tc_Status
                   tBudgetCompanyInFRW.tc_RowID  = tFRWCompany.tc_RowID.
            
        end. /*  for each tChartCOACrossRef */
    end.
    <M-75 run UpdateBudgetCompanyFromChart
          (input  tBudgetCompanyInFRW (tNewBudgetCompany), 
           input  vcBudgetIDs (icBudgetIDs),
           output viFcReturnSuper (oiReturnStatus)) in BBudget>

    if viFcReturnSuper < 0 or oiReturnStatus  = 0
        then assign oiReturnStatus = viFcReturnSuper.

    <I-61 {bFcCloseInstance
            &CLASS           = "BBudget"}>
    

end. /* MAIN_BLOCK */