project QadFinancials > class BBudget > method BudgetVersionRollUpAmountsFig

Description

This method is the submehtod of BudgetVersionRollUpAmounts because it could not hold all the code.


Parameters


icBudgetVersionTcRowidinputcharacterBudgetVersionTcRowid; Rowid of the source BudgetVersion
tNewBudgetVersionFigureinput-outputtemp-tabletNewBudgetVersionFigure
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBudget.BudgetVersionRollUpAmounts


program code (program6/bbudget.p)

/* ======================================================================================== */
/* Reset the amounts for nodes that do have childs                                          */
/* ======================================================================================== */
assign vhtable = BUFFER tNewBudgetVersionFigure:HANDLE.
for each tNewBudgetVersionFigure where 
         tNewBudgetVersionFigure.tc_ParentRowid  = icBudgetVersionTcRowid and 
         tNewBudgetVersionFigure.tc_rowid       <> "D":U:
    /* reset all values of nodes that are different than level defined on budget (for the specific type)*/
    if tNewBudgetVersionFigure.tiBudgetFDSSeq <> tBudget.BudgetInputLevelBudget
    then do vimonth = 1 TO 24: /* same fields only number is different */
        assign vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "TC":U):buffer-value  = 0
               vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "QTY":U):buffer-value = 0
               vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "STC":U):buffer-value = 0.
    end.
    if tNewBudgetVersionFigure.tiBudgetFDSSeq <> tBudget.BudgetInputLevelEAC
    then do vimonth = 1 TO 24: /* same fields only number is different */
        assign vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "EacTC":U):buffer-value  = 0
               vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "EacQTY":U):buffer-value = 0
               vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "SEacTC":U):buffer-value = 0.
    end.
    if tNewBudgetVersionFigure.tiBudgetFDSSeq <> tBudget.BudgetInputLevelFin
    then do vimonth = 1 TO 24: /* same fields only number is different */
        assign vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "FinTC":U):buffer-value  = 0
               vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "FinQTY":U):buffer-value = 0
               vhtable:buffer-field("BudgetVersionFigure":U + string(vimonth,"99":U) + "SFinTC":U):buffer-value = 0.
    end.
end. /* for each tNewBudgetVersionFigure where  */
delete object vhtable.

/* ======================================================================================== */
/* Go through all Figures that are located on the bottom-nodes (they have no childs)        */
/* and add the amount of these nodes to all parent-nodes of the bottom-node.                */
/* ======================================================================================== */
/* rollup the BUDGET figures */
<M-1 run BudgetVersionRollUpAmountsFigBud
          (input  icBudgetVersionTcRowid (icBudgetVersionTcRowid), 
           output oiReturnStatus (oiReturnStatus)) in BBudget>
if oiReturnStatus <> 0 
then return.
/* rollup the FIN figures */
<M-2 run BudgetVersionRollUpAmountsFigFin (input  icBudgetVersionTcRowid (icBudgetVersionTcRowid), 
                                           output oiReturnStatus (oiReturnStatus)) in BBudget>
if oiReturnStatus <> 0 
then return.
/* rollup the EACfigures */
<M-3 run BudgetVersionRollUpAmountsFigEac (input  icBudgetVersionTcRowid (icBudgetVersionTcRowid), 
                                           output oiReturnStatus (oiReturnStatus)) in BBudget>
if oiReturnStatus <> 0 
then return.