project QadFinancials > class BBudget > method ValidateComponentValidateStructDetSub
Description
This submethod of ValidateComponentValidateStructDet will validate BudgetForecastType.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bbudget.p)
/* BudgetForecastType can not be changed once the BudgetStatus is no longer initial */
find t_iBudget where
t_iBudget.tc_Rowid = tNewBudget.tc_Rowid
no-lock no-error.
if available t_iBudget and
t_iBudget.BudgetStatus <> {&BUDGETSTATUS-INITIAL} and
t_iBudget.BudgetForecastType <> tNewBudget.BudgetForecastType
then do:
assign vcMessage = trim(substitute(#T-8'The forecast type of a budget cannot be modified if the budget no longer has the status &1.':255(790359234)T-8#,{&BUDGETSTATUS-INITIAL-TR}))
oiReturnStatus = -1.
<M-7 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudget.BudgetForecastType':U (icFieldName),
input tNewBudget.BudgetForecastType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-4166':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end.
if tNewBudget.BudgetForecastType = {&BUDGETFORECASTTYPE-ETC}
then do:
/* more than 1 budgetperiod */
assign viNewBudgetPeriodCounter = 0.
for each tNewBudgetPeriod where
tNewBudgetPeriod.tc_Status <> 'D':U:
assign viNewBudgetPeriodCounter = viNewBudgetPeriodCounter + 1.
end.
if viNewBudgetPeriodCounter > 1
then do:
assign vcMessage = trim(substitute(#T-4'The forecast type cannot be set to &1 for budgets with more than one budget period.':255(929779192)T-4#,{&BUDGETFORECASTTYPE-ETC-TR}))
oiReturnStatus = -1.
<M-1 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-4163':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end.
/* budgettype is Global */
if (tNewBudget.tcProjectCode = '':U or tNewBudget.tcProjectCode = ?) and
(tNewBudget.tcCostCentreCode = '':U or tNewBudget.tcCostCentreCode = ?)
then do:
assign vcMessage = trim(substitute(#T-6'The forecast type cannot be set to &1 for budgets with budget type &2.':255(255698153)T-6#,{&BUDGETFORECASTTYPE-ETC-TR},{&BUDGETTYPE-GLOBAL-TR}))
oiReturnStatus = -1.
<M-3 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudget.BudgetType':U (icFieldName),
input tNewBudget.BudgetType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-4165':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end.
end.