Пример #1
0
}
//---------------------------------------------------------------------------------------------
function trans_view($trans)
{
    return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]);
}
function edit_link($row)
{
    if (@$_GET['popup']) {
        return '';
    }
    return pager_link(_("Edit"), "/purchasing/po_entry_items.php?" . SID . "ModifyOrderNumber=" . $row["order_no"], ICON_EDIT);
}
function prt_link($row)
{
    return print_document_link($row['order_no'], _("Print"), true, 18, ICON_PRINT);
}
//---------------------------------------------------------------------------------------------
$sql = get_sql_for_po_search_completed();
$cols = array(_("#") => array('fun' => 'trans_view', 'ord' => ''), _("Reference"), _("Supplier") => array('ord' => ''), _("Location"), _("Supplier's Reference"), _("Order Date") => array('name' => 'ord_date', 'type' => 'date', 'ord' => 'desc'), _("Currency") => array('align' => 'center'), _("Order Total") => 'amount', array('insert' => true, 'fun' => 'edit_link'), array('insert' => true, 'fun' => 'prt_link'));
if (get_post('StockLocation') != $all_items) {
    $cols[_("Location")] = 'skip';
}
//---------------------------------------------------------------------------------------------------
$table =& new_db_pager('orders_tbl', $sql, $cols);
$table->width = "80%";
display_db_pager($table);
if (!@$_GET['popup']) {
    end_form();
    end_page();
}
function handle_search()
{
    if (check_valid_entries() == true) {
        $trans_ref = false;
        $sql = get_sql_for_view_transactions($_POST['filterType'], $_POST['FromTransNo'], $_POST['ToTransNo'], $trans_ref);
        if ($sql == "") {
            return;
        }
        $print_type = $_POST['filterType'];
        $print_out = $print_type == ST_SALESINVOICE || $print_type == ST_CUSTCREDIT || $print_type == ST_CUSTDELIVERY || $print_type == ST_PURCHORDER || $print_type == ST_SALESORDER || $print_type == ST_SALESQUOTE || $print_type == ST_CUSTPAYMENT || $print_type == ST_SUPPAYMENT || $print_type == ST_WORKORDER;
        $cols = array(_("#") => array('insert' => true, 'fun' => 'view_link'), _("Reference") => array('fun' => 'ref_view'), _("Date") => array('type' => 'date', 'fun' => 'date_view'), _("Print") => array('insert' => true, 'fun' => 'prt_link'), _("GL") => array('insert' => true, 'fun' => 'gl_view'));
        if (!$print_out) {
            array_remove($cols, 3);
        }
        if (!$trans_ref) {
            array_remove($cols, 1);
        }
        $table =& new_db_pager('transactions', $sql, $cols);
        $table->width = "40%";
        display_db_pager($table);
    }
}
Пример #3
0
function voiding_controls()
{
    global $selected_id;
    $not_implemented = array(ST_PURCHORDER, ST_SALESORDER, ST_SALESQUOTE, ST_COSTUPDATE);
    start_form();
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    systypes_list_cells(_("Type:"), 'filterType', null, true, $not_implemented);
    if (list_updated('filterType')) {
        $selected_id = -1;
    }
    if (!isset($_POST['FromTransNo'])) {
        $_POST['FromTransNo'] = "1";
    }
    if (!isset($_POST['ToTransNo'])) {
        $_POST['ToTransNo'] = "999999";
    }
    ref_cells(_("from #:"), 'FromTransNo');
    ref_cells(_("to #:"), 'ToTransNo');
    submit_cells('ProcessSearch', _("Search"), '', '', 'default');
    end_row();
    end_table(1);
    $trans_ref = false;
    $sql = get_sql_for_view_transactions($_POST['filterType'], $_POST['FromTransNo'], $_POST['ToTransNo'], $trans_ref);
    if ($sql == "") {
        return;
    }
    $cols = array(_("#") => array('insert' => true, 'fun' => 'view_link'), _("Reference") => array('fun' => 'ref_view'), _("Date") => array('type' => 'date', 'fun' => 'date_view'), _("GL") => array('insert' => true, 'fun' => 'gl_view'), _("Select") => array('insert' => true, 'fun' => 'select_link'));
    $table =& new_db_pager('transactions', $sql, $cols);
    $table->width = "40%";
    display_db_pager($table);
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        hidden('trans_no', $selected_id);
        hidden('selected_id', $selected_id);
    } else {
        hidden('trans_no', '');
        $_POST['memo_'] = '';
    }
    label_row(_("Transaction #:"), $selected_id == -1 ? '' : $selected_id);
    date_row(_("Voiding Date:"), 'date_');
    textarea_row(_("Memo:"), 'memo_', null, 30, 4);
    end_table(1);
    if (!isset($_POST['ProcessVoiding'])) {
        submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
    } else {
        if (!exist_transaction($_POST['filterType'], $_POST['trans_no'])) {
            display_error(_("The entered transaction does not exist or cannot be voided."));
            unset($_POST['trans_no']);
            unset($_POST['memo_']);
            unset($_POST['date_']);
            submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
        } else {
            display_warning(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1);
            br();
            submit_center_first('ConfirmVoiding', _("Proceed"), '', true);
            submit_center_last('CancelVoiding', _("Cancel"), '', 'cancel');
        }
    }
    end_form();
}
Пример #4
0
function display_rows($type)
{
    $sql = get_sql_for_attached_documents($type);
    $cols = array(_("#") => array('fun' => 'trans_view', 'ord' => ''), _("Description") => array('name' => 'description'), _("Filename") => array('name' => 'filename'), _("Size") => array('name' => 'filesize'), _("Filetype") => array('name' => 'filetype'), _("Date Uploaded") => array('name' => 'tran_date', 'type' => 'date'), array('insert' => true, 'fun' => 'edit_link'), array('insert' => true, 'fun' => 'view_link'), array('insert' => true, 'fun' => 'download_link'), array('insert' => true, 'fun' => 'delete_link'));
    $table =& new_db_pager('trans_tbl', $sql, $cols);
    $table->width = "60%";
    display_db_pager($table);
}