Пример #1
0
function display_grn_items_for_selection()
{
    global $table_style;
    $result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, true);
    if (db_num_rows($result) == 0) {
        display_note(tr("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1);
        end_page();
        exit;
    }
    /*Set up a table to show the outstanding GRN items for selection */
    start_form(false, true);
    display_heading2(tr("Items Received Yet to be Invoiced"));
    start_table("{$table_style} colspan=7 width=95%");
    $th = array(tr("Delivery"), tr("Sequence #"), tr("P.O."), tr("Item"), tr("Description"), tr("Received On"), tr("Quantity Received"), tr("Quantity Invoiced"), tr("Uninvoiced Quantity"), tr("Order Price"), tr("Total"));
    table_header($th);
    $i = $k = 0;
    while ($myrow = db_fetch($result)) {
        $grn_already_on_invoice = False;
        foreach ($_SESSION['supp_trans']->grn_items as $entered_grn) {
            if ($entered_grn->id == $myrow["id"]) {
                $grn_already_on_invoice = True;
            }
        }
        if ($grn_already_on_invoice == False) {
            alt_table_row_color($k);
            label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
            //text_cells(null, 'grn_item_id', $myrow["id"]);
            submit_cells('grn_item_id', $myrow["id"]);
            label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
            label_cell($myrow["item_code"]);
            label_cell($myrow["description"]);
            label_cell(sql2date($myrow["delivery_date"]));
            qty_cell($myrow["qty_recd"]);
            qty_cell($myrow["quantity_inv"]);
            qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
            amount_cell($myrow["unit_price"]);
            amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]), user_price_dec()));
            end_row();
            $i++;
            if ($i > 15) {
                $i = 0;
                table_header($th);
            }
        }
    }
    end_table();
}
Пример #2
0
$result = db_query($sql, "No orders were returned");
print_hidden_script(18);
start_table("{$table_style} colspan=7 width=80%");
if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == reserved_words::get_all()) {
    $th = array(tr("#"), tr("Reference"), tr("Supplier"), tr("Location"), tr("Supplier's Reference"), tr("Order Date"), tr("Currency"), tr("Order Total"), "");
} else {
    $th = array(tr("#"), tr("Reference"), tr("Supplier"), tr("Supplier's Reference"), tr("Order Date"), tr("Currency"), tr("Order Total"), "");
}
table_header($th);
$j = 1;
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    $date = sql2date($myrow["ord_date"]);
    label_cell(get_trans_view_str(systypes::po(), $myrow["order_no"]));
    label_cell($myrow["reference"]);
    label_cell($myrow["supp_name"]);
    if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == reserved_words::get_all()) {
        label_cell($myrow["location_name"]);
    }
    label_cell($myrow["requisition_no"]);
    label_cell($date);
    label_cell($myrow["curr_code"]);
    amount_cell($myrow["OrderValue"]);
    label_cell(print_document_link($myrow['order_no'], tr("Print")));
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
Пример #3
0
function can_commit()
{
    if (!is_date($_POST['OrderDate'])) {
        display_error(tr("The entered order date is invalid."));
        set_focus('OrderDate');
        return false;
    }
    if (!$_SESSION['PO']->order_no) {
        if (!references::is_valid($_SESSION['PO']->reference)) {
            display_error(tr("There is no reference entered for this purchase order."));
            set_focus('ref');
            return false;
        }
        if (!is_new_reference($_SESSION['PO']->reference, systypes::po())) {
            display_error(tr("The entered reference is already in use."));
            set_focus('ref');
            return false;
        }
    }
    if ($_SESSION['PO']->delivery_address == "") {
        display_error(tr("There is no delivery address specified."));
        set_focus('delivery_address');
        return false;
    }
    if (!isset($_SESSION['PO']->Location) || $_SESSION['PO']->Location == "") {
        display_error(tr("There is no location specified to move any items into."));
        set_focus('StkLocation');
        return false;
    }
    if ($_SESSION['PO']->order_has_items() == false) {
        display_error(tr("The order cannot be placed because there are no lines entered on this order."));
        return false;
    }
    return true;
}
Пример #4
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();
    }
}