validation procedure
Description
ValRecEntryStartDate
Parameters
| itTargetField | input | date | Value of the business field to validate. |
| icTargetFieldName | input | character | Name of the business field to validate. |
| icRowid | input | character | Contents of field tc_Rowid, if the target field is a field of a component temp-table. |
| icRecEntryFreq | input | character | RecEntryFreq |
| icRecEntryCode | input | character | RecEntryCode |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/brecurringentry.p)
/* ===================================================================================== */
/* The StartDate is mandatory when the frequency is Monthly, Weekly, Period or Quarterly */
/* ===================================================================================== */
if icRecEntryFreq <> {&RECENTRYFREQ-MANUALLY} and
itTargetField = ?
then do:
assign vcMessageRE = trim(substitute(#T-5'The start date can only be blank if the frequency is set to &1.':150(3500)T-5#,{&RECENTRYFREQ-MANUALLY-TR})) + chr(10) +
trim(substitute(#T-6'Recurring entry code: &1.':255(3493)T-6#,trim(icRecEntryCode)))
oiReturnStatus = -1.
<M-1 run SetMessage (input vcMessageRE (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input string(itTargetField) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-957':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BRecurringEntry>
leave.
end.
/* ===================================================================================== */
/* The StartDate must be the last date of a period when frequency is Period or Quarterly */
/* ===================================================================================== */
if icRecEntryFreq = {&RECENTRYFREQ-PERIOD} or
icRecEntryFreq = {&RECENTRYFREQ-QUARTERLY}
then do:
<Q-2 run PeriodByStartEndDate (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input itTargetField, (Date)
output dataset tqPeriodByStartEndDate) in BPeriod >
find tqPeriodByStartEndDate where
tqPeriodByStartEndDate.tcPeriodTypeCode = {&PERIODTYPECODE-NORMAL}
no-lock no-error.
if not available tqPeriodByStartEndDate
then do:
assign vcMessageRE = trim(substitute(#T-7'No GL period is available for the selected start date (&1).':150(3501)t-7#, string(itTargetField) )) + chr(10) +
trim(substitute(#T-8'Recurring entry code: &1.':255(3493)T-8#,trim(icRecEntryCode)))
oiReturnStatus = -1.
<M-3 run SetMessage (input vcMessageRE (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input string(itTargetField) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-958':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BRecurringEntry>
end.
else do:
if itTargetField <> tqPeriodByStartEndDate.ttPeriodEndDate
then do:
assign vcMessageRE = trim(substitute(#T-9'The start date (&1) must be the last date of a GL period when the frequency is &2 or &3.':150(3502)T-9#, string(itTargetField), {&RECENTRYFREQ-PERIOD-TR}, {&RECENTRYFREQ-QUARTERLY-TR})) + chr(10) +
trim(substitute(#T-10'Recurring entry code: &1.':255(3493)T-10#,trim(icRecEntryCode)))
oiReturnStatus = -1.
<M-4 run SetMessage (input vcMessageRE (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input string(itTargetField) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-959':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BRecurringEntry>
end.
end.
end.