- }
- elseif ($_POST['DayNumber'] > 30 && !check_value('DaysOrFoll'))
- {
- $inpug_error = 1;
- display_error( _("When the check box to indicate a day in the following month is the due date, the due date cannot be a day after the 30th. A number between 1 and 30 is expected."));
- set_focus('DayNumber');
- }
- elseif ($_POST['DayNumber'] > 500 && check_value('DaysOrFoll'))
- {
- $inpug_error = 1;
- display_error( _("When the check box is not checked to indicate that the term expects a number of days after which accounts are due, the number entered should be less than 500 days."));
- set_focus('DayNumber');
+ }
+ $early_days = input_num('early_days', 0);
+ if ($early_days) {
+ if ($early_days >= $_POST['DayNumber']) {
+ $input_error = 1;
+ display_error(_("Early payment days option should be shorter that payment term days."));
+ set_focus('early_days');
+ } else if (!check_num('early_discount', 0, 100) or input_num('early_discount') == 0)
+ {
+ $input_error = 1;
+ display_error(_("The payment discount must be numeric and is expected to be less than 100% and greater than or equal to 0."));
+ set_focus('early_discount');
+ }
+ } else {
+ if (input_num('early_discount', 0)) {
+ $input_error = 1;
+ display_error(_("Early payment days option should be positive and less than payment term days."));
+ set_focus('early_days');
+ }