" . _("Select a manufacturable item:") . " "; stock_bom_items_list('stock_id', null, false, true); echo ""; end_form(); if (isset($_POST['_stock_id_update'])) $Ajax->activate('bom'); //-------------------------------------------------------------------------------------------------- if (isset($_POST['stock_id'])) { //Parent Item selected so display bom or edit component $selected_parent = $_POST['stock_id']; if (isset($selected_parent) && isset($_POST['Submit'])) { if(isset($selected_component)) on_submit($selected_parent, $selected_component); else on_submit($selected_parent); } //-------------------------------------------------------------------------------------- display_bom_items($selected_parent); if (isset($selected_parent) && isset($selected_component)) { hyperlink_params($_SERVER['PHP_SELF'], _("Add a new Component"), "NewItem=$selected_parent"); } //-------------------------------------------------------------------------------------- start_form(false, true, $_SERVER['PHP_SELF'] . "?" . SID . "NewItem=" . $selected_parent); start_table($table_style2); if (isset($selected_component)) { //editing a selected component from the link to the line item $sql = "SELECT ".TB_PREF."bom.*,".TB_PREF."stock_master.description FROM ".TB_PREF."bom,".TB_PREF."stock_master WHERE id='$selected_component' AND ".TB_PREF."stock_master.stock_id=".TB_PREF."bom.component"; $result = db_query($sql, "could not get bom"); $myrow = db_fetch($result); $_POST['loc_code'] = $myrow["loc_code"]; $_POST['workcentre_added'] = $myrow["workcentre_added"]; $_POST['quantity'] = qty_format($myrow["quantity"]); hidden('selected_parent', $selected_parent); hidden('selected_component', $selected_component); label_row(_("Component:"), $myrow["component"] . " - " . $myrow["description"]); } else { //end of if $selected_component hidden('selected_parent', $selected_parent); start_row(); label_cell(_("Component:")); echo ""; stock_component_items_list('component', $selected_parent, null, false, true); echo ""; end_row(); } locations_list_row(_("Location to Draw From:"), 'loc_code', null); workcenter_list_row(_("Work Centre Added:"), 'workcentre_added', null); if (!isset($_POST['quantity'])) { $_POST['quantity'] = qty_format(1); } qty_row(_("Quantity:"), 'quantity', $_POST['quantity']); end_table(1); submit_center('Submit', _("Add/Update")); end_form(); } // ---------------------------------------------------------------------------------- end_page(); ?>