if ($Mode == 'Edit') { //editing a selected component from the link to the line item $myrow = get_component_from_bom($selected_id); $_POST['loc_code'] = $myrow["loc_code"]; $_POST['component'] = $myrow["component"]; // by Tom Moulton $_POST['workcentre_added'] = $myrow["workcentre_added"]; $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["component"])); label_row(_("Component:"), $myrow["component"] . " - " . $myrow["description"]); } hidden('selected_id', $selected_id); } else { start_row(); label_cell(_("Component:"), "class='label'"); echo "<td>"; echo stock_component_items_list('component', $selected_parent, null, false, true); if (get_post('_component_update')) { $Ajax->activate('quantity'); } echo "</td>"; end_row(); } hidden('stock_id', $selected_parent); locations_list_row(_("Location to Draw From:"), 'loc_code', null); workcenter_list_row(_("Work Centre Added:"), 'workcentre_added', null); $dec = get_qty_dec(get_post('component')); $_POST['quantity'] = number_format2(input_num('quantity', 1), $dec); qty_row(_("Quantity:"), 'quantity', null, null, null, $dec); end_table(1); submit_add_or_update_center($selected_id == -1, '', 'both'); end_form();
$sql = "SELECT bom.*,stock_master.description FROM bom,stock_master\n\t\t\tWHERE id='{$selected_component}'\n\t\t\tAND stock_master.stock_id=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(tr("Component:"), $myrow["component"] . " - " . $myrow["description"]); } else { //end of if $selected_component hidden('selected_parent', $selected_parent); start_row(); label_cell(tr("Component:")); echo "<td>"; stock_component_items_list('component', $selected_parent, $_POST['component'], false, true); echo "</td>"; end_row(); } locations_list_row(tr("Location to Draw From:"), 'loc_code', null); workcenter_list_row(tr("Work Centre Added:"), 'workcentre_added', null); if (!isset($_POST['quantity'])) { $_POST['quantity'] = qty_format(1); } qty_row(tr("Quantity:"), 'quantity', $_POST['quantity']); end_table(1); submit_center('Submit', tr("Add/Update")); end_form(); } // ---------------------------------------------------------------------------------- end_page();