Example #1
0
function display_po_receive_items()
{
    global $table_style;
    start_table("colspan=7 {$table_style} width=90%");
    $th = array(tr("Item Code"), tr("Description"), tr("Ordered"), tr("Units"), tr("Received"), tr("Outstanding"), tr("This Delivery"), tr("Price"), tr("Total"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if ($ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            qty_cell($ln_itm->quantity);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received);
            qty_cell($qty_outstanding);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right");
            } else {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right", "disabled");
            }
            amount_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $display_total = number_format2($total, user_price_dec());
    label_row(tr("Total value of items received"), $display_total, "colspan=8 align=right", "nowrap align=right");
    end_table();
}
Example #2
0
function display_bom_items($selected_parent)
{
    global $table_style;
    $result = get_bom($selected_parent);
    start_table("{$table_style} width=60%");
    $th = array(tr("Code"), tr("Description"), tr("Location"), tr("Work Centre"), tr("Quantity"), tr("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["component"]);
        label_cell($myrow["description"]);
        label_cell($myrow["location_name"]);
        label_cell($myrow["WorkCentreDescription"]);
        label_cell(qty_format($myrow["quantity"]));
        label_cell($myrow["units"]);
        edit_link_cell(SID . "NewItem={$selected_parent}&selected_component=" . $myrow["id"]);
        delete_link_cell(SID . "delete=" . $myrow["id"] . "&stock_id=" . $_POST['stock_id']);
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
}
//-----------------------------------------------------------------------------------------
display_grn_items_for_selection();
//-----------------------------------------------------------------------------------------
if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") {
    $myrow = get_grn_item_detail($_POST['grn_item_id']);
    echo "<br>";
    display_heading2(tr("Delivery Item Selected For Adding To A Supplier Invoice"));
    start_table("{$table_style} width=80%");
    $th = array(tr("Sequence #"), tr("Item"), tr("Description"), tr("Quantity Outstanding"), tr("Quantity to Invoice"), tr("Order Price"), tr("Actual Price"));
    table_header($th);
    start_row();
    label_cell($_POST['grn_item_id']);
    label_cell($myrow['item_code']);
    label_cell($myrow['description']);
    qty_cell($myrow['QtyOstdg']);
    qty_cells(null, 'this_quantity_inv', qty_format($myrow['QtyOstdg']));
    amount_cell($myrow['unit_price']);
    small_amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
    end_row();
    end_table(1);
    submit_center('AddGRNToTrans', tr("Add to Invoice"));
    hidden('GRNNumber', $_POST['grn_item_id']);
    hidden('item_code', $myrow['item_code']);
    hidden('item_description', $myrow['description']);
    hidden('qty_recd', $myrow['qty_recd']);
    hidden('prev_quantity_inv', $myrow['quantity_inv']);
    hidden('order_price', $myrow['unit_price']);
    hidden('std_cost_unit', $myrow['std_cost_unit']);
    hidden('po_detail_item', $myrow['po_detail_item']);
}
//----------------------------------------------------------------------------------------
    view_stock_status_cell($ln_itm->stock_id);
    if ($ln_itm->descr_editable) {
        text_cells(null, 'Line' . $line . 'Desc', $ln_itm->item_description, 30, 50);
    } else {
        label_cell($ln_itm->item_description);
    }
    $dec = get_qty_dec($ln_itm->stock_id);
    qty_cell($ln_itm->quantity, false, $dec);
    label_cell($ln_itm->units);
    qty_cell($ln_itm->qty_done, false, $dec);
    if (isset($_POST['clear_quantity'])) {
        $ln_itm->qty_dispatched = 0;
    }
    $_POST['Line' . $line] = $ln_itm->qty_dispatched;
    /// clear post so value displayed in the fiel is the 'new' quantity
    small_qty_cells(null, 'Line' . $line, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id, $dec), null, null, $dec);
    $display_discount_percent = percent_format($ln_itm->discount_percent * 100) . "%";
    $line_total = $ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent);
    amount_cell($ln_itm->price);
    label_cell($ln_itm->tax_type_name);
    label_cell($display_discount_percent, "nowrap align=right");
    amount_cell($line_total);
    end_row();
}
$_POST['ChargeFreightCost'] = get_post('ChargeFreightCost', price_format($_SESSION['Items']->freight_cost));
$colspan = 9;
start_row();
label_cell(_("Shipping Cost"), "colspan={$colspan} align=right");
small_amount_cells(null, 'ChargeFreightCost', $_SESSION['Items']->freight_cost);
end_row();
$inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
    // if unassembling, negate quantity
    if ($_POST['ProductionType'] == 0) {
        $_POST['quantity'] = -$_POST['quantity'];
    }
    $id = work_order_produce($_POST['selected_id'], $_POST['ref'], input_num('quantity'), $_POST['date_'], $_POST['memo_'], $close_wo);
    meta_forward($_SERVER['PHP_SELF'], "AddedID=" . $_POST['selected_id'] . "&date=" . $_POST['date_']);
}
//-------------------------------------------------------------------------------------
display_wo_details($_POST['selected_id']);
//-------------------------------------------------------------------------------------
start_form();
hidden('selected_id', $_POST['selected_id']);
//hidden('WOReqQuantity', $_POST['WOReqQuantity']);
$dec = get_qty_dec($wo_details["stock_id"]);
if (!isset($_POST['quantity']) || $_POST['quantity'] == '') {
    $_POST['quantity'] = qty_format(max($wo_details["units_reqd"] - $wo_details["units_issued"], 0), $wo_details["stock_id"], $dec);
}
start_table(TABLESTYLE2);
br();
ref_row(_("Reference:"), 'ref', '', $Refs->get_next(29));
if (!isset($_POST['ProductionType'])) {
    $_POST['ProductionType'] = 1;
}
yesno_list_row(_("Type:"), 'ProductionType', $_POST['ProductionType'], _("Produce Finished Items"), _("Return Items to Work Order"));
small_qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
date_row(_("Date:"), 'date_');
textarea_row(_("Memo:"), 'memo_', null, 40, 3);
end_table(1);
submit_center_first('Process', _("Process"), '', 'default');
submit_center_last('ProcessAndClose', _("Process And Close Order"), '', true);
end_form();
//row colour counter
$result = get_loc_details($_POST['stock_id']);
if (@$_GET['popup']) {
    hidden('_tabs_sel', get_post('_tabs_sel'));
    hidden('popup', @$_GET['popup']);
}
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"])) {
        $myrow["reorder_level"] = input_num($myrow["loc_code"]);
        set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
        display_notification(_("Reorder levels has been updated."));
    }
    $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
    label_cell($myrow["location_name"]);
    $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"], $_POST['stock_id'], $dec);
    qty_cell($qoh, false, $dec);
    qty_cells(null, $myrow["loc_code"], null, null, null, $dec);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
