project QadFinancials > class BBudget > method ApiGetBudgetWBSDeleteChilds
Description
This sub-method of ApiGetBudgetWBS will delete the childs of a certain WBS-node in table tqBudgetWBSByBudgetID. At the moment this method gets called, all tqBudgetWBSByBudgetID shoudl be accessible.
Do note that this is a recursive method, so be carefull when making changes.
Parameters
iiParentBudgetWBSID | input | integer | ParentBudgetWBSID; BudgetWBS_ID (parent) of the nodes that needs to be removed (including all their childs) |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program9/bbudget.p)
/* ============================================================================== */
/* If ilSkipDraftNodes or ilSkipJointOperResNodes or ilSkipOverheadNodes is true, */
/* then delete some tViewBudgetWBS and tViewBudgetWBSFigures records */
/* In case a delete of a record is needed, then following actions should be done: */
/* 1. Delete the child record of the current tViewBudgetWBS record and */
/* their linked tViewBudgetWBSFigures records */
/* 2. Decrease the amounts of the parent tViewBudgetWBSFigures records */
/* 3. Delete the current tViewBudgetWBS record */
/* ============================================================================== */
/* ============================================================================== */
/* Do note that this is a recursive method, so be carefull when making changes. */
/* ============================================================================== */
/* ================================= */
/* Go through all childs of the node */
/* ================================= */
for each btViewBudgetWBS where
btViewBudgetWBS.tiParentBudgetWBSID = iiParentBudgetWBSID :
/* ================================================== */
/* Delete the figures of the nodes */
/* ================================================== */
for each btViewBudgetWBSFigures where
btViewBudgetWBSFigures.tiBudgetWBSID = btViewBudgetWBS.tiBudgetWBSID :
delete btViewBudgetWBSFigures.
end. /* for each btViewBudgetWBSFigures where */
/* ================================================ */
/* Hold the new ID */
/* ================================================ */
assign iiParentBudgetWBSID = btViewBudgetWBS.tiBudgetWBSID.
/* =============== */
/* Delete the node */
/* =============== */
delete btViewBudgetWBS.
/* ================================================ */
/* Recursively run this method to delete all childs */
/* ================================================ */
<M-1 run ApiGetBudgetWBSDeleteChilds (input iiParentBudgetWBSID (iiParentBudgetWBSID),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end. /* for each tViewBudgetWBSFigures where */