diff --git a/base/src/org/eevolution/process/CreateCostElement.java b/base/src/org/eevolution/process/CreateCostElement.java index 51cd4da433..9d49e6f302 100644 --- a/base/src/org/eevolution/process/CreateCostElement.java +++ b/base/src/org/eevolution/process/CreateCostElement.java @@ -16,7 +16,6 @@ package org.eevolution.process; -import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; @@ -44,6 +43,8 @@ public class CreateCostElement extends SvrProcess private int p_AD_Org_ID = 0; private int p_C_AcctSchema_ID = 0; private int p_M_CostType_ID = 0; + private int p_M_CostElement_ID = 0; + private int p_M_Product_Category_ID = 0; private int p_M_Product_ID = 0; /** @@ -61,19 +62,27 @@ public class CreateCostElement extends SvrProcess } else if (name.equals("AD_Org_ID")) { - p_AD_Org_ID = ((BigDecimal)para[i].getParameter()).intValue(); + p_AD_Org_ID = para[i].getParameterAsInt(); } else if (name.equals(MCost.COLUMNNAME_C_AcctSchema_ID)) { - p_C_AcctSchema_ID = ((BigDecimal)para[i].getParameter()).intValue(); + p_C_AcctSchema_ID = para[i].getParameterAsInt(); } else if (name.equals(MCost.COLUMNNAME_M_CostType_ID)) { - p_M_CostType_ID = ((BigDecimal)para[i].getParameter()).intValue(); + p_M_CostType_ID = para[i].getParameterAsInt(); + } + else if (name.equals(MCost.COLUMNNAME_M_CostElement_ID)) + { + p_M_CostElement_ID = para[i].getParameterAsInt(); + } + else if (name.equals(MProduct.COLUMNNAME_M_Product_Category_ID)) + { + p_M_Product_Category_ID = para[i].getParameterAsInt(); } else if (name.equals(MCost.COLUMNNAME_M_Product_ID)) { - p_M_Product_ID = ((BigDecimal)para[i].getParameter()).intValue(); + p_M_Product_ID = para[i].getParameterAsInt(); } else log.log(Level.SEVERE,"prepare - Unknown Parameter: " + name); @@ -87,12 +96,19 @@ public class CreateCostElement extends SvrProcess ArrayList params = new ArrayList(); String sql = "SELECT M_Product_ID FROM M_Product WHERE AD_Client_ID=?"; params.add(getAD_Client_ID()); + if (p_M_Product_Category_ID != 0) + { + sql = sql + " AND M_Product_Category_ID=?"; + params.add(p_M_Product_Category_ID); + } + if (p_M_Product_ID != 0) { sql = sql + " AND M_Product_ID=?"; params.add(p_M_Product_ID); } + MCostElement[] elements = MCostElement.getElements(getCtx(), get_TrxName()); if (elements.length == 0) { @@ -116,6 +132,9 @@ public class CreateCostElement extends SvrProcess { for(MCostElement element : elements) { + if(p_M_CostElement_ID > 0 && element.get_ID() != p_M_CostElement_ID) + continue; + MCost cost = new MCost(getCtx(), 0, get_TrxName()); cost.setM_Product_ID(m_M_Product_ID); cost.setAD_Org_ID(p_AD_Org_ID); diff --git a/migration/352a-trunk/292_BF2112805_Cost_Element.sql b/migration/352a-trunk/292_BF2112805_Cost_Element.sql new file mode 100644 index 0000000000..5651f6c47e --- /dev/null +++ b/migration/352a-trunk/292_BF2112805_Cost_Element.sql @@ -0,0 +1,45 @@ +-- Sep 15, 2008 12:51:48 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET ColumnName='M_CostElement_ID', AD_Element_ID=2700, Description='Product Cost Element', Help=NULL, FieldLength=22, IsActive='Y', Name='Cost Element',Updated=TO_DATE('2008-09-15 12:51:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53091 +; + +-- Sep 15, 2008 12:51:48 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=53091 +; + +-- Sep 15, 2008 12:53:09 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET ColumnName='M_Product_Category_ID', AD_Element_ID=453, Description='Category of a Product', Help='Identifies the category which this product belongs to. Product categories are used for pricing and selection.', IsActive='Y', Name='Product Category',Updated=TO_DATE('2008-09-15 12:53:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53088 +; + +-- Sep 15, 2008 12:53:09 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=53088 +; + +-- Sep 15, 2008 12:55:19 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_DATE('2008-09-15 12:55:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53093 +; + +-- Sep 15, 2008 12:55:25 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_DATE('2008-09-15 12:55:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53091 +; + +-- Sep 15, 2008 12:55:34 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=50,Updated=TO_DATE('2008-09-15 12:55:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53092 +; + +-- Sep 15, 2008 12:55:41 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=60,Updated=TO_DATE('2008-09-15 12:55:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53092 +; + +-- Sep 15, 2008 12:55:49 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=50,Updated=TO_DATE('2008-09-15 12:55:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53088 +; + diff --git a/migration/352a-trunk/postgresql/292_BF2112805_Cost_Element.sql b/migration/352a-trunk/postgresql/292_BF2112805_Cost_Element.sql new file mode 100644 index 0000000000..cbd92815d0 --- /dev/null +++ b/migration/352a-trunk/postgresql/292_BF2112805_Cost_Element.sql @@ -0,0 +1,45 @@ +-- Sep 15, 2008 12:51:48 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET ColumnName='M_CostElement_ID', AD_Element_ID=2700, Description='Product Cost Element', Help=NULL, FieldLength=22, IsActive='Y', Name='Cost Element',Updated=TO_TIMESTAMP('2008-09-15 12:51:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53091 +; + +-- Sep 15, 2008 12:51:48 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=53091 +; + +-- Sep 15, 2008 12:53:09 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET ColumnName='M_Product_Category_ID', AD_Element_ID=453, Description='Category of a Product', Help='Identifies the category which this product belongs to. Product categories are used for pricing and selection.', IsActive='Y', Name='Product Category',Updated=TO_TIMESTAMP('2008-09-15 12:53:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53088 +; + +-- Sep 15, 2008 12:53:09 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=53088 +; + +-- Sep 15, 2008 12:55:19 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2008-09-15 12:55:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53093 +; + +-- Sep 15, 2008 12:55:25 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_TIMESTAMP('2008-09-15 12:55:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53091 +; + +-- Sep 15, 2008 12:55:34 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=50,Updated=TO_TIMESTAMP('2008-09-15 12:55:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53092 +; + +-- Sep 15, 2008 12:55:41 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=60,Updated=TO_TIMESTAMP('2008-09-15 12:55:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53092 +; + +-- Sep 15, 2008 12:55:49 PM CDT +-- Fix Cost Parameter +UPDATE AD_Process_Para SET SeqNo=50,Updated=TO_TIMESTAMP('2008-09-15 12:55:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53088 +; +