end_table(1);
div_end();
submit_center('UpdateData', _("Update"), true, false, 'default');
if (!@$_GET['popup']) {
    end_form();
    end_page(@$_GET['popup'], false, false);
Example #7
0
    hidden('stock_id', $_POST['stock_id']);
    hidden('StockLocation', $_POST['StockLocation']);
    hidden('type', $_POST['type']);
    label_row(_("Item:"), $myrow["StockItemName"]);
    label_row(_("Destination Location:"), $myrow["location_name"]);
} else {
    stock_manufactured_items_list_row(_("Item:"), 'stock_id', null, false, true);
    if (list_updated('stock_id')) {
        $Ajax->activate('quantity');
    }
    locations_list_row(_("Destination Location:"), 'StockLocation', null);
}
if (!isset($_POST['quantity'])) {
    $_POST['quantity'] = qty_format(1, $_POST['stock_id'], $dec);
} else {
    $_POST['quantity'] = qty_format($_POST['quantity'], $_POST['stock_id'], $dec);
}
if (get_post('type') == WO_ADVANCED) {
    qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec);
    if ($_POST['released']) {
        label_row(_("Quantity Manufactured:"), number_format($_POST['units_issued'], get_qty_dec($_POST['stock_id'])));
    }
    date_row(_("Date") . ":", 'date_', '', true);
    date_row(_("Date Required By") . ":", 'RequDate', '', null, $SysPrefs->default_wo_required_by());
} else {
    qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
    date_row(_("Date") . ":", 'date_', '', true);
    hidden('RequDate', '');
    $sql = "SELECT DISTINCT account_code FROM " . TB_PREF . "bank_accounts";
    $rs = db_query($sql, "could not get bank accounts");
    $r = db_fetch_row($rs);
function display_credit_items()
{
    global $table_style, $table_style2;
    start_form(false, true);
    start_table("{$table_style2} width=80%", 5);
    echo "<tr><td>";
    // outer table
    start_table("{$table_style} width=100%");
    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 (!isset($_POST['ref']))
    //		$_POST['ref'] = references::get_next(11);
    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("Crediting Invoice"), get_customer_trans_view_str(10, $_SESSION['InvoiceToCredit']), "class='tableheader2'");
    label_cells(tr("Crediting Invoice"), get_customer_trans_view_str(10, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
    if (!isset($_POST['ShipperID'])) {
        $_POST['ShipperID'] = $_SESSION['Items']->ship_via;
    }
    label_cell(tr("Shipping Company"), "class='tableheader2'");
    shippers_list_cells(null, 'ShipperID', $_POST['ShipperID']);
    //	if (!isset($_POST['sales_type_id']))
    //	  $_POST['sales_type_id'] = $_SESSION['Items']->sales_type;
    //	label_cell(tr("Sales Type"), "class='tableheader2'");
    //	sales_types_list_cells(null, 'sales_type_id', $_POST['sales_type_id']);
    end_row();
    end_table();
    echo "</td><td>";
    // outer table
    start_table("{$table_style} width=100%");
    label_row(tr("Invoice Date"), $_SESSION['Items']->src_date, "class='tableheader2'");
    date_row(tr("Credit Note Date"), 'CreditDate', null, 0, 0, 0, "class='tableheader2'");
    end_table();
    echo "</td></tr>";
    end_table(1);
    // outer table
    start_table("{$table_style} width=80%");
    $th = array(tr("Item Code"), tr("Item Description"), tr("Invoiced Quantity"), tr("Units"), tr("Credit Quantity"), tr("Price"), tr("Discount %"), tr("Total"));
    table_header($th);
    $k = 0;
    //row colour counter
    foreach ($_SESSION['Items']->line_items as $line_no => $ln_itm) {
        if ($ln_itm->quantity == $ln_itm->qty_done) {
            continue;
            // this line was fully credited
        }
        alt_table_row_color($k);
        //	view_stock_status_cell($ln_itm->stock_id); alternative view
        label_cell($ln_itm->stock_id);
        text_cells(null, 'Line' . $line_no . 'Desc', $ln_itm->item_description, 30, 50);
        qty_cell($ln_itm->quantity);
        label_cell($ln_itm->units);
        amount_cells(null, 'Line' . $line_no, qty_format($ln_itm->qty_dispatched));
        $line_total = $ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent);
        amount_cell($ln_itm->price);
        percent_cell($ln_itm->discount_percent * 100);
        amount_cell($line_total);
        end_row();
    }
    if (!check_num('ChargeFreightCost')) {
        $_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost);
    }
    start_row();
    label_cell(tr("Credit Shipping Cost"), "colspan=7 align=right");
    amount_cells(null, "ChargeFreightCost", $_POST['ChargeFreightCost'], 6, 6);
    end_row();
    $inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
    $display_sub_total = price_format($inv_items_total + input_num($_POST['ChargeFreightCost']));
    label_row(tr("Sub-total"), $display_sub_total, "colspan=7 align=right", "align=right");
    $taxes = $_SESSION['Items']->get_taxes(input_num($_POST['ChargeFreightCost']));
    $tax_total = display_edit_tax_items($taxes, 7, $_SESSION['Items']->tax_included);
    $display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total);
    label_row(tr("Credit Note Total"), $display_total, "colspan=7 align=right", "align=right");
    end_table();
}
Example #9
0
set_global_stock_item($_POST['stock_id']);
if (isset($_POST['stock_id'])) {
    $sql = "SELECT bom.*,stock_master.description,workcentres.name As WorkCentreName, locations.location_name\n\t\tFROM bom, stock_master, workcentres, locations\n\t\tWHERE bom.parent = stock_master.stock_id AND bom.workcentre_added = workcentres.id\n\t\tAND bom.loc_code = locations.loc_code\n\t\tAND bom.component='" . $_POST['stock_id'] . "'";
    $result = db_query($sql, "No parent items were returned");
    if (db_num_rows($result) == 0) {
        display_note(tr("The selected item is not used in any BOMs."));
    } else {
        start_table("{$table_style} width=80%");
        $th = array(tr("Parent Item"), tr("Work Centre"), tr("Location"), tr("Quantity Required"));
        table_header($th);
        $k = $j = 0;
        while ($myrow = db_fetch($result)) {
            alt_table_row_color($k);
            $select_item = $path_to_root . "/manufacturing/manage/bom_edit.php?" . SID . "stock_id=" . $myrow["parent"];
            label_cell("<a href='{$select_item}'>" . $myrow["parent"] . " - " . $myrow["description"] . "</a>");
            label_cell($myrow["WorkCentreName"]);
            label_cell($myrow["location_name"]);
            label_cell(qty_format($myrow["quantity"]));
            end_row();
            $j++;
            if ($j == 12) {
                $j = 1;
                table_header($th);
            }
            //end of page full new headings if
        }
        end_table();
    }
}
end_form();
end_page();
Example #10
0
    hidden('stock_id', $_POST['stock_id']);
    hidden('StockLocation', $_POST['StockLocation']);
    hidden('type', $_POST['type']);
    label_row(tr("Item:"), $myrow["StockItemName"]);
    label_row(tr("Destination Location:"), $myrow["location_name"]);
} else {
    stock_manufactured_items_list_row(tr("Item:"), 'stock_id', null);
    locations_list_row(tr("Destination Location:"), 'StockLocation', null);
}
if (!isset($_POST['quantity'])) {
    $_POST['quantity'] = qty_format(1);
}
if ($_POST['type'] == wo_types::advanced()) {
    qty_row(tr("Quantity Required:"), 'quantity', 12);
    if ($_POST['released']) {
        label_row(tr("Quantity Manufactured:"), qty_format($_POST['units_issued']));
    }
    date_row(tr("Date") . ":", 'date_');
    date_row(tr("Date Required By") . ":", 'RequDate', null, sys_prefs::default_wo_required_by());
} else {
    qty_row(tr("Quantity:"), 'quantity', 12);
    date_row(tr("Date") . ":", 'date_');
    hidden('RequDate', '');
    if (!isset($_POST['Costs'])) {
        $_POST['Costs'] = price_format(0);
    }
    amount_row(tr("Total Additional Costs:"), 'Costs');
}
if ($_POST['released']) {
    label_row(tr("Released On:"), $_POST['released_date']);
}
Example #11
0
    }
    if ($show_qoh && $ln_itm->qty_dispatched > $qoh) {
        // oops, we don't have enough of one of the component items
        start_row("class='stockmankobg'");
        $has_marked = true;
    } else {
        alt_table_row_color($k);
    }
    view_stock_status_cell($ln_itm->stock_id);
    text_cells(null, 'Line' . $line . 'Desc', $ln_itm->item_description, 30, 50);
    label_cell($ln_itm->date_from);
    label_cell($ln_itm->notes);
    qty_cell($ln_itm->quantity);
    label_cell($ln_itm->units);
    qty_cell($ln_itm->qty_done);
    small_qty_cells(null, 'Line' . $line, qty_format($ln_itm->qty_dispatched));
    $display_discount_percent = percent_format($ln_itm->discount_percent * 100) . "%";
    $line_total = $ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent);
    amount_cell($ln_itm->price);
    label_cell($ln_itm->tax_type_name);
    label_cell($display_discount_percent, "nowrap align=right");
    amount_cell($line_total);
    end_row();
}
$_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost);
if (!check_num('ChargeFreightCost')) {
    $_POST['ChargeFreightCost'] = price_format(0);
}
start_row();
small_amount_cells(tr("Shipping Cost"), 'ChargeFreightCost', $_SESSION['Items']->freight_cost, "colspan=11 align=right");
$inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
Example #12
0
stock_item_heading($_POST['stock_id']);
set_global_stock_item($_POST['stock_id']);
start_table("{$table_style} width=30%");
$th = array(tr("Location"), tr("Quantity On Hand"), tr("Re-Order Level"));
table_header($th);
$j = 1;
$k = 0;
//row colour counter
$result = get_loc_details($_POST['stock_id']);
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"])) {
        $myrow["reorder_level"] = input_num($myrow["loc_code"]);
        set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
    }
    $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
    label_cell($myrow["location_name"]);
    $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"]);
    label_cell(number_format2($qoh, user_qty_dec()), "nowrap align='right'");
    qty_cells(null, $myrow["loc_code"]);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
