It is not rolling up correctly the lower level costs

http://sourceforge.net/tracker2/?func=detail&aid=2530003&group_id=176962&atid=879332

Adding the method costing in the business logic
This commit is contained in:
vpj-cd 2009-01-28 22:52:37 +00:00
parent 482cf51c57
commit d73ec51ab5
11 changed files with 431 additions and 303 deletions

View File

@ -350,7 +350,7 @@ public abstract class Doc
else if (AD_Table_ID == MHRProcess.Table_ID)
doc = new Doc_Payroll (ass, rs, trxName);
else if (AD_Table_ID == MPPCostCollector.Table_ID)
doc = new Doc_Cost_Collector (ass, rs, trxName);
doc = new Doc_CostCollector (ass, rs, trxName);
if (doc == null)
s_log.log(Level.SEVERE, "Unknown AD_Table_ID=" + AD_Table_ID);
return doc;

View File

@ -18,6 +18,7 @@ package org.compiere.acct;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
@ -42,7 +43,7 @@ import org.eevolution.model.MPPOrderNode;
* </pre>
* @author victor.perez@e-evolution.com http://www.e-evolution.com
*/
public class Doc_Cost_Collector extends Doc
public class Doc_CostCollector extends Doc
{
@ -52,7 +53,7 @@ public class Doc_Cost_Collector extends Doc
* @param rs record
* @param trxName trx
*/
protected Doc_Cost_Collector (MAcctSchema[] ass, ResultSet rs, String trxName)
protected Doc_CostCollector (MAcctSchema[] ass, ResultSet rs, String trxName)
{
super(ass, MPPCostCollector.class, rs, DOCTYPE_MOrder, trxName);
} //Doc Cost Collector
@ -118,62 +119,28 @@ public class Doc_Cost_Collector extends Doc
MAccount credit = m_line.getAccount(ProductCost.ACCTTYPE_P_WorkInProcess, as);
BigDecimal cost = Env.ZERO;
//Material
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Material,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_Material, as, fact, product, debit, credit, cost,m_cc.getMovementQty() );
//Resource (Labor)
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Resource,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_Resource, as, fact, product, debit, credit, cost,m_cc.getMovementQty());
//Burden
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_BurdenMOverhead,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_BurdenMOverhead, as, fact, product, debit, credit, cost,m_cc.getMovementQty());
//Outsite Processing
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_OutsideProcessing,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_OutsideProcessing, as, fact, product, debit, credit, cost, m_cc.getMovementQty());
//Overhead Applied
credit = m_line.getAccount(ProductCost.ACCTTYPE_P_Overhead, as);
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Overhead,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_OutsideProcessing, as, fact, product, debit, credit, cost, m_cc.getMovementQty());
Collection<MCostElement> elements = MCostElement.getByCostingMethod(getCtx(), as.getCostingMethod());
for(MCostElement element : elements)
{
cost = MCost.getCostByCostType(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
as.getM_CostType_ID() , element.getCostElementType(),m_cc.getMovementQty());
createLines(element.getCostElementType(), as, fact, product, debit, credit, cost,m_cc.getMovementQty());
log.info("Account Fact for Cost Element:" + element.getName() + " Cost:" + cost);
}
//Account Scrap
if(m_cc.getScrappedQty().signum() != 0)
{
credit = m_line.getAccount(ProductCost.ACCTTYPE_P_WorkInProcess, as);
debit = m_line.getAccount(ProductCost.ACCTTYPE_P_Scrap, as);
//Material
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Material,m_cc.getScrappedQty());
createLines(MCostElement.COSTELEMENTTYPE_Material, as, fact, product, debit, credit, cost,m_cc.getScrappedQty());
//Resource (Labor)
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Resource,m_cc.getScrappedQty());
createLines(MCostElement.COSTELEMENTTYPE_Resource, as, fact, product, debit, credit, cost, m_cc.getScrappedQty());
//Burden
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_BurdenMOverhead,m_cc.getScrappedQty());
createLines(MCostElement.COSTELEMENTTYPE_BurdenMOverhead, as, fact, product, debit, credit, cost, m_cc.getScrappedQty());
//Outsite Processing
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_OutsideProcessing,m_cc.getScrappedQty());
createLines(MCostElement.COSTELEMENTTYPE_OutsideProcessing, as, fact, product, debit, credit, cost, m_cc.getScrappedQty());
//Overhead Applied
credit = m_line.getAccount(ProductCost.ACCTTYPE_P_Overhead, as);
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Overhead,m_cc.getScrappedQty());
createLines(MCostElement.COSTELEMENTTYPE_OutsideProcessing, as, fact, product, debit, credit, cost, m_cc.getScrappedQty());
for(MCostElement element : elements)
{
cost = MCost.getCostByCostType(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
as.getM_CostType_ID() , element.getCostElementType(),m_cc.getMovementQty());
createLines(element.getCostElementType(), as, fact, product, debit, credit, cost,m_cc.getMovementQty());
log.info("Account Fact for Cost Element:" + element.getName() + " Cost:" + cost);
}
}
}
else if (MPPCostCollector.COSTCOLLECTORTYPE_ComponentIssue.equals(m_cc.getCostCollectorType()))
@ -196,33 +163,15 @@ public class Doc_Cost_Collector extends Doc
}
BigDecimal cost = Env.ZERO;
//Material
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Material,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_Material, as, fact, product, debit, credit, cost, m_cc.getMovementQty());
//Resource (Labor)
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Resource,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_Resource, as, fact, product, debit, credit, cost, m_cc.getMovementQty());
//Burden
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_BurdenMOverhead,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_BurdenMOverhead, as, fact, product, debit, credit, cost, m_cc.getMovementQty());
//Outsite Processing
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_OutsideProcessing,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_OutsideProcessing, as, fact, product, debit, credit, cost, m_cc.getMovementQty());
//Overhead Applied
credit = m_line.getAccount(ProductCost.ACCTTYPE_P_Overhead, as);
cost = MCost.getCostByCostingMethod(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
MCostElement.COSTINGMETHOD_StandardCosting, MCostElement.COSTELEMENTTYPE_Overhead,m_cc.getMovementQty());
createLines(MCostElement.COSTELEMENTTYPE_OutsideProcessing, as, fact, product, debit, credit, cost, m_cc.getMovementQty());
Collection<MCostElement> elements = MCostElement.getByCostingMethod(getCtx(), as.getCostingMethod());
for(MCostElement element : elements)
{
cost = MCost.getCostByCostType(product, as, m_cc.getAD_Org_ID(), m_cc.getM_AttributeSetInstance_ID(),
as.getM_CostType_ID() , element.getCostElementType(),m_cc.getMovementQty());
createLines(element.getCostElementType(), as, fact, product, debit, credit, cost,m_cc.getMovementQty());
log.info("Account Fact for Cost Element:" + element.getName() + " Cost:" + cost);
}
}
else if (MPPCostCollector.COSTCOLLECTORTYPE_ActivityControl.equals(m_cc.getCostCollectorType()))
{

View File

@ -57,14 +57,14 @@ public class MCost extends X_M_Cost
* @param as Account Schema
* @param AD_Org_ID Organization ID
* @param M_AttributeSetInstance_ID Attribute Set Instance ID
* @param CostingMethod Costing Method
* @param C_CostType_ID TODO
* @param CostElementType Cost Element Type
* @param Qty Quantity
* @return Get the the Total Cost for this Cost Element Type and Costing Method
*/
public static BigDecimal getCostByCostingMethod (MProduct product, MAcctSchema as,
public static BigDecimal getCostByCostType (MProduct product, MAcctSchema as,
int AD_Org_ID, int M_AttributeSetInstance_ID,
String CostingMethod, String CostElementType,
int C_CostType_ID, String CostElementType,
BigDecimal Qty)
{
//Set the Costing Level
@ -87,7 +87,7 @@ public class MCost extends X_M_Cost
+ " AND C_AcctSchema_ID=?"
+ " AND EXISTS ( SELECT 1 FROM M_CostElement ce "
+ " WHERE ce.M_CostElement_ID=M_Cost.M_CostElement_ID "
+ " AND ce.CostingMethod=? AND ce.CostElementType=?)";
+ " AND ce.CostElementType=?)";
costs = new Query(product.getCtx(), MCost.Table_Name, whereClause, product.get_TrxName())
@ -97,7 +97,8 @@ public class MCost extends X_M_Cost
product.getM_Product_ID(),
M_AttributeSetInstance_ID,
as.getC_AcctSchema_ID(),
CostingMethod, CostElementType})
CostElementType})
.setOnlyActiveRecords(true)
.list();
for(MCost cost : costs)
{
@ -108,18 +109,21 @@ public class MCost extends X_M_Cost
} // get
/**
* Get MCost for this Cost Element Type and Costing Method
* Get MCost 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 CostingMethod Costing Method
* @param CostElementType Cost Element Type
* @return Get MCost Collection for this Cost Element Type and Costing Method
* @return Get MCost Collection for Cost Type and Cost Element Type
*/
public static Collection<MCost> getByCostingMethod (MProduct product, MAcctSchema as,
int AD_Org_ID, int M_AttributeSetInstance_ID,
String CostingMethod, String CostElementType)
public static Collection<MCost> 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);
@ -137,19 +141,46 @@ public class MCost extends X_M_Cost
+ " AND M_Product_ID=?"
+ " AND M_AttributeSetInstance_ID=?"
+ " AND C_AcctSchema_ID=?"
+ " AND M_CostType_ID=?"
+ " AND EXISTS ( SELECT 1 FROM M_CostElement ce "
+ " WHERE ce.M_CostElement_ID=M_Cost.M_CostElement_ID "
+ " AND ce.CostingMethod=? AND ce.CostElementType=?)";
+ " WHERE ce.M_CostElement_ID=M_Cost.M_CostElement_ID ";
List<Object> params = new ArrayList<Object>();
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)
{
params.add(CostElementType);
whereClause += "AND ce.CostElementType=?";
}
whereClause += ")";
return new Query(product.getCtx(), MCost.Table_Name, whereClause, product.get_TrxName())
.setParameters(new Object[]{
product.getAD_Client_ID(),
AD_Org_ID,
product.getM_Product_ID(),
M_AttributeSetInstance_ID,
as.getC_AcctSchema_ID(),
CostingMethod, CostElementType}).list();
.setParameters(params)
.setOnlyActiveRecords(true)
.list();
} // get
/**
* Get MCost for for Cost Type
* @param product Product
* @param as Account Schema
* @param M_CostType_ID Cost Type
* @param AD_Org_ID Organization ID
* @param M_AttributeSetInstance_ID Attribute Set Instance ID
* @param CostElementType Cost Element Type
* @return Get MCost Collection for Cost Type
*/
public static Collection<MCost> getByCostType (MProduct product, MAcctSchema as, int M_CostType_ID ,
int AD_Org_ID, int M_AttributeSetInstance_ID)
{
return getByCostType (product, as, M_CostType_ID,
AD_Org_ID, M_AttributeSetInstance_ID, null);
} // get
/**
@ -1420,33 +1451,12 @@ public class MCost extends X_M_Cost
M_CostType_ID, C_AcctSchema_ID,
M_CostElement_ID, M_AttributeSetInstance_ID};
return new Query(ctx, Table_Name, whereClause, null)
.setOnlyActiveRecords(true)
.setParameters(params)
.first();
} // get
/**
* Get Costs Record for a Cost Type
* @param ctx context
* @param AD_Client_ID client
* @param AD_Org_ID org
* @param M_Product_ID product
* @param M_CostType_ID cost type
* @param C_AcctSchema_ID as
* @param TrxName transaction name
* @return array costs
*/
public static MCost[] getCosts(Properties ctx , int AD_Client_ID, int AD_Org_ID , int M_Product_ID, int M_CostType_ID ,int C_AcctSchema_ID ,String trxName)
{
String whereClause = "AD_Client_ID = ? AND AD_Org_ID = ? AND M_Product_ID= ? AND C_Acctschema_ID = ? AND M_CostType_ID = ? ";
Query query = MTable.get(ctx, MCost.Table_ID)
.createQuery(whereClause, trxName);
query.setParameters(new Object[]{AD_Client_ID, AD_Org_ID, M_Product_ID, C_AcctSchema_ID, M_CostType_ID});
List<MCost> list = query.list();
MCost[] retValue = new MCost[list.size()];
list.toArray(retValue);
return retValue;
}
/**
* Get Costs Record for a Cost Type
@ -1466,6 +1476,7 @@ public class MCost extends X_M_Cost
Query query = MTable.get(ctx, MCost.Table_ID)
.createQuery(whereClause, trxName);
query.setParameters(new Object[]{AD_Client_ID, AD_Org_ID, M_Product_ID, C_AcctSchema_ID, M_CostType_ID, M_CostElement_ID});
query.setOnlyActiveRecords(true);
List<MCost> list = query.list();
for (MCost cost : list)
{

View File

@ -338,6 +338,7 @@ public class MCostElement extends X_M_CostElement
final String whereClause = "CostingMethod=?";
return new Query(ctx, Table_Name, whereClause, null)
.setClient_ID()
.setOnlyActiveRecords(true)
.setParameters(new Object[]{CostingMethod})
.list();
}

View File

@ -676,7 +676,10 @@ public class MWFNode extends X_AD_WF_Node
*/
public BigDecimal getCostForCostElementType(String CostElementType, int C_AcctSchema_ID,int M_CostType_ID,int AD_Org_ID,int setuptime, int duration)
{
MResource resource = (MResource) getS_Resource();
MResource resource = MResource.get(getCtx(), getS_Resource_ID());
if(resource == null)
return Env.ZERO;
//get the rate and convert in second for this cost type element (Resource, Burden)
MWorkflow workflow = getWorkflow();
// Validate the CostingLevel

View File

@ -31,6 +31,7 @@ import org.adempiere.exceptions.DocTypeNotFoundException;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MClient;
import org.compiere.model.MCost;
import org.compiere.model.MCostElement;
import org.compiere.model.MDocType;
import org.compiere.model.MProduct;
import org.compiere.model.MProject;
@ -561,14 +562,14 @@ public class MPPOrder extends X_PP_Order implements DocAction
approveIt();
}
MAcctSchema acctSchema = MClient.get(getCtx(), getAD_Client_ID()).getAcctSchema();
log.info("Cost_Group_ID" + acctSchema.getM_CostType_ID());
MAcctSchema as = MClient.get(getCtx(), getAD_Client_ID()).getAcctSchema();
log.info("Cost_Group_ID" + as.getM_CostType_ID());
//
// Create Standard Costs for Order
MCost[] costs = MCost.getCosts(getCtx(), getAD_Client_ID(), getAD_Org_ID(), getM_Product_ID(),
acctSchema.getM_CostType_ID(), acctSchema.get_ID(),
get_TrxName());
Collection <MCost> costs = MCost.getByCostType(getM_Product(), as, as.getM_CostType_ID(),
getAD_Org_ID(), getM_AttributeSetInstance_ID());
for (MCost cost : costs)
{
MPPOrderCost PP_Order_Cost = new MPPOrderCost(cost, get_ID(), get_TrxName());
@ -579,9 +580,9 @@ public class MPPOrder extends X_PP_Order implements DocAction
// Create Standard Costs for Order BOM Line
for (MPPOrderBOMLine line : getLines())
{
costs = MCost.getCosts(getCtx(), getAD_Client_ID(), getAD_Org_ID(), line.getM_Product_ID(),
acctSchema.getM_CostType_ID(), acctSchema.get_ID(),
get_TrxName());
costs = MCost.getByCostType(line.getM_Product(), as, as.getM_CostType_ID(),
getAD_Org_ID(), getM_AttributeSetInstance_ID());
for (MCost cost : costs)
{
MPPOrderCost PP_Order_Cost = new MPPOrderCost(cost, get_ID(), get_TrxName());

View File

@ -20,6 +20,7 @@ import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Properties;
import java.util.logging.Level;
@ -27,6 +28,7 @@ import org.compiere.model.MAcctSchema;
import org.compiere.model.MConversionRate;
import org.compiere.model.MCost;
import org.compiere.model.MCostElement;
import org.compiere.model.MProduct;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.DB;
@ -100,7 +102,6 @@ public class CopyPriceToStandard extends SvrProcess
protected String doIt() throws Exception
{
//System.out.println("PARAMETROS : p_C_AcctSchema_ID" + p_C_AcctSchema_ID + "p_PP_Cost_Group_ID" + p_PP_Cost_Group_ID + "p_M_Warehouse_ID" + p_M_Warehouse_ID + "p_S_Resource_ID" + p_S_Resource_ID);
BigDecimal price = Env.ZERO;
BigDecimal convrate = Env.ZERO;
int M_PriceList_ID =0;
@ -108,7 +109,7 @@ public class CopyPriceToStandard extends SvrProcess
int M_Product_ID =0;
int C_Currency_ID = 0;
BigDecimal list = Env.ZERO;
MAcctSchema schema = new MAcctSchema(ctx,p_C_AcctSchema_ID ,null);
MAcctSchema as = new MAcctSchema(ctx,p_C_AcctSchema_ID ,null);
StringBuffer sql = new StringBuffer("SELECT M_Product_ID,M_PriceList_Version_ID, PriceStd FROM M_ProductPrice WHERE M_PriceList_Version_ID =" +p_M_PriceList_Version_ID +" AND PriceStd <> 0");
try
{
@ -119,34 +120,28 @@ public class CopyPriceToStandard extends SvrProcess
//
while (rs.next())
{
M_Product_ID = rs.getInt(1);
M_PriceList_Version_ID = rs.getInt(2);
//System.out.println("M_Product_ID" + product_id + "p_C_AcctSchema_ID" + p_C_AcctSchema_ID + "p_PP_Cost_Group_ID" + p_PP_Cost_Group_ID + "p_M_Warehouse_ID" + p_M_Warehouse_ID + "p_S_Resource_ID" + p_S_Resource_ID);
M_PriceList_ID = DB.getSQLValue(get_TrxName(),"SELECT M_PriceList_ID FROM M_PriceList_Version WHERE M_PriceList_Version_ID = ? " ,M_PriceList_Version_ID );
C_Currency_ID = DB.getSQLValue(get_TrxName() , "SELECT C_Currency_ID FROM M_PriceList WHERE M_PriceList_ID = ?",M_PriceList_ID);
M_Product_ID = rs.getInt(1);
M_PriceList_Version_ID = rs.getInt(2);
M_PriceList_ID = DB.getSQLValue(get_TrxName(),"SELECT M_PriceList_ID FROM M_PriceList_Version WHERE M_PriceList_Version_ID = ? " ,M_PriceList_Version_ID );
C_Currency_ID = DB.getSQLValue(get_TrxName() , "SELECT C_Currency_ID FROM M_PriceList WHERE M_PriceList_ID = ?",M_PriceList_ID);
if (C_Currency_ID!=schema.getC_Currency_ID())
if (C_Currency_ID!=as.getC_Currency_ID())
{
price = MConversionRate.convert(ctx,rs.getBigDecimal(3),C_Currency_ID,schema.getC_Currency_ID(),getAD_Client_ID(),p_AD_Org_ID);
price = MConversionRate.convert(ctx,rs.getBigDecimal(3),C_Currency_ID,as.getC_Currency_ID(),getAD_Client_ID(),p_AD_Org_ID);
}
else
price = rs.getBigDecimal(3);
MCost[] costs = MCost.getCosts(getCtx() , getAD_Client_ID(), p_AD_Org_ID , M_Product_ID , p_M_CostType_ID , p_C_AcctSchema_ID , get_TrxName());
if (costs != null)
{
for (MCost cost : costs)
{
MCostElement element = new MCostElement(getCtx(), p_M_CostElement_ID, get_TrxName());
if (element.getCostElementType().equals(element.COSTELEMENTTYPE_Material))
{
cost.setFutureCostPrice(price);
cost.save();
break;
}
}
}
MProduct product = MProduct.get(getCtx(), M_Product_ID);
Collection<MCost> costs = MCost.getByCostType(product, as, p_M_CostType_ID, p_AD_Org_ID, 0, MCostElement.COSTELEMENTTYPE_Material);
for (MCost cost : costs)
{
MCostElement element = new MCostElement(getCtx(), p_M_CostElement_ID, get_TrxName());
cost.setFutureCostPrice(price);
cost.save();
break;
}
}
rs.close();
pstmt.close();

View File

@ -18,6 +18,7 @@ package org.eevolution.process;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
@ -45,13 +46,15 @@ public class RollupBillOfMaterial extends SvrProcess
{
/* Organization */
private int p_AD_Org_ID = 0;
/* Account Schema */
/* Account Schema */
private int p_C_AcctSchema_ID = 0;
/* Cost Type */
private int p_M_CostType_ID = 0;
/* Product */
/* Costing Method */
private String p_ConstingMethod = MCostElement.COSTINGMETHOD_StandardCosting;
/* Product */
private int p_M_Product_ID = 0;
/* Product Category */
/* Product Category */
private int p_M_Product_Category_ID = 0;
/**
@ -65,12 +68,14 @@ public class RollupBillOfMaterial extends SvrProcess
if (para.getParameter() == null)
;
else if (name.equals("AD_Org_ID"))
else if (name.equals(MCostElement.COLUMNNAME_AD_Org_ID))
p_AD_Org_ID = para.getParameterAsInt();
else if (name.equals(MAcctSchema.COLUMNNAME_C_AcctSchema_ID))
p_C_AcctSchema_ID = para.getParameterAsInt();
else if (name.equals(MCostType.COLUMNNAME_M_CostType_ID))
p_M_CostType_ID = para.getParameterAsInt();
else if (name.equals(MCostElement.COLUMNNAME_CostingMethod))
p_ConstingMethod=(String)para.getParameter();
else if (name.equals(MProduct.COLUMNNAME_M_Product_ID))
p_M_Product_ID = para.getParameterAsInt();
else if (name.equals(MProduct.COLUMNNAME_M_Product_Category_ID))
@ -94,72 +99,43 @@ public class RollupBillOfMaterial extends SvrProcess
for (MProduct product : getProducts(lowLevel))
{
int AD_Org_ID = p_AD_Org_ID;
// Validate the CostingLevel
MAcctSchema as = MAcctSchema.get(getCtx(), p_C_AcctSchema_ID);
if(MAcctSchema.COSTINGLEVEL_Client.equals(product.getCostingLevel(as)))
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), p_AD_Org_ID,
0, // M_Warehouse_ID
0, // S_Resource_ID
product.getM_Product_ID(),
get_TrxName());
int yield = 100;
int PP_Product_BOM_ID = 0;
if (pp != null)
{
AD_Org_ID = 0;
PP_Product_BOM_ID = pp.getPP_Product_BOM_ID();
}
if (PP_Product_BOM_ID <= 0)
{
PP_Product_BOM_ID = MPPProductBOM.getBOMSearchKey(product);
}
if (PP_Product_BOM_ID <= 0)
{
continue;
}
for (MCost cost : getCosts(product.get_ID(), AD_Org_ID))
{
log.info("Calculate Lower Cost for :"+ product.getName());
MCostElement element = cost.getCostElement();
log.info("Element Cost:"+ element.getName());
// check if element cost is of Material Type
if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Material))
{
BigDecimal Material = getCurrentCostPriceLL(MCostElement.COSTELEMENTTYPE_Material, product, AD_Org_ID);
log.info("Material Cost Low Level:" + Material);
cost.setCurrentCostPriceLL(Material);
cost.saveEx();
}
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Resource))
{
BigDecimal Labor = getCurrentCostPriceLL(MCostElement.COSTELEMENTTYPE_Resource, product, AD_Org_ID);
log.info("Labor Cost Low Level:" + Labor);
cost.setCurrentCostPriceLL(Labor);
cost.saveEx();
}
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_BurdenMOverhead))
{
BigDecimal Burder = getCurrentCostPriceLL(MCostElement.COSTELEMENTTYPE_BurdenMOverhead, product, AD_Org_ID);
log.info("Burden Cost Low Level:" + Burder);
cost.setCurrentCostPriceLL(Burder);
cost.saveEx();
}
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Overhead))
{
BigDecimal Overhead = getCurrentCostPriceLL(MCostElement.COSTELEMENTTYPE_Overhead, product, AD_Org_ID);
log.info("Overhead Cost Low Level:" + Overhead);
cost.setCurrentCostPriceLL(Overhead);
cost.saveEx();
}
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_OutsideProcessing))
{
BigDecimal Subcontract = getCurrentCostPriceLL(MCostElement.COSTELEMENTTYPE_OutsideProcessing, product, AD_Org_ID);
log.info("Subcontract Cost Low Level:" + Subcontract);
cost.setCurrentCostPriceLL(Subcontract);
cost.saveEx();
}
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Overhead))
{
BigDecimal Subcontract = getCurrentCostPriceLL(MCostElement.COSTELEMENTTYPE_Overhead, product, AD_Org_ID);
log.info("Overhead Cost Low Level:" + Subcontract);
cost.setCurrentCostPriceLL(Subcontract);
cost.saveEx();
}
/* TODO Comment for future implementation
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Distribution))
{
MPPProductBOM bom = MPPProductBOM.get(getCtx(), PP_Product_BOM_ID);
BigDecimal Distribution = getCurrentCostPriceLL(MCostElement.COSTELEMENTTYPE_Distribution, M_Product_ID, AD_Org_ID);
cost.setCurrentCostPriceLL(Distribution);
cost.saveEx();
}
*/
} // for each Costs
Collection<MCostElement> elements = MCostElement.getByCostingMethod(getCtx(), p_ConstingMethod);
for (MCostElement element : elements)
{
for (MCost cost : getCosts(product, element.getCostElementType()))
{
log.info("Calculate Lower Cost for :"+ product.getName());
log.info("Element Cost:"+ element.getName());
BigDecimal price = getCurrentCostPriceLL(bom, element, pp != null ? pp.getYield() : 100);
log.info(element.getName() + " Cost Low Level:" + price);
cost.setCurrentCostPriceLL(price);
cost.saveEx();
} // for each Costs
} // for ELements
} // for each Products
} // for each LLC
return "@OK@";
@ -175,39 +151,20 @@ public class RollupBillOfMaterial extends SvrProcess
* @param C_AcctSchema_ID Account Schema
* @return CurrentCostPriceLL Sum Current Cost Price Level Low for this Cost Element Type
*/
private BigDecimal getCurrentCostPriceLL(String CostElementType, MProduct product, int AD_Org_ID)
private BigDecimal getCurrentCostPriceLL(MPPProductBOM bom, MCostElement element ,int Yield)
{
log.info("ElementType: "+CostElementType);
log.info("ElementType: "+ element.getCostElementType());
BigDecimal costPriceLL = Env.ZERO;
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Org_ID,
0, // M_Warehouse_ID
0, // S_Resource_ID
product.getM_Product_ID(),
get_TrxName());
int PP_Product_BOM_ID = 0;
if (pp != null)
{
PP_Product_BOM_ID = pp.getPP_Product_BOM_ID();
}
if (PP_Product_BOM_ID <= 0)
{
PP_Product_BOM_ID = MPPProductBOM.getBOMSearchKey(product);
}
if (PP_Product_BOM_ID <= 0)
{
return Env.ZERO;
}
MPPProductBOM bom = MPPProductBOM.get(getCtx(), PP_Product_BOM_ID);
for (MPPProductBOMLine bomline : bom.getLines())
{
MProduct component = MProduct.get(getCtx(), bomline.getM_Product_ID());
// get the rate for this resource
for (MCost cost : getCosts(bomline.getM_Product_ID(), AD_Org_ID))
for (MCost cost : getCosts(component, element.getCostElementType()))
{
MCostElement element = cost.getCostElement();
// check if current cost element type is specified cost element type
if (element.getCostElementType().equals(CostElementType))
if (element.getCostElementType().equals(element.getCostElementType()))
{
BigDecimal qtyPercentage = bomline.getQtyBatch().divide(Env.ONEHUNDRED, 8, BigDecimal.ROUND_UP);
BigDecimal qtyBOM = bomline.getQtyBOM();
@ -231,27 +188,29 @@ public class RollupBillOfMaterial extends SvrProcess
}
} // for each cost
} // for each BOM line
//
// Try find planning Data for this product and get % Yield to calculate cost
if (pp != null)
{
int yield = pp.getYield();
if(yield != 0)
{
BigDecimal decimalYield = new BigDecimal(yield / 100);
costPriceLL = costPriceLL.divide(decimalYield, 4 ,BigDecimal.ROUND_HALF_UP);
}
}
if(Yield != 0)
{
BigDecimal decimalYield = new BigDecimal(Yield / 100);
costPriceLL = costPriceLL.divide(decimalYield, 4 ,BigDecimal.ROUND_HALF_UP);
}
return costPriceLL;
}
private MCost[] getCosts(int product_id, int AD_Org_ID)
private Collection<MCost> getCosts(MProduct product,String CostElementType)
{
return MCost.getCosts(getCtx(), getAD_Client_ID(), p_AD_Org_ID, product_id,
p_M_CostType_ID, p_C_AcctSchema_ID , get_TrxName());
MAcctSchema as = MAcctSchema.get(getCtx(), p_C_AcctSchema_ID);
return MCost.getByCostType(
product,
as,
p_M_CostType_ID,
p_AD_Org_ID,
0, // ASI
CostElementType);
}
private List<MProduct> getProducts(int lowLevel)
private Collection<MProduct> getProducts(int lowLevel)
{
List<Object> params = new ArrayList<Object>();
StringBuffer whereClause = new StringBuffer("AD_Client_ID=? AND LowLevel=? AND ProductType=?");

View File

@ -19,6 +19,7 @@ package org.eevolution.process;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
@ -47,52 +48,50 @@ import org.eevolution.model.MPPProductPlanning;
public class RollupWorkflow extends SvrProcess
{
/* Organization */
private int p_AD_Org_ID = 0;
/* Account Schema */
private int p_C_AcctSchema_ID = 0;
/* Organization */
private int p_AD_Org_ID = 0;
/* Account Schema */
private int p_C_AcctSchema_ID = 0;
/* Cost Type */
private int p_M_CostType_ID = 0;
private int p_M_CostType_ID = 0;
/* Product */
private int p_M_Product_ID = 0;
/* Product Category */
private int p_M_Product_Category_ID = 0;
private int p_M_Product_ID = 0;
/* Product Category */
private int p_M_Product_Category_ID = 0;
/* Costing Method */
private String p_ConstingMethod = MCostElement.COSTINGMETHOD_StandardCosting;
private MAcctSchema m_as = null;
/**
* Prepare - e.g., get Parameters.
*/
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
for (ProcessInfoParameter para : getParameter())
{
String name = para[i].getParameterName();
String name = para.getParameterName();
if (para[i].getParameter() == null)
if (para.getParameter() == null)
;
else if (name.equals("AD_Org_ID"))
p_AD_Org_ID = para[i].getParameterAsInt();
else if (name.equals(MCost.COLUMNNAME_AD_Org_ID))
p_AD_Org_ID = para.getParameterAsInt();
else if (name.equals(MCost.COLUMNNAME_C_AcctSchema_ID))
p_C_AcctSchema_ID = para[i].getParameterAsInt();
{
p_C_AcctSchema_ID = para.getParameterAsInt();
m_as = MAcctSchema.get(getCtx(), p_C_AcctSchema_ID);
}
else if (name.equals(MCost.COLUMNNAME_M_CostType_ID))
p_M_CostType_ID = para[i].getParameterAsInt();
p_M_CostType_ID = para.getParameterAsInt();
else if (name.equals(MCostElement.COLUMNNAME_CostingMethod))
p_ConstingMethod=(String)para.getParameter();
else if (name.equals(MProduct.COLUMNNAME_M_Product_ID))
p_M_Product_ID = para[i].getParameterAsInt();
p_M_Product_ID = para.getParameterAsInt();
else if (name.equals(MProduct.COLUMNNAME_M_Product_Category_ID))
p_M_Product_Category_ID = para[i].getParameterAsInt();
p_M_Product_Category_ID = para.getParameterAsInt();
else
log.log(Level.SEVERE,"prepare - Unknown Parameter: " + name);
}
//
if (p_C_AcctSchema_ID <= 0)
{
p_C_AcctSchema_ID = MClient.get(getCtx(), getAD_Client_ID()).getInfo().getC_AcctSchema1_ID();
}
if (p_M_CostType_ID <= 0)
{
MAcctSchema as = MAcctSchema.get(getCtx(), p_C_AcctSchema_ID);
p_M_CostType_ID = as.getM_CostType_ID();
}
} // prepare
/**
@ -123,7 +122,7 @@ public class RollupWorkflow extends SvrProcess
params.add(p_M_Product_Category_ID);
}
List<MProduct> products = new Query(getCtx(),MProduct.Table_Name, whereClause.toString(), get_TrxName())
Collection<MProduct> products = new Query(getCtx(),MProduct.Table_Name, whereClause.toString(), get_TrxName())
.setOrderBy(MProduct.COLUMNNAME_LowLevel)
.setParameters(params)
.list();
@ -156,24 +155,31 @@ public class RollupWorkflow extends SvrProcess
BigDecimal labor = Env.ZERO;
BigDecimal burden = Env.ZERO;
MCost[] costs = MCost.getCosts(getCtx(), getAD_Client_ID(), p_AD_Org_ID, product.getM_Product_ID(), p_M_CostType_ID, p_C_AcctSchema_ID , get_TrxName());
for (MCost cost : costs)
Collection<MCostElement> elements = MCostElement.getByCostingMethod(getCtx(), p_ConstingMethod);
for (MCostElement element : elements)
{
MCostElement element = cost.getCostElement();
if(element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Resource)
|| element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_BurdenMOverhead))
Collection<MCost> costs = MCost.getByCostType(
product,
m_as,
p_M_CostType_ID,
p_AD_Org_ID,
0,element.getCostElementType()); // ASI
for (MCost cost : costs)
{
if(MCostElement.COSTELEMENTTYPE_Resource.equals(element.getCostElementType())
|| MCostElement.COSTELEMENTTYPE_BurdenMOverhead.equals(element.getCostElementType()))
{
for (MWFNode node : nodes)
{
BigDecimal nodeCost = Env.ZERO;
// check if element cost is of type Labor
if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Resource))
if (MCostElement.COSTELEMENTTYPE_Resource.equals(element.getCostElementType()))
{
nodeCost = node.getCostForCostElementType(MCostElement.COSTELEMENTTYPE_Resource ,p_C_AcctSchema_ID, p_M_CostType_ID, p_AD_Org_ID, node.getSetupTime(), node.getDuration());
labor = labor.add(nodeCost);
}
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_BurdenMOverhead))
else if (MCostElement.COSTELEMENTTYPE_BurdenMOverhead.equals(element.getCostElementType()))
{
nodeCost = node.getCostForCostElementType(MCostElement.COSTELEMENTTYPE_BurdenMOverhead ,p_C_AcctSchema_ID, p_M_CostType_ID, p_AD_Org_ID, node.getSetupTime(), node.getDuration());
burden = burden.add(nodeCost);
@ -183,26 +189,29 @@ public class RollupWorkflow extends SvrProcess
node.setCost(node.getCost().add(nodeCost));
node.saveEx();
}
}
} // Node
// check if element cost is of type Labor
if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_Resource))
if (MCostElement.COSTELEMENTTYPE_Resource.equals(element.getCostElementType()))
{
log.info("Product:"+product.getName()+" Labor: " + labor);
cost.setCurrentCostPrice(labor);
cost.saveEx();
}
else if (element.getCostElementType().equals(MCostElement.COSTELEMENTTYPE_BurdenMOverhead))
else if (MCostElement.COSTELEMENTTYPE_BurdenMOverhead.equals(element.getCostElementType()))
{
log.info("Product:"+product.getName()+" Burden: " + burden);
cost.setCurrentCostPrice(burden);
cost.saveEx();
}
}
}
} // MCost
} // Cost Elements
workflow.setCost(labor.add(burden));
workflow.saveEx(get_TrxName());
}
return "@OK@";
}
}
}

View File

@ -0,0 +1,100 @@
-- Jan 27, 2009 10:45:13 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,241,0,53058,53270,17,122,'CostingMethod',TO_DATE('2009-01-27 22:44:49','YYYY-MM-DD HH24:MI:SS'),0,'S','Indicates how Costs will be calculated','EE01',22,'The Costing Method indicates how costs will be calculated (Standard, Average, Lifo, FoFo). The default costing method is defined on accounting schema level and can be optionally overwritten in the product category. The costing method cannot conflict with the Material Movement Policy (defined on Product Category).','Y','Y','Y','N','Costing Method',28,TO_DATE('2009-01-27 22:44:49','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:45:13 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53270 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:46:44 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_DATE('2009-01-27 22:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53103
;
-- Jan 27, 2009 10:46:46 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=109,Updated=TO_DATE('2009-01-27 22:46:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53104
;
-- Jan 27, 2009 10:46:50 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_DATE('2009-01-27 22:46:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53104
;
-- Jan 27, 2009 10:46:53 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_DATE('2009-01-27 22:46:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53106
;
-- Jan 27, 2009 10:46:58 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_DATE('2009-01-27 22:46:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53105
;
-- Jan 27, 2009 10:47:01 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_DATE('2009-01-27 22:47:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53107
;
-- Jan 27, 2009 10:47:18 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_DATE('2009-01-27 22:47:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53106
;
-- Jan 27, 2009 10:47:22 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_DATE('2009-01-27 22:47:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53270
;
-- Jan 27, 2009 10:47:31 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=60,Updated=TO_DATE('2009-01-27 22:47:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53107
;
-- Jan 27, 2009 10:50:11 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,241,0,53062,53271,17,122,'CostingMethod',TO_DATE('2009-01-27 22:50:09','YYYY-MM-DD HH24:MI:SS'),0,'S','Indicates how Costs will be calculated','EE01',22,'The Costing Method indicates how costs will be calculated (Standard, Average, Lifo, FoFo). The default costing method is defined on accounting schema level and can be optionally overwritten in the product category. The costing method cannot conflict with the Material Movement Policy (defined on Product Category).','Y','Y','Y','N','Costing Method',40,TO_DATE('2009-01-27 22:50:09','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:50:11 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53271 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:52:26 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,2071,0,53159,53272,19,'M_CostType_ID',TO_DATE('2009-01-27 22:52:25','YYYY-MM-DD HH24:MI:SS'),0,'Type of Cost (e.g. Current, Plan, Future)','EE01',10,'You can define multiple cost types. A cost type selected in an Accounting Schema is used for accounting.','Y','Y','Y','N','Cost Type',20,TO_DATE('2009-01-27 22:52:25','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:52:26 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53272 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:53:48 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,241,0,53159,53273,17,122,'CostingMethod',TO_DATE('2009-01-27 22:53:47','YYYY-MM-DD HH24:MI:SS'),0,'S','Indicates how Costs will be calculated','EE01',10,'The Costing Method indicates how costs will be calculated (Standard, Average, Lifo, FoFo). The default costing method is defined on accounting schema level and can be optionally overwritten in the product category. The costing method cannot conflict with the Material Movement Policy (defined on Product Category).','Y','Y','Y','N','Costing Method',20,TO_DATE('2009-01-27 22:53:47','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:53:48 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53273 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:54:05 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_DATE('2009-01-27 22:54:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53272
;
-- Jan 27, 2009 10:54:11 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_DATE('2009-01-27 22:54:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53273
;
-- Jan 27, 2009 10:54:14 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=50,Updated=TO_DATE('2009-01-27 22:54:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53267
;

View File

@ -0,0 +1,100 @@
-- Jan 27, 2009 10:45:13 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,241,0,53058,53270,17,122,'CostingMethod',TO_TIMESTAMP('2009-01-27 22:44:49','YYYY-MM-DD HH24:MI:SS'),0,'S','Indicates how Costs will be calculated','EE01',22,'The Costing Method indicates how costs will be calculated (Standard, Average, Lifo, FoFo). The default costing method is defined on accounting schema level and can be optionally overwritten in the product category. The costing method cannot conflict with the Material Movement Policy (defined on Product Category).','Y','Y','Y','N','Costing Method',28,TO_TIMESTAMP('2009-01-27 22:44:49','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:45:13 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53270 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:46:44 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_TIMESTAMP('2009-01-27 22:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53103
;
-- Jan 27, 2009 10:46:46 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=109,Updated=TO_TIMESTAMP('2009-01-27 22:46:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53104
;
-- Jan 27, 2009 10:46:50 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_TIMESTAMP('2009-01-27 22:46:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53104
;
-- Jan 27, 2009 10:46:53 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_TIMESTAMP('2009-01-27 22:46:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53106
;
-- Jan 27, 2009 10:46:58 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_TIMESTAMP('2009-01-27 22:46:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53105
;
-- Jan 27, 2009 10:47:01 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET FieldLength=10,Updated=TO_TIMESTAMP('2009-01-27 22:47:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53107
;
-- Jan 27, 2009 10:47:18 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2009-01-27 22:47:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53106
;
-- Jan 27, 2009 10:47:22 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_TIMESTAMP('2009-01-27 22:47:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53270
;
-- Jan 27, 2009 10:47:31 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=60,Updated=TO_TIMESTAMP('2009-01-27 22:47:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53107
;
-- Jan 27, 2009 10:50:11 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,241,0,53062,53271,17,122,'CostingMethod',TO_TIMESTAMP('2009-01-27 22:50:09','YYYY-MM-DD HH24:MI:SS'),0,'S','Indicates how Costs will be calculated','EE01',22,'The Costing Method indicates how costs will be calculated (Standard, Average, Lifo, FoFo). The default costing method is defined on accounting schema level and can be optionally overwritten in the product category. The costing method cannot conflict with the Material Movement Policy (defined on Product Category).','Y','Y','Y','N','Costing Method',40,TO_TIMESTAMP('2009-01-27 22:50:09','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:50:11 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53271 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:52:26 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,2071,0,53159,53272,19,'M_CostType_ID',TO_TIMESTAMP('2009-01-27 22:52:25','YYYY-MM-DD HH24:MI:SS'),0,'Type of Cost (e.g. Current, Plan, Future)','EE01',10,'You can define multiple cost types. A cost type selected in an Accounting Schema is used for accounting.','Y','Y','Y','N','Cost Type',20,TO_TIMESTAMP('2009-01-27 22:52:25','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:52:26 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53272 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:53:48 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,241,0,53159,53273,17,122,'CostingMethod',TO_TIMESTAMP('2009-01-27 22:53:47','YYYY-MM-DD HH24:MI:SS'),0,'S','Indicates how Costs will be calculated','EE01',10,'The Costing Method indicates how costs will be calculated (Standard, Average, Lifo, FoFo). The default costing method is defined on accounting schema level and can be optionally overwritten in the product category. The costing method cannot conflict with the Material Movement Policy (defined on Product Category).','Y','Y','Y','N','Costing Method',20,TO_TIMESTAMP('2009-01-27 22:53:47','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jan 27, 2009 10:53:48 PM ECT
-- Manufacturing Standard Cost
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53273 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
;
-- Jan 27, 2009 10:54:05 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2009-01-27 22:54:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53272
;
-- Jan 27, 2009 10:54:11 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_TIMESTAMP('2009-01-27 22:54:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53273
;
-- Jan 27, 2009 10:54:14 PM ECT
-- Manufacturing Standard Cost
UPDATE AD_Process_Para SET SeqNo=50,Updated=TO_TIMESTAMP('2009-01-27 22:54:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=53267
;