project QadFinancials > class BBillSchedule > method ValidateComponentDueDayForDayInWeek

validation procedure


Parameters


iiDueDateinputintegerValue of the business field to validate.
icDueDateFieldNameinputcharacterName of the business field to validate.
ilWeekInMonthinputlogical
iiDelayMthinputinteger
icWeekNbrinputcharacter
icMonthsDelayFieldNameinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBillSchedule.ValidateComponentPost


program code (program3/bbillschedule.p)

/* ================================================================= */
/* Validate Due Date for Day In Week                                 */
/* ================================================================= */
assign vcMessageWeek    = #T-90'Week':20(653)T-90# + icWeekNbr.

/* Get Max weekend date */
if icWeekNbr = '4':U
then assign viDateOfWeekend = 31.
else assign viDateOfWeekend = int(icWeekNbr) * 7.

/* the due date is mandatory if 'Week In the Month' is selected */
if ilWeekInMonth = yes and
    iiDueDate = 0
then do:
    <M-68 run SetMessage
       (input  trim(substitute(#T-84'If you select Week In Month (&1), you must specify a Due Day (&2).':255(583836173)T-84#, vcMessageWeek, iiDueDate)) (icMessage), 
        input  '':U (icArguments), 
        input  icDueDateFieldName (icFieldName), 
        input  string(iiDueDate) (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  ? (icRowid), 
        input  'qadfin-66024':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BBillSchedule>
    assign oiReturnStatus = -1.
end.

/* the due date should be blank if 'Week In the Month' is not selected*/
if ilWeekInMonth = no and 
    iiDueDate <> 0
then do:
    <M-25 run SetMessage
       (input  trim(substitute(#T-34'If you don't select Week In the Month (&1), the Due Day (&2) field must be 0.':255(376691668)T-34#, vcMessageWeek, iiDueDate)) (icMessage), 
        input  '':U (icArguments), 
        input  icDueDateFieldName (icFieldName), 
        input  string(iiDueDate) (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  ? (icRowid), 
        input  'qadfin-64408':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BBillSchedule>
    assign oiReturnStatus = -1.
end.

/* the month delay should be blank if 'Week In the Month' is not selected*/
if ilWeekInMonth = no and 
    iiDelayMth <> 0
then do:
    <M-14 run SetMessage
       (input  trim(substitute(#T-93'If you don't select Week In the Month (&1), the Months Delay (&2) field must be 0.':255(217812974)T-93#, vcMessageWeek, iiDelayMth)) (icMessage), 
        input  '':U (icArguments), 
        input  icMonthsDelayFieldName (icFieldName), 
        input  string(iiDelayMth) (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  ? (icRowid), 
        input  'qadfin-279813':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BBillSchedule>
    assign oiReturnStatus = -1.
end.

/* the due date cannot be less than the date of Weekend if Delay month is 0. */
if ilWeekInMonth =  yes              and
   iiDelayMth    =  0                and
   iiDueDate     <  viDateOfWeekend 
then do:
    <M-71 run SetMessage
       (input  trim(substitute(#T-36'If the Months Delay corresponding with (&1) is 0, then the Due Day (&2) must be at least (&3).':255(53097078)T-36#, vcMessageWeek, iiDueDate, viDateOfWeekend)) (icMessage), 
        input  '':U (icArguments), 
        input  icDueDateFieldName (icFieldName), 
        input  string(iiDueDate) (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  ? (icRowid), 
        input  'qadfin-452939':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BBillSchedule>
    assign oiReturnStatus = -1.
end.