From 1ea0cc1da58b5d0bdee798dc4e4c4de2f69f2a9f Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Thu, 19 Feb 2009 09:06:00 +0000 Subject: [PATCH] Implementation the Manufacturing Cost Engine https://sourceforge.net/tracker2/?func=detail&aid=2615593&group_id=176962&atid=934929 Remove dependences with Libero --- base/src/org/compiere/model/MCost.java | 84 -------------------------- 1 file changed, 84 deletions(-) diff --git a/base/src/org/compiere/model/MCost.java b/base/src/org/compiere/model/MCost.java index 8dcd9d9c36..12b91dc294 100644 --- a/base/src/org/compiere/model/MCost.java +++ b/base/src/org/compiere/model/MCost.java @@ -50,90 +50,6 @@ import org.compiere.util.Trx; public class MCost extends X_M_Cost { private static final long serialVersionUID = 1L; - - /** - * Get the the Total Cost for Cost Type and Cost Element Type - * @param product Product - * @param as Account Schema - * @param AD_Org_ID Organization ID - * @param M_AttributeSetInstance_ID Attribute Set Instance ID - * @param M_CostType_ID cost type - * @param CostElementType Cost Element Type - * @param Qty Quantity - * @return Total Costs for Cost Type and Cost Element Type - */ - public static BigDecimal getCostByCostType (MProduct product, MAcctSchema as, - int AD_Org_ID, int M_AttributeSetInstance_ID, - int M_CostType_ID, String CostElementType, - BigDecimal Qty) - { - Collection costs = getByCostType(product, as, M_CostType_ID, AD_Org_ID, M_AttributeSetInstance_ID, - CostElementType); - BigDecimal m_cost = Env.ZERO; - for(MCost cost : costs) - { - m_cost = cost.getCurrentCostPrice().add(cost.getCurrentCostPriceLL()); - } - - return m_cost.multiply(Qty); - } // get - - /** - * Get MCosts for Cost Type and Cost Element Type. - * NOTE: It uses Product's trxName. - * @param product Product - * @param as Account Schema - * @param AD_Org_ID Organization ID - * @param M_AttributeSetInstance_ID Attribute Set Instance ID - * @param CostElementType Cost Element Type or null - * @return Get MCost Collection for Cost Type and Cost Element Type - */ - public static Collection getByCostType (MProduct product, MAcctSchema as, - int M_CostType_ID, int AD_Org_ID, int M_AttributeSetInstance_ID, String CostElementType) - { - //Set the Costing Level - String CostingLevel = product.getCostingLevel(as); - if (MAcctSchema.COSTINGLEVEL_Client.equals(CostingLevel)) - { - AD_Org_ID = 0; - M_AttributeSetInstance_ID = 0; - } - else if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel)) - { - M_AttributeSetInstance_ID = 0; - } - else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) - { - AD_Org_ID = 0; - } - - String whereClause = "AD_Client_ID=? AND AD_Org_ID=?" - + " AND "+COLUMNNAME_M_Product_ID+"=?" - + " AND "+COLUMNNAME_M_AttributeSetInstance_ID+"=?" - + " AND "+COLUMNNAME_C_AcctSchema_ID+"=?" - + " AND "+COLUMNNAME_M_CostType_ID+"=?"; - - List params = new ArrayList(); - params.add(product.getAD_Client_ID()); - params.add(AD_Org_ID); - params.add(product.getM_Product_ID()); - params.add(M_AttributeSetInstance_ID); - params.add(as.getC_AcctSchema_ID()); - params.add(M_CostType_ID); - if(CostElementType != null) - { - whereClause += " AND EXISTS (SELECT 1 FROM M_CostElement ce" - +" WHERE ce.M_CostElement_ID=M_Cost.M_CostElement_ID " - +" AND ce.CostElementType=?" - +")"; - params.add(CostElementType); - } - - return new Query(product.getCtx(), MCost.Table_Name, whereClause, product.get_TrxName()) - .setParameters(params) - .setOnlyActiveRecords(true) - .list(); - } // get /** * Retrieve/Calculate Current Cost Price