2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
13 $path_to_root="../..";
14 include($path_to_root . "/includes/db_pager.inc");
15 include($path_to_root . "/includes/session.inc");
17 page(_("Inventory Item Where Used Inquiry"));
19 include($path_to_root . "/includes/ui.inc");
21 check_db_has_stock_items(_("There are no items defined in the system."));
23 start_form(false, true);
25 if (!isset($_POST['stock_id']))
26 $_POST['stock_id'] = get_global_stock_item();
28 echo "<center>" . _("Select an item to display its parent item(s).") . " ";
29 stock_items_list('stock_id', $_POST['stock_id'], false, true);
32 set_global_stock_item($_POST['stock_id']);
33 //-----------------------------------------------------------------------------
34 function select_link($row)
36 return pager_link( $row["parent"]. " - " . $row["description"],
37 "/manufacturing/manage/bom_edit.php?stock_id=" . $row["parent"]);
42 workcentre.name As WorkCentreName,
43 location.location_name,
46 FROM ".TB_PREF."bom as bom, "
47 .TB_PREF."stock_master as parent, "
48 .TB_PREF."workcentres as workcentre, "
49 .TB_PREF."locations as location
50 WHERE bom.parent = parent.stock_id
51 AND bom.workcentre_added = workcentre.id
52 AND bom.loc_code = location.loc_code
53 AND bom.component='" . $_POST['stock_id'] . "'";
56 _("Parent Item") => array('fun'=>'select_link'),
59 _("Quantity Required")
62 $table =& new_db_pager('usage_table', $sql, $cols);
64 if (get_post('_stock_id_update'))
65 $table->set_sql($sql);
67 $table->width = "80%";
68 display_db_pager($table);