5 include($path_to_root . "/includes/session.inc");
7 page(_("Inventory Item Where Used Inquiry"));
9 //include($path_to_root . "/includes/date_functions.inc");
10 include($path_to_root . "/includes/ui.inc");
11 include($path_to_root . "/includes/data_checks.inc");
13 check_db_has_stock_items(_("There are no items defined in the system."));
15 start_form(false, true);
17 if (!isset($_POST['stock_id']))
18 $_POST['stock_id'] = get_global_stock_item();
20 echo "<center>" . _("Select an item to display its parent item(s).") . " ";
21 stock_items_list('stock_id', $_POST['stock_id'], false, true);
24 set_global_stock_item($_POST['stock_id']);
26 if (isset($_POST['stock_id']))
28 $sql = "SELECT ".TB_PREF."bom.*,".TB_PREF."stock_master.description,".TB_PREF."workcentres.name As WorkCentreName, ".TB_PREF."locations.location_name
29 FROM ".TB_PREF."bom, ".TB_PREF."stock_master, ".TB_PREF."workcentres, ".TB_PREF."locations
30 WHERE ".TB_PREF."bom.parent = ".TB_PREF."stock_master.stock_id AND ".TB_PREF."bom.workcentre_added = ".TB_PREF."workcentres.id
31 AND ".TB_PREF."bom.loc_code = ".TB_PREF."locations.loc_code
32 AND ".TB_PREF."bom.component='" . $_POST['stock_id'] . "'";
34 $result = db_query($sql,"No parent items were returned");
36 if (db_num_rows($result) == 0)
38 display_note(_("The selected item is not used in any BOMs."));
43 start_table("$table_style width=80%");
45 $th = array(_("Parent Item"), _("Work Centre"), _("Location"), _("Quantity Required"));
49 while ($myrow = db_fetch($result))
52 alt_table_row_color($k);
54 $select_item = $path_to_root . "/manufacturing/manage/bom_edit.php?" . SID . "stock_id=" . $myrow["parent"];
56 label_cell("<a href='$select_item'>" . $myrow["parent"]. " - " . $myrow["description"]. "</a>");
57 label_cell($myrow["WorkCentreName"]);
58 label_cell($myrow["location_name"]);
59 label_cell($myrow["quantity"]);
68 //end of page full new headings if