X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=manufacturing%2Fmanage%2Fbom_edit.php;h=697629bcf923aad5f574ecd5a515e8a6b84115eb;hb=9242b29b0b78487a0c5b5c9a17a7caa80aeec296;hp=aca1d7610ff1f31d6348faceb8815637d018c38b;hpb=f2343f51b0ed0d9abd2ec98b64f202beb9716d37;p=fa-stable.git diff --git a/manufacturing/manage/bom_edit.php b/manufacturing/manage/bom_edit.php index aca1d761..697629bc 100644 --- a/manufacturing/manage/bom_edit.php +++ b/manufacturing/manage/bom_edit.php @@ -27,37 +27,12 @@ simple_page_mode(true); $selected_component = $selected_id; //-------------------------------------------------------------------------------------------------- -//if (isset($_GET["NewItem"])) -//{ -// $_POST['stock_id'] = $_GET["NewItem"]; -//} if (isset($_GET['stock_id'])) { $_POST['stock_id'] = $_GET['stock_id']; $selected_parent = $_GET['stock_id']; } -/* selected_parent could come from a post or a get */ -/*if (isset($_GET["selected_parent"])) -{ - $selected_parent = $_GET["selected_parent"]; -} -else if (isset($_POST["selected_parent"])) -{ - $selected_parent = $_POST["selected_parent"]; -} -*/ -/* selected_component could also come from a post or a get */ -/*if (isset($_GET["selected_component"])) -{ - $selected_component = $_GET["selected_component"]; -} -else -{ - $selected_component = get_post("selected_component", -1); -} -*/ - //-------------------------------------------------------------------------------------------------- function display_bom_items($selected_parent) @@ -70,9 +45,10 @@ function display_bom_items($selected_parent) table_header($th); $k = 0; + $found = false; while ($myrow = db_fetch($result)) { - + $found = true; alt_table_row_color($k); label_cell($myrow["component"]); @@ -87,9 +63,29 @@ function display_bom_items($selected_parent) } //END WHILE LIST LOOP end_table(); + + if ($found) { + start_table(TABLESTYLE, "width='60%'"); + stock_manufactured_items_list_row(_("Copy BOM to another manufacturable item"), 'new_stock_id', $selected_parent, false, true); + end_table(); + } + div_end(); } +function copy_bom_items($stock_id, $new_stock_id) +{ + $result = get_bom($stock_id); + while ($myrow = db_fetch($result)) + { + $_POST['component'] = $myrow["component"]; + $_POST['loc_code'] = $myrow["loc_code"]; + $_POST['workcentre_added'] = $myrow["workcentre_added"]; + $_POST['quantity'] = $myrow["quantity"]; + on_submit($new_stock_id, -1); + } +} + //-------------------------------------------------------------------------------------------------- function on_submit($selected_parent, $selected_component=-1) @@ -160,6 +156,14 @@ if ($Mode == 'RESET') //-------------------------------------------------------------------------------------------------- +if (list_updated('new_stock_id')) { + copy_bom_items($_POST['stock_id'], $_POST['new_stock_id']); + $item = get_item($_POST['new_stock_id']); + $_POST['stock_id'] = $_POST['new_stock_id']; + $Ajax->activate('_page_body'); + display_notification(_("BOM copied to ") . $item['description']); +} + start_form(); start_form(false, true); @@ -168,7 +172,10 @@ start_row(); stock_manufactured_items_list_cells(_("Select a manufacturable item:"), 'stock_id', null, false, true); end_row(); if (list_updated('stock_id')) +{ + $selected_id = -1; $Ajax->activate('_page_body'); +} end_table(); br(); @@ -217,7 +224,7 @@ start_form(); echo ""; end_row(); } - hidden('stock_id', $selected_parent); +// hidden('stock_id', $selected_parent); locations_list_row(_("Location to Draw From:"), 'loc_code', null); workcenter_list_row(_("Work Centre Added:"), 'workcentre_added', null);