project QadFinancials > class BBudget > method ValidateComponentValidateStructIsReportStruct
Description
This submethod of ValidateComponentValidateStruct will validate Structure reports.
The GL account level is mandatory and has to be the first FDS element in the level hierarchy.
The other FDS elements are not mandatory but if they are used, they have to be in the sequence Sub-Account ? Cost Centre/Project. No (Sub)-Total levels are allowed within the FDS elements.
Parameters
ietnewbudget | input | recid | NewBudget |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bbudget.p)
assign vcMessage = "":U.
MAIN_BLOCK:
for each tnewbudget where
recid(tnewbudget) = ietnewbudget
no-lock:
/* === GL: should be first FDS === */
assign viFDSSequence = 0.
find first tNewBudgetFDS where
tNewBudgetFDS.tc_ParentRowid = tNewBudget.tc_Rowid and
tNewBudgetFDS.tc_Status <> "D":U and
tNewBudgetFDS.BudgetFDSType = {&BUDGETFDSTYPE-GL}
no-lock no-error.
if available tNewBudgetFDS
then do :
assign viFDSSequence = tNewBudgetFDS.BudgetFDSSeq.
find first tNewBudgetFDS where
tNewBudgetFDS.tc_ParentRowid = tNewBudget.tc_Rowid and
tNewBudgetFDS.tc_Status <> "D":U and
(tNewBudgetFDS.BudgetFDSType = {&BUDGETFDSTYPE-COSTCENTRE} OR
tNewBudgetFDS.BudgetFDSType = {&BUDGETFDSTYPE-PROJECT} OR
tNewBudgetFDS.BudgetFDSType = {&BUDGETFDSTYPE-DIVISION}) and
tNewBudgetFDS.BudgetFDSSeq < viFDSSequence
no-lock no-error.
if available tNewBudgetFDS
then do :
assign vcMessage = trim(substitute(#T-1'Budget structure level &1 can only have a GL account as the first COA element.':255(935636930)T-1#,trim({&BUDGETFDSTYPE-GL-TR}))).
Leave MAIN_BLOCK.
end. /* if available tNewBudgetFDS */
find first tNewBudgetFDS where
tNewBudgetFDS.tc_ParentRowid = tNewBudget.tc_Rowid and
tNewBudgetFDS.tc_Status <> "D":U and
tNewBudgetFDS.BudgetFDSType = {&BUDGETFDSTYPE-TOTAL} AND
tNewBudgetFDS.BudgetFDSSeq > viFDSSequence
no-lock no-error.
if available tNewBudgetFDS
then do :
assign vcMessage = trim(substitute(#T-2'Budget structure level &1 can only have a Totals row before the GL account or before the first COA element in the structure.':255(85260500)T-2#,trim({&BUDGETFDSTYPE-GL-TR}))).
Leave MAIN_BLOCK.
end. /* if available tNewBudgetFDS */
end. /* if available tNewBudgetFDS */
/* There is a possibility that the user only gave tha subtotal and directly division without GL , still this is not a Report Struct */
ELSE DO:
assign vcMessage = trim(substitute(#T-4'Budget structure level &1 can only Have Sub Totals preceding the GL account.':255(424098757)T-4#,trim({&BUDGETFDSTYPE-GL-TR}))).
Leave MAIN_BLOCK.
END.
End.
if vcMessage <> "":U
then do :
ASSIGN oiReturnStatus = -1.
<M-3 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-6330':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /* if vcMessage <> "":U */