project QadFinancials > class BBudget > method ValidateComponentValidateStructIsFRWChart
validation procedure
Description
This method will validate the FRW chart
Parameters
Internal usage
QadFinancials
program code (program5/bbudget.p)
/* ======================================================= */
/* Go through all non deleted budgets */
/* ======================================================= */
for each tNewBudget where
tNewBudget.tc_Status <> "D":U :
assign vcMessage = "":U.
NEWBUDGETFRWBLOCK: do :
/* ================================================================= */
/* Check if FRWChart Code is Empty */
/* ================================================================= */
if tNewBudget.tcFRWChartCode = ? or
tNewBudget.tcFRWChartCode = "":U
then do:
assign vcMessage = trim(#T-27'You have selected the Use in Financial Report Writer field. You must specify a value in the Report Chart field.':255(787177155)T-27#)
oiReturnStatus = -1.
end.
else do:
<Q-61 run FRWChartByCode (all) (Read) (NoCache)
(input tNewBudget.tcFRWChartCode, (FRWChartCode)
output dataset tqFRWChartByCode) in BFRWChart>
find first tqFRWChartByCode no-lock no-error.
if not available tqFRWChartByCode
then assign vcMessage = trim(#T-23'The report chart specified does not exist.':255(41853475)T-23#)
oiReturnStatus = -1.
end.
if oiReturnStatus = -1
then do:
<M-32 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-153625':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
leave NEWBUDGETFRWBLOCK.
end.
/* ================================================================= */
/* Entity Empty check */
/* ================================================================= */
find first tNewBudgetCompany where
tNewBudgetCompany.tc_ParentRowid = tNewBudget.tc_Rowid and
tNewBudgetCompany.tcCompanyCode <> "":U and
tNewBudgetCompany.tcCompanyCode <> ? and
tNewBudgetCompany.tc_Status <> "D":U
no-lock no-error. /* no-error was checked in the beginning of this method but there was no error */
if not available tNewBudgetCompany
then do:
assign vcMessage = trim(#T-12'A report chart must be linked to at least one entity.':255(733903188)T-12#)
oiReturnStatus = -1.
<M-76 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-671903':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
leave NEWBUDGETFRWBLOCK.
end.
/* ================================================================= */
/* Check if all of the Company belongs to the same FRW Chart */
/* ================================================================= */
assign viFRWChart_ID = tNewBudget.FRWChart_ID.
<Q-78 run FRWCompanyByFRWChartID (all) (Read) (NoCache)
(input ?, (CompanyId)
input viFRWChart_ID, (FRWChart_ID)
output dataset tqFRWCompanyByFRWChartID) in BFRWChart>
if not can-find(first tqFRWCompanyByFRWChartID where tqFRWCompanyByFRWChartID.tiCompany_ID = viCompanyId) then
do:
assign vcMessage = trim(substitute(#T-39'The specified chart &1 does not include the current entity &2.':255(210886030)T-39#,tNewBudget.tcFRWChartCode,vcCompanyCode ))
oiReturnStatus = 3.
<M-31 run SetMessage
(input vcMessage (icMessage),
input ? (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input tNewBudget.tc_Rowid (icRowid),
input 'qadfin-645175':U (icFcMsgNumber),
input ? (icFcExplanation),
input ? (icFcIdentification),
input ? (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end.
if not vlIsCalledFromReportChart then
do:
for each tNewBudgetCompany where
tNewBudgetCompany.tc_ParentRowid = tNewBudget.tc_Rowid and
tNewBudgetCompany.tc_Status <> "D":U and
tNewBudgetCompany.tcCompanyCode <> "":U and
tNewBudgetCompany.tcCompanyCode <> ?
no-lock :
if not can-find (first tqFRWCompanyByFRWChartID
where tqFRWCompanyByFRWChartID.tcCompanyCode = tNewBudgetCompany.tcCompanyCode )
then do:
assign vcMessage = trim(substitute(#T-53'Entity &1 is not linked to report chart &2.':255(818126799)T-53#,
tNewBudgetCompany.tcCompanyCode, tNewBudget.tcFRWChartCode))
oiReturnStatus = -1.
<M-94 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-343905':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /*if not can-find (first tqFRWCompanyByFRWChartID */
end. /*for each */
end.
end. /* NEWBUDGETFRWBLOCK */
end. /* for each */