Пример #1
0
function handle_search()
{
    global $table_style;
    if (check_valid_entries() == true) {
        $db_info = get_systype_db_info($_POST['filterType']);
        if ($db_info == null) {
            return;
        }
        $table_name = $db_info[0];
        $type_name = $db_info[1];
        $trans_no_name = $db_info[2];
        $trans_ref = $db_info[3];
        $sql = "SELECT DISTINCT {$trans_no_name} ";
        if ($trans_ref) {
            $sql .= " ,{$trans_ref} ";
        }
        $sql .= " FROM {$table_name}\n\t\t\tWHERE {$trans_no_name} >= " . $_POST['FromTransNo'] . "\n\t\t\tAND  {$trans_no_name} <= " . $_POST['ToTransNo'];
        if ($type_name != null) {
            $sql .= " AND {$type_name} = " . $_POST['filterType'];
        }
        $sql .= " ORDER BY {$trans_no_name}";
        $result = db_query($sql, "could not query transactions on {$table_name}");
        if (db_num_rows($result) == 0) {
            echo tr("There are no transactions for the given parameters.");
            return;
        }
        $print_type = $_POST['filterType'];
        $print_out = $print_type == 10 || $print_type == 11 || $print_type == systypes::cust_dispatch() || $print_type == systypes::po() || $print_type == systypes::sales_order();
        if ($print_out) {
            print_hidden_script($print_type);
            if ($trans_ref) {
                $th = array(tr("#"), tr("Reference"), tr("View"), tr("Print"), tr("GL"));
            } else {
                $th = array(tr("#"), tr("View"), tr("Print"), tr("GL"));
            }
        } else {
            if ($trans_ref) {
                $th = array(tr("#"), tr("Reference"), tr("View"), tr("GL"));
            } else {
                $th = array(tr("#"), tr("View"), tr("GL"));
            }
        }
        start_table($table_style);
        table_header($th);
        $k = 0;
        while ($line = db_fetch($result)) {
            alt_table_row_color($k);
            label_cell($line[$trans_no_name]);
            if ($trans_ref) {
                label_cell($line[$trans_ref]);
            }
            label_cell(get_trans_view_str($_POST['filterType'], $line[$trans_no_name], tr("View")));
            if ($print_out) {
                label_cell(print_document_link($line[$trans_no_name], tr("Print"), true, $print_type));
            }
            label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name], tr("View GL")));
            end_row();
        }
        end_table();
    }
}
Пример #2
0
$is_batch_invoice = count($_SESSION['Items']->src_docs) > 1;
$is_edition = $_SESSION['Items']->trans_type == 10 && $_SESSION['Items']->trans_no != 0;
start_form(false, true);
start_table("{$table_style2} width=80%", 5);
start_row();
label_cells(tr("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'");
label_cells(tr("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'");
label_cells(tr("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'");
end_row();
start_row();
if ($_SESSION['Items']->trans_no == 0) {
    ref_cells(tr("Reference"), 'ref', $_SESSION['Items']->reference, "class='tableheader2'");
} else {
    label_cells(tr("Reference"), $_SESSION['Items']->reference, "class='tableheader2'");
}
label_cells(tr("Delivery Notes"), get_customer_trans_view_str(systypes::cust_dispatch(), array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
label_cells(tr("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'");
end_row();
start_row();
if (!isset($_POST['ship_via'])) {
    $_POST['ship_via'] = $_SESSION['Items']->ship_via;
}
label_cell(tr("Shipping Company"), "class='tableheader2'");
shippers_list_cells(null, 'ship_via', $_POST['ship_via']);
if (!isset($_POST['InvoiceDate']) || !is_date($_POST['InvoiceDate'])) {
    $_POST['InvoiceDate'] = Today();
    if (!is_date_in_fiscalyear($_POST['InvoiceDate'])) {
        $_POST['InvoiceDate'] = end_fiscalyear();
    }
}
date_cells(tr("Date"), 'InvoiceDate', $_POST['InvoiceDate'], 0, 0, 0, "class='tableheader2'");