project QadFinancials > class BBudget > method ApiGetBudgetWBSWithFiguresRollUp

Description

This sub-method of ApiGetBudgetWBSWithFiguresSub perform some additional assignments to the View-tables that are the output of it's parent method.
This method was created because the parent-method could not contain all code.


Parameters


iiBudgetIDinputintegerBudget ID
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBudget.ApiGetBudgetWBSWithFigures


program code (program9/bbudget.p)

/* ===================================================================================================== */
    /* Go through budgetWBSFigures and Rollup the Commitments and the Actuals in table tViewBudgetWBSFigures */
    /* Involved fields; tdCommitCostTC, tdCommitQTY, tdActualRevenueTC, tdActualCostTC and tdActualQTY       */
    /* These fields are only filled in on the lowest nodes in the tree so their values should be propagated  */
    /* to all parent-nodes in the tree. We will first re-initialise all these fields for the nodes that have */
    /* childs and then we will propagete the values of the nodes wihtou childs to allothers                  */
    /* ===================================================================================================== */
    for each tViewBudgetWBSFigures where 
             tViewBudgetWBSFigures.tiBudgetID = iiBudgetID :
        if can-find (first btViewBudgetWBSFigures where 
                           btViewBudgetWBSFigures.tiParentBudgetWBSID = tViewBudgetWBSFigures.tiBudgetWBSID)
        then assign tViewBudgetWBSFigures.tdCommitCostTC    = 0
                    tViewBudgetWBSFigures.tdCommitQTY       = 0
                    tViewBudgetWBSFigures.tdActualRevenueTC = 0
                    tViewBudgetWBSFigures.tdActualCostTC    = 0
                    tViewBudgetWBSFigures.tdActualQTY       = 0.
    end. /* for each tViewBudgetWBSFigures where */
    for each tViewBudgetWBSFigures where 
             tViewBudgetWBSFigures.tiBudgetID = iiBudgetID :
        if can-find (first btViewBudgetWBSFigures where 
                           btViewBudgetWBSFigures.tiParentBudgetWBSID = tViewBudgetWBSFigures.tiBudgetWBSID)
        then next.
        assign viParentBudgetWBSID = tViewBudgetWBSFigures.tiParentBudgetWBSID.
        repeat :
            find btViewBudgetWBSFigures where
                 btViewBudgetWBSFigures.tiBudgetWBSID = viParentBudgetWBSID 
                 no-error.
            if not available btViewBudgetWBSFigures
            then leave.
            assign viParentBudgetWBSID                      = btViewBudgetWBSFigures.tiParentBudgetWBSID 
                   btViewBudgetWBSFigures.tdCommitCostTC    = btViewBudgetWBSFigures.tdCommitCostTC + tViewBudgetWBSFigures.tdCommitCostTC
                   btViewBudgetWBSFigures.tdCommitQTY       = btViewBudgetWBSFigures.tdCommitQTY + tViewBudgetWBSFigures.tdCommitQTY
                   btViewBudgetWBSFigures.tdActualRevenueTC = btViewBudgetWBSFigures.tdActualRevenueTC + tViewBudgetWBSFigures.tdActualRevenueTC
                   btViewBudgetWBSFigures.tdActualCostTC    = btViewBudgetWBSFigures.tdActualCostTC + tViewBudgetWBSFigures.tdActualCostTC
                   btViewBudgetWBSFigures.tdActualQTY       = btViewBudgetWBSFigures.tdActualQTY + tViewBudgetWBSFigures.tdActualQTY.
            if viParentBudgetWBSID = 0 or
               viParentBudgetWBSID = ?
            then leave.
        end. /* repeat */
    end. /* for each tViewBudgetWBSFigures where */