Description of Fields:
pay_frequency - Pay frequency: weekly, biweekly, twice a month, monthly
pay_date1 - Next pay date
pay_date2 - The pay date after next
Since the values of these fields should be accordingly appropriate, we check those with each other for accuracy. If the client selects weekly pay frequency and there is a timeframe of a month two pay dates chosen, the lead will not be processed in indicating inaccurate dates or pay frequency selection.
How do we check?
For each type of pay frequency, we chose minimum and maximum number of days that could be between pay dates selection.
Min = the minimum number of days. Max = the maximum number of days.
pay_date1 = (today, today + Max)
pay_date2 = (pay_date1 + Min, pay_date1 + Max)
If the following information was collected from the form:
Min = 11 days
Max = 17 days
pay_date1 must fall between the following dates:
today and today + Max
Because 2010-01-03 falls between 2010-01-01 and 2010-01-17, pay_date1 passes the validation.
pay_date2 must fall between the following dates:
pay_date1 + Min and pay_date1 + Max
2010-01-03 + 11 days and 2010-01-03 + 17 days
2010-01-18 falls between these dates. The lead successfully goes through.
The information is correct.