function display_fiscalyear_edit($selected_id)
{
    global $Mode;
    start_form();
    start_table(TABLESTYLE2);
    $company_year = get_company_pref('f_year');
    $result = get_all_fiscalyears();
    $row_cnt = db_num_rows($result);
    if ($selected_id != -1) {
        if ($Mode == 'Edit') {
            $myrow = get_fiscalyear($selected_id);
            $_POST['from_date'] = sql2date($myrow["begin"]);
            $_POST['to_date'] = sql2date($myrow["end"]);
            $_POST['closed'] = $myrow["closed"];
        }
        if ($row_cnt == 1) {
            date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
        } else {
            hidden('from_date');
            label_row(_("Fiscal Year Begin:"), $_POST['from_date']);
        }
        hidden('to_date');
        label_row(_("Fiscal Year End:"), $_POST['to_date']);
        if ($myrow["id"] != $company_year) {
            yesno_list_row(_("Is Closed:"), 'closed', null, "", "", false);
        } else {
            hidden('closed');
            label_row(_("Is Closed:"), yesno_value($_POST['closed']));
        }
    } else {
        $begin = next_begin_date();
        if ($begin && $Mode != 'ADD_ITEM') {
            $_POST['from_date'] = $begin;
            $_POST['to_date'] = end_month(add_months($begin, 11));
            $_POST['closed'] = 0;
        }
        hidden('from_date');
        hidden('to_date');
        hidden('closed');
    }
    hidden('selected_id', $selected_id);
    end_table(1);
    submit_add_or_update_center($selected_id == -1, '', 'both');
    end_form();
}
Esempio n. 2
0
     }
 }
 submit_row('submit', _("Get"), true, '', '', true);
 end_table(1);
 div_start('budget_tbl');
 start_table(TABLESTYLE2);
 $showdims = $dim == 1 && $_POST['dim1'] == 0 || $dim == 2 && $_POST['dim1'] == 0 && $_POST['dim2'] == 0;
 if ($showdims) {
     $th = array(_("Period"), _("Amount"), _("Dim. incl."), _("Last Year"));
 } else {
     $th = array(_("Period"), _("Amount"), _("Last Year"));
 }
 table_header($th);
 $year = $_POST['fyear'];
 if (get_post('update') == '') {
     $fyear = get_fiscalyear($year);
     $_POST['begin'] = sql2date($fyear['begin']);
     $_POST['end'] = sql2date($fyear['end']);
 }
 hidden('begin');
 hidden('end');
 $total = $btotal = $ltotal = 0;
 for ($i = 0, $date_ = $_POST['begin']; date1_greater_date2($_POST['end'], $date_); $i++) {
     start_row();
     if (get_post('update') == '') {
         $_POST['amount' . $i] = number_format2(get_only_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']), 0);
     }
     label_cell($date_);
     amount_cells(null, 'amount' . $i, null, 15, null, 0);
     if ($showdims) {
         $d = get_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']);
Esempio n. 3
0
function display_fiscalyear_edit($selected_id)
{
    global $Mode;
    start_form();
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        if ($Mode == 'Edit') {
            $myrow = get_fiscalyear($selected_id);
            $_POST['from_date'] = sql2date($myrow["begin"]);
            $_POST['to_date'] = sql2date($myrow["end"]);
            $_POST['closed'] = $myrow["closed"];
        }
        hidden('from_date');
        hidden('to_date');
        label_row(_("Fiscal Year Begin:"), $_POST['from_date']);
        label_row(_("Fiscal Year End:"), $_POST['to_date']);
    } else {
        $begin = next_begin_date();
        if ($begin && $Mode != 'ADD_ITEM') {
            $_POST['from_date'] = $begin;
            $_POST['to_date'] = end_month(add_months($begin, 11));
        }
        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);
    yesno_list_row(_("Is Closed:"), 'closed', null, "", "", false);
    end_table(1);
    submit_add_or_update_center($selected_id == -1, '', 'both');
    end_form();
}
Esempio n. 4
0
function display_fiscalyear_edit($selected_id)
{
    global $table_style2;
    start_form();
    start_table($table_style2);
    if ($selected_id) {
        $myrow = get_fiscalyear($selected_id);
        $_POST['from_date'] = sql2date($myrow["begin"]);
        $_POST['to_date'] = sql2date($myrow["end"]);
        $_POST['closed'] = $myrow["closed"];
        hidden('selected_id', $selected_id);
        hidden('from_date', $_POST['from_date']);
        hidden('to_date', $_POST['to_date']);
        label_row(tr("Fiscal Year Begin:"), $_POST['from_date']);
        label_row(tr("Fiscal Year End:"), $_POST['to_date']);
    } else {
        date_row(tr("Fiscal Year Begin:"), 'from_date', null, 0, 0, 1001);
        date_row(tr("Fiscal Year End:"), 'to_date', null, 0, 0, 1001);
    }
    yesno_list_row(tr("Is Closed:"), 'closed', null, "", "", false);
    end_table(1);
    submit_add_or_update_center(!isset($selected_id));
    end_form();
}