コード例 #1
0
ファイル: fiscalyears.php プロジェクト: M-Shahbaz/FA
function display_fiscalyears()
{
    $company_year = get_company_pref('f_year');
    $result = get_all_fiscalyears();
    start_form();
    display_note(_("Warning: Deleting a fiscal year all transactions \n\t\tare removed and converted into relevant balances. This process is irreversible!"), 0, 1, "class='currentfg'");
    start_table(TABLESTYLE);
    $th = array(_("Fiscal Year Begin"), _("Fiscal Year End"), _("Closed"), "", "");
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        if ($myrow['id'] == $company_year) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        $from = sql2date($myrow["begin"]);
        $to = sql2date($myrow["end"]);
        if ($myrow["closed"] == 0) {
            $closed_text = _("No");
        } else {
            $closed_text = _("Yes");
        }
        label_cell($from);
        label_cell($to);
        label_cell($closed_text);
        edit_button_cell("Edit" . $myrow['id'], _("Edit"));
        if ($myrow["id"] != $company_year) {
            delete_button_cell("Delete" . $myrow['id'], _("Delete"));
            submit_js_confirm("Delete" . $myrow['id'], sprintf(_("Are you sure you want to delete fiscal year %s - %s? All transactions are deleted and converted into relevant balances. Do you want to continue ?"), $from, $to));
        } else {
            label_cell('');
        }
        end_row();
    }
    end_table();
    end_form();
    display_note(_("The marked fiscal year is the current fiscal year which cannot be deleted."), 0, 0, "class='currentfg'");
}
コード例 #2
0
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();
}
コード例 #3
0
ファイル: fiscalyears.php プロジェクト: ravenii/guardocs
function display_fiscalyears()
{
    global $table_style;
    $company_year = get_company_pref('f_year');
    $result = get_all_fiscalyears();
    start_table($table_style);
    $th = array(tr("Fiscal Year Begin"), tr("Fiscal Year End"), tr("Closed"), "", "");
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        if ($myrow['id'] == $company_year) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        $from = sql2date($myrow["begin"]);
        $to = sql2date($myrow["end"]);
        if ($myrow["closed"] == 0) {
            $closed_text = tr("No");
        } else {
            $closed_text = tr("Yes");
        }
        label_cell($from);
        label_cell($to);
        label_cell($closed_text);
        edit_link_cell("selected_id=" . urlencode($from));
        if ($myrow["id"] != $company_year) {
            delete_link_cell("selected_id=" . urlencode($from) . "&to_date=" . urlencode($to) . "&delete=1");
        }
        end_row();
    }
    end_table();
    display_note(tr("The marked fiscal year is the current fiscal year which cannot be deleted."), 0, 0, "class='currentfg'");
}