project QadFinancials > class BBudget > method ValidateComponent
Description
This method will stop external instances, show error in case the system is not enabled for budgets, check OL-check property against system-properties, fill Company_ID in BudgetCompany based on the CompanyCode, validate Budget structure, check whether there will be a recipient to send e-mails if budget is marked for Send Errors or Send Warnings, validate partial dataload, validate BudgetFDS, validate the links between BudgetFDS and BudgetWBS, check the content of all new and changed BudgetWBS records, Perform validations that are dependant on the Actuals/Commitments.
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bbudget.p)
/* ======================= */
/* Stop external instances */
/* ======================= */
<M-77 run StopExternalInstances (output viFcReturnSuper (oiReturnStatus)) in BBudget>
/* ========================================================================= */
/* Cycle through the budgets to adapt the instance-data before validating it */
/* ========================================================================= */
for each t_sBudget:
/* =============================================================================== */
/* Assign some fixed or redudant fields */
/* =============================================================================== */
assign t_sBudget.BudgetGroupCategory = 1.
/* ============================================================================================= */
/* On the UI, when adding new company, it called createBudgetCompany to get the identity key. */
/* But user could remove it later, before merging them to be "D", it already disappered. */
/* It caused the initially created records are failed to mark as "D",still "N". */
/* So we use calculate field tcCompanyUpdateStatus to mark as "N" for the rows which added in UI.*/
/* Here roll back the value of tcCompanyUpdateStatus. */
/* ============================================================================================= */
for each t_sBudgetCompany where
t_sBudgetCompany.tc_ParentRowid = t_sBudget.tc_Rowid:
if t_sBudget.BudgetIsFRWLinked = true
then do:
if t_sBudgetCompany.tcCompanyUpdateStatus <> "M":U and
t_sBudgetCompany.tc_status = "N"
then assign t_sBudgetCompany.tc_Status = "D":U.
end. /* if t_sBudget.BudgetIsFRWLinked = true */
else do:
if t_sBudgetCompany.tcCompanyUpdateStatus <> "N":U and
t_sBudgetCompany.tc_status = "N"
then assign t_sBudgetCompany.tc_Status = "D":U.
end. /* Not if t_sBudget.BudgetIsFRWLinked = true */
assign t_sBudgetCompany.tcCompanyUpdateStatus = "":U.
end. /* for each t_sBudgetCompany where */
/* =============================================================================== */
/* Assign BudgetID on BudgetWBSBusComponent to improve the performance on dataload */
/* by using the OverridePrimary construction for db-reading BudgetWBSBusComponent */
/* =============================================================================== */
for each t_sBudgetWBS where
t_sBudgetWBS.tc_ParentRowid = t_sBudget.tc_Rowid:
assign t_sBudgetWBS.BudgetWBSSeq = decimal(t_sBudgetWBS.tcBudgetWBSSeqStr).
for each t_sBudgetWBSBusComponent where
t_sBudgetWBSBusComponent.tc_ParentRowid = t_sBudgetWBS.tc_Rowid :
if t_sBudgetWBSBusComponent.Budget_ID <> t_sBudget.Budget_ID and
t_sBudgetWBS.tc_Status <> "D":U and
t_sBudget.tc_Status <> "D":U and
(t_sBudgetWBSBusComponent.tc_Status = "N":U or
t_sBudgetWBSBusComponent.tc_Status = "C":U)
then assign t_sBudgetWBSBusComponent.Budget_ID = t_sBudget.Budget_ID.
end. /* for each t_sBudgetWBSBusComponent where */
end. /* for each t_sBudgetWBS where */
end. /* for each t_sBudget */
/* ================================== */
/* Check deletiong against the status */
/* ================================== */
if can-find(first t_sBudget where
t_sBudget.tc_Status = 'D':U and
t_sBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL} and
t_sBudget.BudgetStatus <> {&BUDGETSTATUS-VALID})
then do:
assign oiReturnStatus = -1
vcMessage = trim(#T-47'Budget in status Operational and Closed cannot be deleted.':255(544862483)T-47#).
<M-20 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-780192':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if can-find(first t_sBudget where */
/* ======================================================== */
/* Make sure that a structure line is present on the budget */
/* ======================================================== */
if not can-find(first t_sBudgetWBS where t_sBudgetWBS.tc_Status <> 'D':U) and
(can-find(first t_sBudget where
t_sBudget.tc_Status <> 'D':U and
t_sBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL}) or
can-find(first t_sBudget where
t_sBudget.tc_Status = 'D':U and
t_sBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL} and
t_sBudget.BudgetStatus <> {&BUDGETSTATUS-VALID}))
then do:
assign oiReturnStatus = -1
vcMessage = trim(#T-33'You must define at least one topic line in the Structure Tab':255(485584041)T-33#).
<M-44 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-663997':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if not can-find(first t_sBudgetWBS) */
/* =================================================== */
/* Error in case the system is not enabled for budgets */
/* Check OL-check property against system-properties */
/* =================================================== */
if can-find (first t_sBudget where
t_sBudget.tc_Status <> "":U and
t_sBudget.BudgetStatus = {&BUDGETSTATUS-OPERATIONAL}) and
vlSysPropertyIsWithBudget <> true
then do :
/* Budgetting */
assign oiReturnStatus = -1
vcMessage = trim(#T-51'No budget actions are allowed because the Budget module is disabled at the system.':255(999890575)T-51#) + chr(10) +
trim(#T-52'Use the System Maintenance activities to enable the system for budgets.':255(545)T-52#).
<M-49 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1943':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if can-find (first t_sBudget where */
if can-find (first t_sBudget where
t_sBudget.tc_status <> "":U)
then do:
/* Global-Budgets*/
if vlSysPropertyIsBudOLCheckGL = false
then do :
find first t_sBudget where
(t_sBudget.Project_ID = 0 or
t_sBudget.Project_ID = ?) and
(t_sBudget.CostCentre_ID = 0 or
t_sBudget.CostCentre_ID = ?) and
(t_sBudget.BudgetIsCheckActualOnLine = true or
t_sBudget.BudgetIsCheckCommitOnLine = true) and
(t_sBudget.tc_Status = "N":U or
t_sBudget.tc_Status = "C":U)
no-lock no-error.
if available t_sBudget
then do:
assign oiReturnStatus = -1
vcMessage = trim(#T-67'The online checks cannot be turned on for global budgets because this option is not enabled at system level.':255(16351)T-67#) + chr(10) +
trim(#T-68'To enable the system for this online check, use the System Maintain function.':255(16350)T-68#).
<M-65 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudget.BudgetIsCheckActualOnLine':U (icFieldName),
input t_sBudget.BudgetIsCheckActualOnLine (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3977':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if available t_sBudget */
end. /* if vlSysPropertyIsBudOLCheckGL */
/* Project-Budgets*/
if vlSysPropertyIsBudOLCheckPrj = false
then do :
find first t_sBudget where
t_sBudget.Project_ID <> 0 and
t_sBudget.Project_ID <> ? and
(t_sBudget.BudgetIsCheckActualOnLine = true or
t_sBudget.BudgetIsCheckCommitOnLine = true) and
(t_sBudget.tc_Status = "N":U or
t_sBudget.tc_Status = "C":U)
no-lock no-error.
if available t_sBudget
then do:
assign oiReturnStatus = -1
vcMessage = trim(#T-70'The online checks cannot be enabled for project budgets because this option is not enabled at system level.':255(16352)T-70#) + chr(10) +
trim(#T-71'To enable the system for this online check, use the System Maintain function.':255(16350)T-71#).
<M-69 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudget.BudgetIsCheckActualOnLine':U (icFieldName),
input t_sBudget.BudgetIsCheckActualOnLine (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3978':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if available t_sBudget */
end. /* if vlSysPropertyIsBudOLCheckPrj = false */
/* CostCentre-Budgets*/
if vlSysPropertyIsBudOLCheckCC = false
then do :
find first t_sBudget where
t_sBudget.CostCentre_ID <> 0 and
t_sBudget.CostCentre_ID <> ? and
(t_sBudget.BudgetIsCheckActualOnLine = true or
t_sBudget.BudgetIsCheckCommitOnLine = true) and
(t_sBudget.tc_Status = "N":U or
t_sBudget.tc_Status = "C":U)
no-lock no-error.
if available t_sBudget
then do:
assign oiReturnStatus = -1
vcMessage = trim(#T-73'The online checks cannot be enabled for cost center budgets because this option is not enabled at system level.':255(16353)T-73#) + chr(10) +
trim(#T-74'To enable the system for this online check, use the System Maintain function.':255(16350)T-74#).
<M-72 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudget.BudgetIsCheckActualOnLine':U (icFieldName),
input t_sBudget.BudgetIsCheckActualOnLine (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3979':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if available t_sBudget */
end. /* if vlSysPropertyIsBudOLCheckCC = false */
end. /* if can-find (first t_sBudget where */
/* ========================================================= */
/* Fill Company_ID in BudgetCompany based on the CompanyCode */
/* This cannot be done using RKBF because then the current */
/* company is then added as parameter value for the query. */
/* Assign Budget.BudgetType based upon other fields */
/* ========================================================= */
<M-56 run ValidateComponentBudgetCompany (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
/* ==================================================================================== */
/* In case the budget its structure was not yet validated, then this is done now */
/* The status cannot be set to 'Initial' when the previous status was not 'initial' */
/* The structure-validate should be tested when : */
/* - the budget is opened, the new status > init and the initial status = init */
/* This call will update the content of table t_sBudget and of t_sBudgetPeriod */
/* ==================================================================================== */
for each t_sBudget where
t_sBudget.tc_Status = "N":U or
t_sBudget.tc_Status = "C":U
no-lock :
find t_iBudget where
t_iBudget.tc_Rowid = t_sBudget.tc_Rowid
no-lock no-error.
if available t_iBudget and
t_iBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL} and
(t_sBudget.BudgetInputLevelBudget <> t_iBudget.BudgetInputLevelBudget or
t_sBudget.BudgetInputLevelEAC <> t_iBudget.BudgetInputLevelEAC or
t_sBudget.BudgetInputLevelFin <> t_iBudget.BudgetInputLevelFin)
then do :
assign oiReturnStatus = -1
vcMessage = trim(#T-53'The input level for budget figures / EAC figures / financial figures cannot be modified for active and operational budgets.':255(546)T-53#).
<M-50 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudget.BudgetStatus':U (icFieldName),
input t_sBudget.BudgetStatus (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1949':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /* if available t_iBudget */
if available t_iBudget and
t_iBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL} and
t_sBudget.BudgetStatus = {&BUDGETSTATUS-INITIAL}
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-54'The status of the budget &1 cannot be set to &2 if the budget previously had a different status.':255(547)T-54#,t_sBudget.BudgetCode,{&BUDGETSTATUS-INITIAL-TR})).
<M-2 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudget.BudgetStatus':U (icFieldName),
input t_sBudget.BudgetStatus (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-510':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /* if available t_iBudget */
/* ================================================================= */
/* Validate FRW chart and FRW chart company */
/* ================================================================= */
if t_sBudget.BudgetIsFRWLinked = true
then do:
empty temp-table tNewBudget.
empty temp-table tNewBudgetCompany.
create tNewBudget.
buffer-copy t_sBudget to tNewBudget.
for each t_sBudgetCompany where t_sBudgetCompany.tc_Status <> "D":U:
create tNewBudgetCompany.
buffer-copy t_sBudgetCompany to tNewBudgetCompany.
end. /* for each t_sBudgetCompany */
<M-506 run ValidateComponentValidateStructIsFRWChart
(input tNewBudget (tNewBudget),
input tNewBudgetCompany (tNewBudgetCompany),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end. /* if t_sBudget.BudgetIsFRWLinked = true */
if (available t_iBudget and
t_iBudget.BudgetStatus = {&BUDGETSTATUS-INITIAL} and
t_sBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL}) or
(t_sBudget.tc_Status = "N":U and
t_sBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL})
then do :
empty temp-table tNewBudget.
empty temp-table tNewBudgetPeriod.
empty temp-table tNewBudgetCompany.
empty temp-table tNewBudgetFDS.
create tNewBudget.
buffer-copy t_sBudget to tNewBudget.
for each t_sBudgetPeriod where t_sBudgetPeriod.tc_Status <> "D":U:
create tNewBudgetPeriod. buffer-copy t_sBudgetPeriod to tNewBudgetPeriod.
end. /* for each t_sBudgetPeriod */
for each t_sBudgetFDS where t_sBudgetFDS.tc_Status <> "D":U:
create tNewBudgetFDS. buffer-copy t_sBudgetFDS to tNewBudgetFDS.
end. /* for each t_sBudgetFDS */
for each t_sBudgetCompany where t_sBudgetCompany.tc_Status <> "D":U:
create tNewBudgetCompany.
buffer-copy t_sBudgetCompany to tNewBudgetCompany.
end. /* for each t_sBudgetCompany */
<M-1 run ValidateComponentValidateStruct
(input-output tNewBudget (tNewBudget),
input-output tNewBudgetPeriod (tNewBudgetPeriod),
input tNewBudgetCompany (tNewBudgetCompany),
input tNewBudgetFDS (tNewBudgetFDS),
input false (ilCopyContentToInstanceTables),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
Find tNewBudget where
tNewBudget.tc_Rowid = t_sBudget.tc_Rowid
no-error. /* This is needed as this temp-table was passed as param and the record we had focus on before the call */
/* will no longer be avail after the call */
if not available tNewBudget then next.
buffer-copy tNewBudget except tc_status to t_sBudget.
for each tNewBudgetPeriod no-lock :
find t_sBudgetPeriod where
t_sBudgetPeriod.tc_Rowid = tNewBudgetPeriod.tc_Rowid
no-error.
if not available t_sBudgetPeriod
then next.
buffer-copy tNewBudgetPeriod except tc_status to t_sBudgetPeriod.
if t_sBudgetPeriod.tc_Status = "":U then assign t_sBudgetPeriod.tc_Status = "C":U.
end. /* for each tNewBudgetPeriod */
end. /* if available t_iBudget and */
/* ============================================================== */
/* If budget is marked for Send Errors or Send Warnings, */
/* check whether there will be a recipient to send e-mails to. */
/* ============================================================== */
if t_sBudget.BudgetIsSendError or t_sBudget.BudgetIsSendWarning
then do:
if (t_sBudget.tcUsrLogin = "":U)
then do:
assign vcMessage = trim(#T-57'You must define a budget officer to receive e-mails if the budget is exceeded.':200(14483)T-57#)
oiReturnStatus = 1.
<M-58 run SetMessage
(input trim(vcmessage) (icMessage),
input '':U (icArguments),
input 'tBudget.tcUsrLogin':U (icFieldName),
input t_sBudget.tcUsrLogin (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sBudget.tc_Rowid (icRowid),
input 'QADFIN-3341':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /* if (t_sBudget.tcUsrLogin = "":U) */
else do:
<Q-59 run UserByNameID (first) (Read) (NoCache)
(input ?, (UsrId)
input ?, (UsrName)
input t_sBudget.tcUsrLogin, (UsrLogin)
output dataset tqUserByNameID) in BUser >
find first tqUserByNameID where
tqUserByNameID.tcUsrLogin = t_sBudget.tcUsrLogin
no-lock no-error.
if available(tqUserByNameID) and
(tqUserByNameID.tcUsrMailAddress = "":U or tqUserByNameID.tcUsrMailAddress = ?)
then do:
assign vcMessage = substitute(#T-60'No e-mail address is specified for the budget officer (&1). Therefore, no e-mails will be sent if the budget is exceeded.':200(14482)T-60#,
trim(t_sBudget.tcUsrLogin))
oiReturnStatus = 1.
<M-61 run SetMessage
(input trim(vcMessage) (icMessage),
input '':U (icArguments),
input 'tBudget.tcUsrLogin':U (icFieldName),
input t_sBudget.tcUsrLogin (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sBudget.tc_Rowid (icRowid),
input 'QADFIN-3342':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /* if available(tqUserByNameID ..... */
end. /* NOT if (t_sBudget.tcUsrLogin = "":U) */
end. /* if t_sBudget.BudgetIsSendError or t_sBudget.BudgetIsSendWarning */
/* ==================================================================================== */
/* Budget Periods; The Seq-field should be set based on the From-dates: Assign it here */
/* ==================================================================================== */
if can-find (first t_sBudgetPeriod where
t_sBudgetPeriod.tc_ParentRowid = t_sBudget.tc_Rowid and
t_sBudgetPeriod.tc_Status <> "D":U and
t_sBudgetPeriod.BudgetPeriodSeq = 0)
then do :
assign viNewRecordCounter = 0.
for each t_sBudgetPeriod where
t_sBudgetPeriod.tc_ParentRowid = t_sBudget.tc_Rowid and
t_sBudgetPeriod.tc_Status <> "D":U
by t_sBudgetPeriod.BudgetPeriodFromDate :
assign viNewRecordCounter = viNewRecordCounter + 1.
if t_sBudgetPeriod.BudgetPeriodSeq <> viNewRecordCounter
then do :
assign t_sBudgetPeriod.BudgetPeriodSeq = viNewRecordCounter.
if t_sBudgetPeriod.tc_Status = "":U then assign t_sBudgetPeriod.tc_Status = "C":U.
end. /* if t_sBudgetPeriod.BudgetPeriodSeq <> viNewRecordCounter */
end. /* for each t_sBudgetPeriod */
end. /* if t_sBudget.BudgetStatus = {&BUDGETSTATUS-INITIAL} and */
end. /* for each t_sBudget where */
/* ================================================================================== */
/* In case of errors; do not continue as the -ancestor- will reset the oiReturnStatus */
/* ================================================================================== */
if oiReturnStatus < 0 then return.
<ANCESTOR-CODE>
/* ========================================= */
/* Validations needed for GLRW budget check */
/* ========================================= */
for each t_sBudget where
t_sBudget.tc_Status <> "D":U
no-lock:
/* check if the budget already exists in the GLRW budget table */
<Q-85 assign vlFcQueryRecordsAvailable = MfgBudgetForBudgetCodeCheck (NoCache)
(input t_sBudget.BudgetCode, (MfgBudgetCode)
input vcMfgDomain, (DomainCode)) in BMfgBudget >
if vlFcQueryRecordsAvailable <> false
then do:
assign oiReturnStatus = -1
vcMessage = trim(#T-83'Cannot create budget - budget code is being used with GL Report Writer':255(71492)T-83#).
<M-82 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 't_sBudget.BudgetCode':U (icFieldName),
input t_sBudget.BudgetCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8692':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if vlFcQueryRecordsAvailable <> false */
end. /* for each t_sBudget where */
/* ========================================= */
/* Validations needed for a partial dataload */
/* ========================================= */
if vlActiveVersionOnly = true
then do :
<M-76 run ValidateComponentActiveVersionOnly (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end. /* if vlActiveVersionOnly = true */
/* ==================================== */
/* Validations needed for the BudgetFDS */
/* ==================================== */
<M-64 run ValidateComponentBudgetFDS (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
/* ================================================================ */
/* Validations needed for the links between BudgetFDS and BudgetWBS */
/* ================================================================ */
<M-46 run ValidateComponentBudgetFDSWBS (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
/* ============================================================================ */
/* Budgets that had status<>Init when loaded should fit a few restrictions; */
/* - Project and Cost-centre of the budget can no longer be changed */
/* - Company-dependant flag and SharedSet-IDs on budget cannot be changed */
/* - Sequence, Start- and end-date of the existing periods cannot be changed */
/* - Periods cannot be deleted */
/* - Every new company should fit the SharedSet-IDs on the header */
/* Note; this needs to be done after the anc-code of ValidateComponent because */
/* in the ancestore-code of this method the related key business-fields get set */
/* ============================================================================ */
<M-4 run ValidateComponentCheckUpdates (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
/* ======================================================================== */
/* Check the content of all new and changed BudgetWBS records */
/* This needs to be done in following cases : */
/* - all WBS of a new budget that is operational */
/* - all WBS of a changed budget that is now operational and wasn't before */
/* - all new/changed WBS for a changed and operational budget */
/* ======================================================================== */
BudgetWBSCheckFDSValuesBlock : Do:
assign viCounter = 0.
for each t_sBudget where
(t_sBudget.BudgetStatus = {&BUDGETSTATUS-VALID} or
t_sBudget.BudgetStatus = {&BUDGETSTATUS-OPERATIONAL}) and
/* (t_sBudget.tc_Status = "C":U or */
t_sBudget.tc_Status <> "D":U /* ) */,
each t_sBudgetWBS where
t_sBudgetWBS.tc_ParentRowid = t_sBudget.tc_Rowid,
first t_sBudgetCompany where
t_sBudgetCompany.tc_ParentRowid = t_sBudget.tc_Rowid :
find t_iBudget where
t_iBudget.tc_Rowid = t_sBudget.tc_Rowid
no-lock no-error.
if t_sBudget.tc_Status = "N":U or
(((available t_iBudget and t_iBudget.BudgetStatus <> {&BUDGETSTATUS-OPERATIONAL}) or
(t_sBudgetWBS.tc_Status = "C":U or t_sBudgetWBS.tc_Status = "N":U)))
then do :
assign viCounter = viCounter + 1.
leave.
end. /* if t_sBudget.tc_Status = "N":U or.. */
end. /* for each t_sBudget */
if viCounter = 0
then leave BudgetWBSCheckFDSValuesBlock.
for each t_sBudget where
(t_sBudget.BudgetStatus = {&BUDGETSTATUS-OPERATIONAL} or
t_sBudget.BudgetStatus = {&BUDGETSTATUS-VALID}) and
/* (t_sBudget.tc_Status = "C":U or */
t_sBudget.tc_Status <> "D":U /* ) */,
each t_sBudgetWBS where
t_sBudgetWBS.tc_ParentRowid = t_sBudget.tc_Rowid,
first t_sBudgetCompany where
t_sBudgetCompany.tc_ParentRowid = t_sBudget.tc_Rowid :
find t_iBudget where
t_iBudget.tc_Rowid = t_sBudget.tc_Rowid
no-lock no-error.
if t_sBudget.tc_Status = "N":U or
(((available t_iBudget and t_iBudget.BudgetStatus <> {&BUDGETSTATUS-OPERATIONAL}) or
(t_sBudgetWBS.tc_Status = "C":U or t_sBudgetWBS.tc_Status = "N":U)))
then do :
<M-5 run ValidateComponentBudgetWBS
(input t_sBudgetCompany.Company_ID (iiBudgetCompanyID),
input t_sBudgetWBS.tc_Rowid (icBudgetWBSTcRowid),
input t_sBudgetWBS.tc_Status (icBudgetWBStcStatus),
input t_sBudgetWBS.BudgetWBSCode (icBudgetWBSCode),
input t_sBudgetWBS.BudgetFDSType (icBudgetWBSFDSType),
input t_sBudgetWBS.BudgetFDSSeq (iiBudgetWBSFDSSeq),
input t_sBudgetWBS.BudgetWBSFDSCode (icBudgetWBSFDSCode),
input t_sBudgetWBS.BudgetWBSFDSList (icBudgetWBSFDSList),
input t_sBudgetWBS.BudgetWBSFDSFromCode (icBudgetWBSFDSFromCode),
input t_sBudgetWBS.BudgetWBSFDSToCode (icBudgetWBSFDSToCode),
input t_sBudgetWBS.BudgetWBSFDSDefault (icBudgetWBSFDSDefault),
input t_sBudgetWBS.BudgetGroup_ID (iiBudgetGroupID),
input t_sBudgetWBS.tcBudgetGroupCode (icBudgetGroupCode),
input t_sBudgetWBS.SafStructure_ID (iiSafStructureID),
input t_sBudgetWBS.tcSafStructureCode (icSafStructureCode),
input t_sBudgetWBS.SafConcept_ID (iiSafConceptID),
input t_sBudgetWBS.tcSafConceptCode (icSafConceptCode),
input t_sBudget.tcProjectCode (icBudgetProjectCode),
input t_sBudget.tcCostCentreCode (icBudgetCostCentreCode),
input t_sBudget.BudgetIsReportStruct (ilIsReportStructure),
input t_sBudgetWBS.AltCOAGroup_ID (iiAltCOAGroupID),
input t_sBudgetWBS.tcAltCOAGroupCode (icAltCOAGroupCode),
input t_sBudget.tcFRWChartCode (icFRWChartCode),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 and
(viFcReturnSuper < oiReturnStatus or
oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
end. /* if t_sBudget.tc_Status = "N":U or */
end. /* for each t_sBudgetWBS where */
if oiReturnStatus < 0 then return.
end. /* BudgetWBSCheckFDSValuesBlock */
/* ================================================================= */
/* Perform validations that are dependant on the Actuals/Commitments */
/* ================================================================= */
<M-21 run ValidateComponentBudgetLinkFigure (output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.