Added print document options in inquiries.
[fa-stable.git] / purchasing / inquiry / po_search_completed.php
index 0df563a2b2316930874a0047f6c84a5f5a46bbef..8c18824a8949a18d281f8c59d55d8f1b3bf8529d 100644 (file)
@@ -5,6 +5,7 @@ $path_to_root="../..";
 include($path_to_root . "/includes/session.inc");
 
 include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
+include_once($path_to_root . "/reporting/includes/reporting.inc");
 $js = "";
 if ($use_popup_windows)
        $js .= get_js_open_window(900, 500);
@@ -49,8 +50,8 @@ if (isset($_POST['SelectStockFromList']) &&   ($_POST['SelectStockFromList'] != ""
        ($_POST['SelectStockFromList'] != reserved_words::get_all()))
 {
        $selected_stock_item = $_POST['SelectStockFromList'];
-} 
-else 
+}
+else
 {
        unset($selected_stock_item);
 }
@@ -66,11 +67,11 @@ $sql = "SELECT ".TB_PREF."purch_orders.order_no, ".TB_PREF."suppliers.supp_name,
        AND ".TB_PREF."purch_orders.supplier_id = ".TB_PREF."suppliers.supplier_id
        AND ".TB_PREF."locations.loc_code = ".TB_PREF."purch_orders.into_stock_location ";
 
-if (isset($order_number) && $order_number != "") 
+if (isset($order_number) && $order_number != "")
 {
        $sql .= "AND ".TB_PREF."purch_orders.reference LIKE '%". $order_number . "%'";
-} 
-else 
+}
+else
 {
 
        $data_after = date2sql($_POST['OrdersAfterDate']);
@@ -79,11 +80,11 @@ else
        $sql .= " AND ".TB_PREF."purch_orders.ord_date >= '$data_after'";
        $sql .= " AND ".TB_PREF."purch_orders.ord_date <= '$date_before'";
 
-       if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) 
+       if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all())
        {
                $sql .= " AND ".TB_PREF."purch_orders.into_stock_location = '". $_POST['StockLocation'] . "' ";
        }
-       if (isset($selected_stock_item)) 
+       if (isset($selected_stock_item))
        {
                $sql .= " AND ".TB_PREF."purch_order_details.item_code='". $selected_stock_item ."' ";
        }
@@ -94,20 +95,22 @@ $sql .= " GROUP BY ".TB_PREF."purch_orders.order_no";
 
 $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(_("#"), _("Reference"), _("Supplier"), _("Location"),
-               _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"));
-else           
-       $th = array(_("#"), _("Reference"), _("Supplier"), 
-               _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"));
+               _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),"");
+else
+       $th = array(_("#"), _("Reference"), _("Supplier"),
+               _("Supplier's Reference"), _("Order Date"), _("Currency"), _("Order Total"),"");
 
 table_header($th);
 
 $j = 1;
 $k = 0; //row colour counter
-while ($myrow = db_fetch($result)) 
+while ($myrow = db_fetch($result))
 {
 
        alt_table_row_color($k);
@@ -123,6 +126,7 @@ while ($myrow = db_fetch($result))
        label_cell($date);
        label_cell($myrow["curr_code"]);
        amount_cell($myrow["OrderValue"]);
+       label_cell(print_document_link($myrow['order_no'], _("Print")));
        end_row();
 
        $j++;