function check_data() { if (!is_date($_POST['from_date']) || is_date_in_fiscalyears($_POST['from_date'])) { display_error(_("Invalid BEGIN date in fiscal year.")); set_focus('from_date'); return false; } if (!is_date($_POST['to_date']) || is_date_in_fiscalyears($_POST['to_date'])) { display_error(_("Invalid END date in fiscal year.")); set_focus('to_date'); return false; } if (!check_begin_end_date($_POST['from_date'], $_POST['to_date'])) { display_error(_("Invalid BEGIN or END date in fiscal year.")); set_focus('from_date'); return false; } if (date1_greater_date2($_POST['from_date'], $_POST['to_date'])) { display_error(_("BEGIN date bigger than END date.")); set_focus('from_date'); return false; } return true; }
} elseif (input_num('amount', 0) == 0.0) { display_error(_("The amount can not be 0.")); set_focus('periods'); $input_error = 1; } elseif (input_num('periods', 0) < 1) { display_error(_("The periods must be greater than 0.")); set_focus('periods'); $input_error = 1; } if ($input_error == 0) { $periods = input_num('periods'); $per = $periods - 1; $date = $date_ = get_post('date_'); $freq = get_post('freq'); $lastdate = $freq == 1 ? add_days($date_, 7 * $per) : ($freq == 2 ? add_days($date_, 14 * $per) : ($freq == 3 ? add_months($date_, $per) : add_months($date_, 3 * $per))); if (!is_date_in_fiscalyears($lastdate, false)) { display_error(_("Some of the period dates are outside the fiscal year. Create a new fiscal year first!")); set_focus('date_'); $input_error = 1; } if ($input_error == 0) { $amount = input_num('amount'); $am = round2($amount / $periods, user_price_dec()); if ($am * $periods != $amount) { $am0 = $am + $amount - $am * $periods; } else { $am0 = $am; } if (get_post('memo_') != "") { $memo = $_POST['memo_']; } else {