X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=manufacturing%2Fmanage%2Fbom_edit.php;h=697629bcf923aad5f574ecd5a515e8a6b84115eb;hb=ce5f33c17196c1f32e05576da2fd9719db60c596;hp=e963d5634f53192d22aaf161ad1e68b6e8f3ab88;hpb=e2fa1c1b9543dedb3cd0a3a36dc539c86f7ff473;p=fa-stable.git
diff --git a/manufacturing/manage/bom_edit.php b/manufacturing/manage/bom_edit.php
index e963d563..697629bc 100644
--- a/manufacturing/manage/bom_edit.php
+++ b/manufacturing/manage/bom_edit.php
@@ -19,8 +19,6 @@ include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/data_checks.inc");
-include_once($path_to_root . "/includes/manufacturing.inc");
-
check_db_has_bom_stock_items(_("There are no manufactured or kit items defined in the system."));
check_db_has_workcentres(_("There are no work centres defined in the system. BOMs require at least one work centre be defined."));
@@ -29,54 +27,28 @@ 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)
{
- global $table_style;
-
$result = get_bom($selected_parent);
div_start('bom');
- start_table("$table_style width=60%");
+ start_table(TABLESTYLE, "width='60%'");
$th = array(_("Code"), _("Description"), _("Location"),
_("Work Centre"), _("Quantity"), _("Units"),'','');
table_header($th);
$k = 0;
+ $found = false;
while ($myrow = db_fetch($result))
{
-
+ $found = true;
alt_table_row_color($k);
label_cell($myrow["component"]);
@@ -91,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)
@@ -164,13 +156,26 @@ 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);
-start_table("class='tablestyle_noborder'");
-stock_manufactured_items_list_row(_("Select a manufacturable item:"), 'stock_id', null, false, true);
+start_table(TABLESTYLE_NOBORDER);
+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();
@@ -189,7 +194,7 @@ start_form();
//--------------------------------------------------------------------------------------
echo '
';
- start_table($table_style2);
+ start_table(TABLESTYLE2);
if ($selected_id != -1)
{
@@ -208,7 +213,7 @@ start_form();
else
{
start_row();
- label_cell(_("Component:"));
+ label_cell(_("Component:"), "class='label'");
echo "