} //--------------------------------------------------------------------------------------------------- if (isset($_POST['CancelOrder'])) { handle_cancel_po(); } //--------------------------------------------------------------------------------------------------- if (isset($_POST['CancelUpdate'])) { copy_to_po(); unset_form_variables(); } //--------------------------------------------------------------------------------------------------- if (isset($_GET['ModifyOrderNumber']) && $_GET['ModifyOrderNumber'] != "") { create_new_po(); $_SESSION['PO']->order_no = $_GET['ModifyOrderNumber']; /*read in all the selected order into the Items cart */ read_po($_SESSION['PO']->order_no, $_SESSION['PO']); copy_from_po(); } //-------------------------------------------------------------------------------- if (isset($_GET['NewOrder'])) { create_new_po(); } else { if (!isset($_POST['supplier_id'])) { $_POST['supplier_id'] = $_SESSION['PO']->supplier_id; } if (!isset($_POST['OrderDate'])) { $_POST['OrderDate'] = $_SESSION['PO']->orig_order_date; } if (!isset($_POST['Requisition'])) { $_POST['Requisition'] = $_SESSION['PO']->requisition_no; }
echo "<center><a href='{$path_to_root}/po_receive_items.php?" . SID . "PONumber=" . $_SESSION['PO']->OrderNumber . "'>" . tr("Re-Read the updated purchase order for receiving goods against") . "</a></center>"; unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); exit; } $grn = add_grn($_SESSION['PO'], $_POST['DefaultReceivedDate'], $_POST['ref'], $_POST['Location']); unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$grn}"); } //-------------------------------------------------------------------------------------------------- if (isset($_GET['PONumber']) && $_GET['PONumber'] > 0 && !isset($_POST['Update'])) { create_new_po(); /*read in all the selected order into the Items cart */ read_po($_GET['PONumber'], $_SESSION['PO']); } //-------------------------------------------------------------------------------------------------- if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived'])) { /* if update quantities button is hit page has been called and ${$line->line_no} would have be set from the post to the quantity to be received in this receival*/ foreach ($_SESSION['PO']->line_items as $line) { $_POST[$line->line_no] = max($_POST[$line->line_no], 0); if (!check_num($line->line_no)) { $_POST[$line->line_no] = qty_format(0); } if (!isset($_POST['DefaultReceivedDate']) || $_POST['DefaultReceivedDate'] == "") { $_POST['DefaultReceivedDate'] = Today(); } $_SESSION['PO']->line_items[$line->line_no]->receive_qty = input_num($line->line_no); if (isset($_POST[$line->stock_id . "Desc"]) && strlen($_POST[$line->stock_id . "Desc"]) > 0) {
$page_security = 'SA_SUPPTRANSVIEW'; $path_to_root = "../.."; include $path_to_root . "/purchasing/includes/po_class.inc"; include $path_to_root . "/includes/session.inc"; include $path_to_root . "/purchasing/includes/purchasing_ui.inc"; $js = ""; if ($use_popup_windows) { $js .= get_js_open_window(900, 500); } page(_($help_context = "View Purchase Order"), true, false, "", $js); if (!isset($_GET['trans_no'])) { die("<br>" . _("This page must be called with a purchase order number to review.")); } display_heading(_("Purchase Order") . " #" . $_GET['trans_no']); $purchase_order = new purch_order(); read_po($_GET['trans_no'], $purchase_order); echo "<br>"; display_po_summary($purchase_order, true); start_table(TABLESTYLE, "width='90%'", 6); echo "<tr><td valign=top>"; // outer table display_heading2(_("Line Details")); start_table(TABLESTYLE, "width='100%'"); $th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), _("Price"), _("Requested By"), _("Line Total"), _("Quantity Received"), _("Quantity Invoiced")); table_header($th); $total = $k = 0; $overdue_items = false; foreach ($purchase_order->line_items as $stock_item) { $line_total = $stock_item->quantity * $stock_item->price; // if overdue and outstanding quantities, then highlight as so if ($stock_item->quantity - $stock_item->qty_received > 0 && date1_greater_date2(Today(), $stock_item->req_del_date)) {
function update_totals($pref) { global $path_to_root; include_once "{$path_to_root}/sales/includes/cart_class.inc"; include_once "{$path_to_root}/purchasing/includes/po_class.inc"; $cart = new cart(ST_SALESORDER); $sql = "SELECT order_no, trans_type FROM {$pref}sales_orders"; $orders = db_query($sql); if (!$orders) { return false; } while ($order = db_fetch($orders)) { read_sales_order($order['order_no'], $cart, $order['trans_type']); $result = db_query("UPDATE {$pref}sales_orders \n\t\t\t\tSET total=" . $cart->get_trans_total() . " WHERE order_no=" . $order[0]); unset($cart->line_items); } unset($cart); $cart = new purch_order(); $sql = "SELECT order_no FROM {$pref}purch_orders"; $orders = db_query($sql); if (!$orders) { return false; } while ($order_no = db_fetch($orders)) { read_po($order_no[0], $cart); $result = db_query("UPDATE {$pref}purch_orders SET total=" . $cart->get_trans_total()); unset($cart->line_items); } return true; }