end_table(1);
submit('UpdateData', tr("Update"));
end_form();
end_page();
Example #13
0
    }
}
end_table();
//-----------------------------------------------------------------------------------------
if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") {
    $myrow = get_grn_item_detail($_POST['grn_item_id']);
    echo "<br>";
    display_heading2(tr("Delivery Item Selected For Adding To A Supplier Credit Note"));
    start_table("{$table_style} width=80%");
    $th = array(tr("Sequence #"), tr("Item"), tr("Qty Already Invoiced"), tr("Quantity to Credit"), tr("Order Price"), tr("Credit Price"));
    table_header($th);
    start_row();
    label_cell($_POST['grn_item_id']);
    label_cell($myrow['item_code'] . " " . $myrow['description']);
    qty_cell($myrow["quantity_inv"]);
    qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'], 0)));
    amount_cell($myrow['unit_price']);
    amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
    end_row();
    end_table(1);
    submit_center('AddGRNToTrans', tr("Add to Credit Note"));
    hidden('GRNNumber', $_POST['grn_item_id']);
    hidden('item_code', $myrow['item_code']);
    hidden('item_description', $myrow['description']);
    hidden('qty_recd', $myrow['qty_recd']);
    hidden('prev_quantity_inv', $myrow['quantity_inv']);
    hidden('order_price', $myrow['unit_price']);
    hidden('std_cost_unit', $myrow['std_cost_unit']);
    hidden('po_detail_item', $myrow['po_detail_item']);
}
end_form();