project QadFinancials > class BCashReport > method ValidateRecalculateParams
Parameters
oiDivisionID | output | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bcashreport.p)
/********************************************************************************************/
/* INFO: tCashReport is already available because */
/* the calling method (Recalculate) is located in the same segment. */
/********************************************************************************************/
assign oiReturnStatus = -98.
/********************************************************************************************/
/* Validate Days Interval */
/********************************************************************************************/
if tCashReport.CashReportDaysInterval = 0 or tCashReport.CashReportDaysInterval = ?
then do:
assign vcCashReportMsg = #T-4'You must enter the interval (in days).':200(14045)T-4#
oiReturnStatus = -1.
<M-3 run SetMessage (input trim(vcCashReportMsg) (icMessage),
input '':U (icArguments),
input 'tCashReport.CashReportDaysInterval':U (icFieldName),
input string(tCashReport.CashReportDaysInterval) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input tCashReport.tc_Rowid (icRowid),
input 'QADFIN-3183':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCashReport>
end. /* if tCashReport.CashReportDaysInterval = 0 or tCashReport.CashReportDaysInterval = ? */
/********************************************************************************************/
/* Validate Number of Periods */
/********************************************************************************************/
if tCashReport.CashReportNumberOfPeriods = 0 or tCashReport.CashReportNumberOfPeriods = ?
then do:
assign vcCashReportMsg = #T-6'You must enter the number of GL periods.':200(14046)T-6#
oiReturnStatus = -1.
<M-5 run SetMessage (input trim(vcCashReportMsg) (icMessage),
input '':U (icArguments),
input 'tCashReport.CashReportNumberOfPeriods':U (icFieldName),
input string(tCashReport.CashReportNumberOfPeriods) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input tCashReport.tc_Rowid (icRowid),
input 'QADFIN-3184':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCashReport>
end. /* if tCashReport.CashReportNumberOfPeriods = 0 or tCashReport.CashReportNumberOfPeriods = ? */
/********************************************************************************************/
/* Validate Period */
/********************************************************************************************/
<Q-7 run PeriodByYearPeriod (first) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tCashReport.tiPeriodYear, (PeriodYear)
input tCashReport.tiPeriodPeriod, (PeriodPeriod)
input ?, (PeriodId)
output dataset tqPeriodByYearPeriod) in BPeriod >
find first tqPeriodByYearPeriod where
tqPeriodByYearPeriod.tiPeriodYear = tCashReport.tiPeriodYear and
tqPeriodByYearPeriod.tiPeriodPeriod = tCashReport.tiPeriodPeriod
no-lock no-error.
if available(tqPeriodByYearPeriod)
then assign tCashReport.tiPeriodYear = tqPeriodByYearPeriod.tiPeriodYear
tCashReport.tiPeriodPeriod = tqPeriodByYearPeriod.tiPeriodPeriod
tCashReport.TillPeriod_ID = tqPeriodByYearPeriod.tiPeriod_ID.
else do:
assign vcCashReportMsg = substitute(#T-9'GL period (&1/&2) is not defined in the system.':200(14044)t-9#,
tCashReport.tiPeriodYear, tCashReport.tiPeriodPeriod)
oiReturnStatus = -1.
<M-8 run SetMessage (input trim(vccashReportMsg) (icMessage),
input '':U (icArguments),
input 'tCashReport.tiPeriodYear':U (icFieldName),
input string(tCashReport.tiPeriodYear) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input tCashReport.tc_Rowid (icRowid),
input 'QADFIN-3185':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCashReport>
end.
/********************************************************************************************/
/* Validate Division. */
/********************************************************************************************/
if (tCashReport.tcDivisionCode = "":U)
then assign oiDivisionID = 0.
else do:
<Q-10 run DivisionByMatchingDivisionCode (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tCashReport.tcDivisionCode, (DivisionCode)
output dataset tqDivisionByMatchingDivisionCode) in BDivision >
find tqDivisionByMatchingDivisionCode where
tqDivisionByMatchingDivisionCode.tcDivisionCode = tCashReport.tcDivisionCode
no-lock no-error.
if available(tqDivisionByMatchingDivisionCode)
then assign oiDivisionID = tqDivisionByMatchingDivisionCode.tiDivision_ID.
else do:
assign vcCashReportMsg = substitute(#T-12'Sub-account (&1) is not defined in the system.':200(867)t-12#, tCashReport.tcDivisionCode)
oiReturnStatus = -1.
<M-11 run SetMessage (input trim(vcCashReportMsg) (icMessage),
input '':U (icArguments),
input 'tCashReport.tcDivisionCode':U (icFieldName),
input tCashReport.tcDivisionCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input tCashReport.tc_Rowid (icRowid),
input 'QADFIN-3186':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCashReport>
end.
end.
/********************************************************************************************/
/* Validate ActualsDate (if entered). */
/********************************************************************************************/
<M-13 run ValActualsDate (input tCashReport.CashReportActualsDate (itActualsDate),
input tCashReport.TillPeriod_ID (iiPeriodID),
output viFcReturnSuper (oiReturnStatus)) in BCashReport>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = -98)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus = -98
then oiReturnStatus = 0.