project QadFinancials > class BBudget > method UpdateBudgetCompanyFromChart
Description
Update Budget Company From report chart of accounts maintenance.
Parameters
tNewBudgetCompany | input | temp-table | Budget Company. |
icBudgetIDs | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bbudget.p)
/* ====================================================================================== *
* Method : UpdateBudgetCompanyFromChart *
* Description : Update budget company *
* -------------------------------------------------------------------------------------- *
* Parameters : tNewBudgetCompany, provide add/remove the detail info of companies *
* ====================================================================================== */
MAIN_BLOCK:
do on error undo, throw:
/* Check input */
if icBudgetIDs = ? or icBudgetIDs = '':U then leave MAIN_BLOCK.
if not can-find(first tNewBudgetCompany) then leave MAIN_BLOCK.
/* Load Budget */
<M-91 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave MAIN_BLOCK.
<M-71 run DataLoad
(input ? (icRowids),
input ? (icPkeys),
input icBudgetIDs (icObjectIds),
input ? (icFreeform),
input ? (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave MAIN_BLOCK.
/* Add/Delete Budget Company */
for each tNewBudgetCompany:
if tNewBudgetCompany.tc_Status = 'D':U
then do:
for each tBudgetCompany where tBudgetCompany.Company_ID = tNewBudgetCompany.Company_ID:
assign tBudgetCompany.tc_Status = 'D':U.
end. /* End for each tBudgetCompany*/
end. /* End if tNewBudgetCompany.tc_Status = 'D'*/
else if tNewBudgetCompany.tc_Status = 'N':U
then do:
for each tBudget:
if not can-find(first tBudgetCompany where tBudgetCompany.Budget_ID = tBudget.Budget_ID and
tBudgetCompany.Company_ID = tNewBudgetCompany.Company_ID)
then do:
<M-97 run AddDetailLine
(input 'BudgetCompany':U (icTable),
input tBudget.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
assign tBudgetCompany.Budget_ID = tBudget.Budget_ID
tBudgetCompany.Company_ID = tNewBudgetCompany.Company_ID
tBudgetCompany.tcCompanyCode = tNewBudgetCompany.tcCompanyCode
tBudgetCompany.tcCompanyUpdateStatus = 'M':U.
end. /* End if not can-find tBudgetCompany */
end. /* End for each tBudget */
end. /* End for each tNewBudgetCompany = 'N' */
end. /* End for each tNewBudgetCompany */
/* Pre-validation block */
assign vlIsCalledFromReportChart = yes.
<M-94 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave MAIN_BLOCK.
<M-23 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave MAIN_BLOCK.
<M-25 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave MAIN_BLOCK.
end. /* MAIN_BLOCK */
/* Reset the class variable. */
assign vlIsCalledFromReportChart = no.