function check_data()
{
- if (!is_date($_POST['from_date']) || is_date_in_fiscalyears($_POST['from_date']) || is_bad_begin_date($_POST['from_date']))
+ if (!is_date($_POST['from_date']) || is_date_in_fiscalyears($_POST['from_date']) || !check_begin_date($_POST['from_date']))
{
display_error( _("Invalid BEGIN date in fiscal year."));
set_focus('from_date');
function display_fiscalyears()
{
- global $table_style;
-
$company_year = get_company_pref('f_year');
$result = get_all_fiscalyears();
start_form();
display_note(_("Warning: Deleting a fiscal year all transactions
are removed and converted into relevant balances. This process is irreversible!"),
- 0, 0, "class='currentfg'");
- start_table($table_style);
+ 0, 1, "class='currentfg'");
+ start_table(TABLESTYLE);
$th = array(_("Fiscal Year Begin"), _("Fiscal Year End"), _("Closed"), "", "");
table_header($th);
function display_fiscalyear_edit($selected_id)
{
- global $table_style2, $Mode;
+ global $Mode;
start_form();
- start_table($table_style2);
+ start_table(TABLESTYLE2);
if ($selected_id != -1)
{
}
else
{
- date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
+ $begin = check_begin_date("", false);
+ if ($begin)
+ {
+ $_POST['from_date'] = $begin;
+ hidden('from_date', $begin);
+ $_POST['to_date'] = end_month(add_months($begin, 11));
+ label_row(_("Fiscal Year Begin:"), $_POST['from_date']);
+ }
+ else
+ date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
date_row(_("Fiscal Year End:"), 'to_date', '', null, 0, 0, 1001);
}
hidden('selected_id', $selected_id);