diff --git a/org.adempiere.base.process/src/org/compiere/process/CostUpdate.java b/org.adempiere.base.process/src/org/compiere/process/CostUpdate.java
index 1185d937e2..aecef8575c 100644
--- a/org.adempiere.base.process/src/org/compiere/process/CostUpdate.java
+++ b/org.adempiere.base.process/src/org/compiere/process/CostUpdate.java
@@ -60,7 +60,6 @@ public class CostUpdate extends SvrProcess
private static final String TO_FutureStandardCost = "f";
private static final String TO_LastInvoicePrice = "i";
private static final String TO_LastPOPrice = "p";
- private static final String TO_OldStandardCost = "x";
/** Standard Cost Element */
private MCostElement m_ce = null;
@@ -464,10 +463,6 @@ public class CostUpdate extends SvrProcess
retValue = xCost.getCurrentCostPrice();
}
- // Old Std Costs
- else if (to.equals(TO_OldStandardCost))
- retValue = getOldCurrentCostPrice(cost);
-
// Price List
else if (to.equals(TO_PriceListLimit))
retValue = getPrice(cost);
@@ -496,51 +491,6 @@ public class CostUpdate extends SvrProcess
return ce;
} // getCostElement
- /**
- * Get Old Current Cost Price
- * @param cost costs
- * @return price if found
- */
- private BigDecimal getOldCurrentCostPrice(MCost cost)
- {
- BigDecimal retValue = null;
- String sql = "SELECT CostStandard, CurrentCostPrice "
- + "FROM M_Product_Costing "
- + "WHERE M_Product_ID=? AND C_AcctSchema_ID=?";
- PreparedStatement pstmt = null;
- try
- {
- pstmt = DB.prepareStatement (sql, null);
- pstmt.setInt (1, cost.getM_Product_ID());
- pstmt.setInt (2, cost.getC_AcctSchema_ID());
- ResultSet rs = pstmt.executeQuery ();
- if (rs.next ())
- {
- retValue = rs.getBigDecimal(1);
- if (retValue == null || retValue.signum() == 0)
- retValue = rs.getBigDecimal(2);
- }
- rs.close ();
- pstmt.close ();
- pstmt = null;
- }
- catch (Exception e)
- {
- log.log (Level.SEVERE, sql, e);
- }
- try
- {
- if (pstmt != null)
- pstmt.close ();
- pstmt = null;
- }
- catch (Exception e)
- {
- pstmt = null;
- }
- return retValue;
- } // getOldCurrentCostPrice
-
/**
* Get Price from Price List
* @param cost cost record
diff --git a/org.adempiere.base.process/src/org/compiere/process/M_Product_CostingUpdate.java b/org.adempiere.base.process/src/org/compiere/process/M_Product_CostingUpdate.java
deleted file mode 100644
index a70461274f..0000000000
--- a/org.adempiere.base.process/src/org/compiere/process/M_Product_CostingUpdate.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/******************************************************************************
- * Product: Adempiere ERP & CRM Smart Business Solution *
- * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms version 2 of the GNU General Public License as published *
- * by the Free Software Foundation. This program is distributed in the hope *
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
- * See the GNU General Public License for more details. *
- * You should have received a copy of the GNU General Public License along *
- * with this program; if not, write to the Free Software Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
- * For the text or an alternative of this public license, you may reach us *
- * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
- * or via info@compiere.org or http://www.compiere.org/license.html *
- * Portions created by Carlos Ruiz are Copyright (C) 2005 QSS Ltda.
- * Contributor(s): Carlos Ruiz (globalqss)
- *****************************************************************************/
-package org.compiere.process;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.logging.Level;
-
-import org.compiere.util.AdempiereUserError;
-import org.compiere.util.CLogger;
-import org.compiere.util.DB;
-import org.compiere.util.ValueNamePair;
-
-/**
- * Title: Create the (new) costing information
- * Description:
- * - (optionally) update FutureCostPrice according to Parameter
- * - (optionally) set CostStandard to FutureCostPrice
- * - set CurrentCostPrice to cost depending on primary AcctSchema
- *
- * @author Carlos Ruiz (globalqss)
- * @version $Id: M_Product_CostingUpdate.java,v 1.0 2005/09/26 22:28:00 globalqss Exp $
- */
-public class M_Product_CostingUpdate extends SvrProcess
-{
-
- /** The Record */
- private int p_Record_ID = 0;
- private int p_AD_Client_ID = -1;
- private int p_M_Product_Category_ID = -1;
- private String p_SetFutureCostTo;
- private int p_M_PriceList_Version_ID = -1;
- private String p_SetStandardCost;
- private String v_CostingMethod;
-
- /**
- * Prepare - e.g., get Parameters.
- */
- protected void prepare()
- {
- ProcessInfoParameter[] para = getParameter();
- for (int i = 0; i < para.length; i++)
- {
- String name = para[i].getParameterName();
- if (para[i].getParameter() == null)
- ;
- else if (name.equals("AD_Client_ID"))
- p_AD_Client_ID = para[i].getParameterAsInt();
- else if (name.equals("M_Product_Category_ID"))
- p_M_Product_Category_ID = para[i].getParameterAsInt();
- else if (name.equals("SetFutureCostTo"))
- p_SetFutureCostTo = (String) para[i].getParameter();
- else if (name.equals("M_PriceList_Version_ID"))
- p_M_PriceList_Version_ID = para[i].getParameterAsInt();
- else if (name.equals("SetStandardCost"))
- p_SetStandardCost = (String) para[i].getParameter();
- else
- log.log(Level.SEVERE, "Unknown Parameter: " + name);
- }
- p_Record_ID = getRecord_ID();
- } // prepare
-
- /**
- * Process
- * @return message
- * @throws Exception
- */
- protected String doIt() throws Exception
- {
- StringBuffer sql = null;
- int no = 0;
- int no1 = 0;
- int no2 = 0;
-
- log.info("Create the (new) costing information");
-
- // ========== (1) Set Future Cost To ==========
-
- if (p_SetFutureCostTo.equals("S")) {
- // S - Standard Cost
- log.info("Set to Standard Cost");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET FutureCostPrice = CostStandard " +
- "WHERE AD_Client_ID=" + p_AD_Client_ID + " AND " +
- "("+ p_M_Product_Category_ID + " = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID= " + p_M_Product_Category_ID + " " +
- "AND p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no == -1) raiseError("Set to Standard Cost:ERROR", sql.toString());
-
- } else if (p_SetFutureCostTo.equals("DP")) {
- // DP - Difference PO
- log.info("Set to Difference PO");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET FutureCostPrice = CostStandard + (CostStandardPOAmt/CostStandardPOQty) " +
- "WHERE CostStandardPOQty <> 0 AND " +
- "CostStandardPOAmt <> 0 AND " +
- "AD_Client_ID="+p_AD_Client_ID+" AND " +
- "("+ p_M_Product_Category_ID + " = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
- "p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no == -1) raiseError("Set to Difference PO:ERROR", sql.toString());
-
- } else if (p_SetFutureCostTo.equals("DI")) {
- // DI - Difference Invoice
- log.info("Set to Difference Inv");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET FutureCostPrice = CostStandard + (CostStandardCumAmt/CostStandardCumQty) " +
- "WHERE CostStandardCumQty <> 0 AND " +
- "CostStandardCumAmt <> 0 AND " +
- "AD_Client_ID="+p_AD_Client_ID+" AND " +
- "("+ p_M_Product_Category_ID + " = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
- "p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no == -1) raiseError("Set to Difference Inv:ERROR", sql.toString());
-
- } else if (p_SetFutureCostTo.equals("P")) {
- // P - Last PO Price
- log.info("Set to PO Price");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET FutureCostPrice = PriceLastPO " +
- "WHERE PriceLastPO <> 0 AND " +
- "AD_Client_ID="+p_AD_Client_ID+" AND " +
- "("+ p_M_Product_Category_ID + " = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
- "p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no == -1) raiseError("Set to PO Price:ERROR", sql.toString());
-
- } else if (p_SetFutureCostTo.equals("I")) {
- // L - Last Inv Price
- log.info("Set to Inv Price");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET FutureCostPrice = PriceLastInv " +
- "WHERE PriceLastInv <> 0 AND " +
- "AD_Client_ID="+p_AD_Client_ID+" AND " +
- "("+ p_M_Product_Category_ID + " = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
- "p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no == -1) raiseError("Set to Inv Price:ERROR", sql.toString());
-
- } else if (p_SetFutureCostTo.equals("A")) {
- // A - Average Cost
- log.info("Set to Average Cost");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET FutureCostPrice = CostAverage " +
- "WHERE CostAverage <> 0 AND " +
- "AD_Client_ID="+p_AD_Client_ID+" AND " +
- "("+ p_M_Product_Category_ID + " = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
- "p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no == -1) raiseError("Set to Average Cost:ERROR", sql.toString());
-
- } else if (p_SetFutureCostTo.equals("LL") && p_M_PriceList_Version_ID > 0) {
- // A - Average Cost
- log.info("Set to PriceList " + p_M_PriceList_Version_ID);
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET FutureCostPrice = " +
- "(SELECT pp.PriceLimit " +
- "FROM M_ProductPrice pp " +
- "WHERE pp.M_PriceList_Version_ID="+p_M_PriceList_Version_ID+" AND " +
- "pp.M_Product_ID=M_Product_Costing.M_Product_ID)" +
-/** SET FutureCostPrice = C_Currency_Convert (
- -- Amount
- (SELECT pp.PriceLimit FROM M_ProductPrice pp
- WHERE pp.M_PriceList_Version_ID=11
- AND pp.M_Product_ID=M_Product_Costing.M_Product_ID),
- -- Cur From
- (SELECT C_Currency_ID FROM M_PriceList pl, M_PriceList_Version pv
- WHERE pv.M_PriceList_ID=pl.M_PriceList_ID
- AND pv.M_PriceList_Version_ID=11),
- -- Cur To
- (SELECT a.C_Currency_ID FROM C_AcctSchema a WHERE a.C_AcctSchema_ID=M_Product_Costing.C_AcctSchema_ID))
-**/
- "WHERE AD_Client_ID="+p_AD_Client_ID+ " " +
- // we have a price
- "AND EXISTS (SELECT * FROM M_ProductPrice pp " +
- "WHERE pp.M_PriceList_Version_ID="+p_M_PriceList_Version_ID+" " +
- "AND pp.M_Product_ID=M_Product_Costing.M_Product_ID) " +
- // and the same currency
- "AND EXISTS (SELECT * FROM C_AcctSchema a, M_PriceList pl, M_PriceList_Version pv " +
- "WHERE a.C_AcctSchema_ID=M_Product_CostingUpdate.C_AcctSchema_ID " +
- "AND pv.M_PriceList_Version_ID="+p_M_PriceList_Version_ID+" " +
- "AND pv.M_PriceList_ID=pl.M_PriceList_ID " +
- "AND pl.C_Currency_ID=a.C_Currency_ID) " +
- "AND ("+p_M_Product_Category_ID+" = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" " +
- "AND p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no == -1) raiseError("Set to Average Cost:ERROR", sql.toString());
-
- } else {
- log.info("SetFutureCostTo=" + p_SetFutureCostTo + " ?");
-
- }
- log.info(" - Updated: " + no);
-
- // ========== (2) SetStandardCost ==========
- if (p_SetStandardCost.equals("Y")) {
- // A - Average Cost
- log.info("Set Standard Cost");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET CostStandard = FutureCostPrice " +
- "WHERE AD_Client_ID="+ p_AD_Client_ID + " AND " +
- "(" + p_M_Product_Category_ID + " = -1 OR " +
- "EXISTS (SELECT * FROM M_Product p " +
- "WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+ " AND " +
- "p.M_Product_ID=M_Product_Costing.M_Product_ID))");
- no1 = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no1 == -1) raiseError("Set Standard Cost", sql.toString());
-
- }
-
- // ========== (3) Update CurrentCostPrice depending on Costing Method ==========
- try
- {
- PreparedStatement pstmt = DB.prepareStatement
- ("SELECT a.CostingMethod " +
- "FROM C_AcctSchema a, AD_ClientInfo ci " +
- "WHERE a.C_AcctSchema_ID=ci.C_AcctSchema1_ID AND " +
- "ci.AD_Client_ID="+p_AD_Client_ID, get_TrxName());
- ResultSet rs = pstmt.executeQuery();
- if (rs.next())
- v_CostingMethod = rs.getString(1);
- rs.close();
- pstmt.close();
- }
- catch (SQLException e)
- {
- throw new Exception ("select CostingMethod", e);
- }
- // (A)verage (S)tandard
- log.info("Update Current Cost " + v_CostingMethod);
- log.info("Set Standard Cost");
- sql = new StringBuffer(
- "UPDATE M_Product_Costing " +
- "SET CurrentCostPrice = " +
- "DECODE ('"+ v_CostingMethod + "', 'A', CostAverage, CostStandard) " +
- "WHERE AD_Client_ID="+p_AD_Client_ID);
- no2 = DB.executeUpdate(sql.toString(), get_TrxName());
- if (no2 == -1) raiseError("Set Standard Cost", sql.toString());
- log.info(" - Updated: " + no2);
-
- return "@Updated@: " + no + "/" + no1;
- } // doIt
-
- private void raiseError(String string, String sql) throws Exception {
- DB.rollback(false, get_TrxName());
- String msg = string;
- ValueNamePair pp = CLogger.retrieveError();
- if (pp != null)
- msg = pp.getName() + " - ";
- msg += sql;
- throw new AdempiereUserError (msg);
- }
-
-} // M_Product_CostingUpdate
diff --git a/org.adempiere.base.process/src/org/compiere/process/OrgOwnership.java b/org.adempiere.base.process/src/org/compiere/process/OrgOwnership.java
index ecd4f3fecf..1aee96ccaa 100644
--- a/org.adempiere.base.process/src/org/compiere/process/OrgOwnership.java
+++ b/org.adempiere.base.process/src/org/compiere/process/OrgOwnership.java
@@ -284,12 +284,6 @@ public class OrgOwnership extends SvrProcess
if (no != 0)
log.fine("generalOwnership - C_BP_Withholding=" + no);
- // Costing
- sql = "UPDATE M_Product_Costing " + set;
- no = DB.executeUpdate(sql, get_TrxName());
- if (no != 0)
- log.fine("generalOwnership - M_Product_Costing=" + no);
-
// Replenish
sql = "UPDATE M_Replenish " + set;
no = DB.executeUpdate(sql, get_TrxName());
diff --git a/org.adempiere.base.process/src/org/compiere/process/T_InventoryValue_Create.java b/org.adempiere.base.process/src/org/compiere/process/T_InventoryValue_Create.java
index 0e314d06df..0b7e2e0a4b 100644
--- a/org.adempiere.base.process/src/org/compiere/process/T_InventoryValue_Create.java
+++ b/org.adempiere.base.process/src/org/compiere/process/T_InventoryValue_Create.java
@@ -189,9 +189,11 @@ public class T_InventoryValue_Create extends SvrProcess
+ "AND plv.M_PriceList_ID=pl.M_PriceList_ID), "
+ "CostStandard = "
+ "(SELECT currencyConvert(pc.CurrentCostPrice,acs.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue, null, T_InventoryValue.AD_Client_ID, T_InventoryValue.AD_Org_ID) "
- + "FROM AD_ClientInfo ci, C_AcctSchema acs, M_Product_Costing pc "
+ + "FROM AD_ClientInfo ci, C_AcctSchema acs, M_Cost pc, M_CostElement ce "
+ "WHERE T_InventoryValue.AD_Client_ID=ci.AD_Client_ID AND ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID "
- + "AND acs.C_AcctSchema_ID=pc.C_AcctSchema_ID "
+ + "AND acs.C_AcctSchema_ID=pc.C_AcctSchema_ID "
+ + "AND pc.M_CostElement_ID=ce.M_CostElement_ID "
+ + "AND ce.CostingMethod='S'"
+ "AND T_InventoryValue.M_Product_ID=pc.M_Product_ID) "
+ "WHERE T_InventoryValue.M_Warehouse_ID = " + p_M_Warehouse_ID;
cntu = DB.executeUpdate(sqlupd, get_TrxName());
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java b/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java
index d873a50dd0..5e869537a7 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java
@@ -257,7 +257,6 @@ public class Doc_InOut extends Doc
}
}
} // for all lines
- updateProductInfo(as.getC_AcctSchema_ID()); // only for SO!
/** Commitment release ****/
if (as.isAccrual() && as.isCreateSOCommitment())
@@ -368,7 +367,6 @@ public class Doc_InOut extends Doc
}
}
} // for all lines
- updateProductInfo(as.getC_AcctSchema_ID()); // only for SO!
} // Sales Return
// *** Purchasing - Receipt
@@ -614,35 +612,4 @@ public class Doc_InOut extends Doc
&& m_Reversal_ID !=0 && line.getReversalLine_ID() != 0;
}
-
- /**
- * Update Sales Order Costing Product Info (old).
- * Purchase side handled in Invoice Matching.
- *
- * decrease average cumulatives
- * @param C_AcctSchema_ID accounting schema
- * @deprecated old costing
- */
- private void updateProductInfo (int C_AcctSchema_ID)
- {
- log.fine("M_InOut_ID=" + get_ID());
- // Old Model
- StringBuffer sql = new StringBuffer(
- //FYRACLE add pc. everywhere
- "UPDATE M_Product_Costing pc "
- + "SET (CostAverageCumQty, CostAverageCumAmt)="
- + "(SELECT pc.CostAverageCumQty - SUM(il.MovementQty),"
- + " pc.CostAverageCumAmt - SUM(il.MovementQty*pc.CurrentCostPrice) "
- + "FROM M_InOutLine il "
- + "WHERE pc.M_Product_ID=il.M_Product_ID"
- + " AND il.M_InOut_ID=").append(get_ID()).append(") ")
- .append("WHERE EXISTS (SELECT * "
- + "FROM M_InOutLine il "
- + "WHERE pc.M_Product_ID=il.M_Product_ID"
- + " AND il.M_InOut_ID=").append(get_ID()).append(")");
- int no = DB.executeUpdate(sql.toString(), getTrxName());
- log.fine("M_Product_Costing - Updated=" + no);
- //
- } // updateProductInfo
-
} // Doc_InOut
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java
index c0b1bd7fdb..6b08293f22 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java
@@ -580,7 +580,6 @@ public class Doc_Invoice extends Doc
getC_Currency_ID(), null, serviceAmt);
//
updateProductPO(as); // Only API
- updateProductInfo (as.getC_AcctSchema_ID()); // only API
}
// APC
else if (getDocumentType().equals(DOCTYPE_APCredit))
@@ -918,72 +917,4 @@ public class Doc_Invoice extends Doc
log.fine("Updated=" + no);
} // updateProductPO
- /**
- * Update Product Info (old).
- * - Costing (PriceLastInv)
- * - PO (PriceLastInv)
- * @param C_AcctSchema_ID accounting schema
- * @deprecated old costing
- */
- private void updateProductInfo (int C_AcctSchema_ID)
- {
- log.fine("C_Invoice_ID=" + get_ID());
-
- /** @todo Last.. would need to compare document/last updated date
- * would need to maintain LastPriceUpdateDate on _PO and _Costing */
-
- // update Product Costing
- // requires existence of currency conversion !!
- // if there are multiple lines of the same product last price uses first
- // -> TotalInvAmt is sometimes NULL !! -> error
- // begin globalqss 2005-10-19
- // postgresql doesn't support LIMIT on UPDATE or DELETE statements
- /*
- StringBuffer sql = new StringBuffer (
- "UPDATE M_Product_Costing pc "
- + "SET (PriceLastInv, TotalInvAmt,TotalInvQty) = "
- // select
- + "(SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),"
- + " currencyConvert(il.LineNetAmt,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),il.QtyInvoiced "
- + "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
- + "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
- + " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
- + " AND ROWNUM=1"
- + " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
- .append(get_ID()).append(") ")
- // update
- .append("WHERE EXISTS (SELECT * "
- + "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
- + "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
- + " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
- + " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
- .append(get_ID()).append(")");
- */
- // the next command is equivalent and works in postgresql and oracle
- StringBuffer sql = new StringBuffer (
- "UPDATE M_Product_Costing pc "
- + "SET (PriceLastInv, TotalInvAmt,TotalInvQty) = "
- // select
- + "(SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),"
- + " currencyConvert(il.LineNetAmt,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),il.QtyInvoiced "
- + "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
- + "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
- + " AND il.c_invoiceline_id = (SELECT MIN(C_InvoiceLine_ID) FROM C_InvoiceLine il2" +
- " WHERE il2.M_PRODUCT_ID=il.M_PRODUCT_ID AND C_Invoice_ID=")
- .append(get_ID()).append(")"
- + " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
- + " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
- .append(get_ID()).append(") ")
- // update
- .append("WHERE EXISTS (SELECT * "
- + "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
- + "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
- + " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
- + " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
- .append(get_ID()).append(")");
- // end globalqss 2005-10-19
- int no = DB.executeUpdate(sql.toString(), getTrxName());
- log.fine("M_Product_Costing - Updated=" + no);
- } // updateProductInfo
-
} // Doc_Invoice
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java
index 59c24aff92..7c96be0ff6 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java
@@ -31,7 +31,6 @@ import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MMatchInv;
import org.compiere.model.ProductCost;
-import org.compiere.util.DB;
import org.compiere.util.Env;
/**
@@ -312,10 +311,6 @@ public class Doc_MatchInv extends Doc
p_Error = error;
return null;
}
-
- // Update Costing
- updateProductInfo(as.getC_AcctSchema_ID(),
- MAcctSchema.COSTINGMETHOD_StandardCosting.equals(as.getCostingMethod()));
//
facts.add(fact);
@@ -417,64 +412,4 @@ public class Doc_MatchInv extends Doc
return "";
}
- /**
- * Update Product Info (old).
- * - Costing (CostStandardCumQty, CostStandardCumAmt, CostAverageCumQty, CostAverageCumAmt)
- * @param C_AcctSchema_ID accounting schema
- * @param standardCosting true if std costing
- * @return true if updated
- * @deprecated old costing
- */
- private boolean updateProductInfo (int C_AcctSchema_ID, boolean standardCosting)
- {
- log.fine("M_MatchInv_ID=" + get_ID());
-
- // update Product Costing Qty/Amt
- // requires existence of currency conversion !!
- StringBuffer sql = new StringBuffer (
- "UPDATE M_Product_Costing pc "
- + "SET (CostStandardCumQty,CostStandardCumAmt, CostAverageCumQty,CostAverageCumAmt) = "
- + "(SELECT pc.CostStandardCumQty + m.Qty,"
- + "pc.CostStandardCumAmt + currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)*m.Qty, "
- + "pc.CostAverageCumQty + m.Qty,"
- + "pc.CostAverageCumAmt + currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)*m.Qty "
- + "FROM M_MatchInv m"
- + " INNER JOIN C_InvoiceLine il ON (m.C_InvoiceLine_ID=il.C_InvoiceLine_ID)"
- + " INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID),"
- + " C_AcctSchema a "
- + "WHERE pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
- + " AND pc.M_Product_ID=m.M_Product_ID"
- + " AND m.M_MatchInv_ID=").append(get_ID()).append(")"
- //
- + "WHERE pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(
- " AND EXISTS (SELECT * FROM M_MatchInv m "
- + "WHERE pc.M_Product_ID=m.M_Product_ID"
- + " AND m.M_MatchInv_ID=").append(get_ID()).append(")");
- int no = DB.executeUpdate(sql.toString(), getTrxName());
- log.fine("M_Product_Costing - Qty/Amt Updated #=" + no);
-
- // Update Average Cost
- sql = new StringBuffer (
- "UPDATE M_Product_Costing "
- + "SET CostAverage = CostAverageCumAmt/DECODE(CostAverageCumQty, 0,1, CostAverageCumQty) "
- + "WHERE C_AcctSchema_ID=").append(C_AcctSchema_ID)
- .append(" AND M_Product_ID=").append(getM_Product_ID());
- no = DB.executeUpdate(sql.toString(), getTrxName());
- log.fine("M_Product_Costing - AvgCost Updated #=" + no);
-
-
- // Update Current Cost
- if (!standardCosting)
- {
- sql = new StringBuffer (
- "UPDATE M_Product_Costing "
- + "SET CurrentCostPrice = CostAverage "
- + "WHERE C_AcctSchema_ID=").append(C_AcctSchema_ID)
- .append(" AND M_Product_ID=").append(getM_Product_ID());
- no = DB.executeUpdate(sql.toString(), getTrxName());
- log.fine("M_Product_Costing - CurrentCost Updated=" + no);
- }
- return true;
- } // updateProductInfo
-
} // Doc_MatchInv
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java
index c91f9635e2..bdf68c0f24 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java
@@ -37,7 +37,6 @@ import org.compiere.model.MProduct;
import org.compiere.model.MTax;
import org.compiere.model.ProductCost;
import org.compiere.model.X_M_InOut;
-import org.compiere.util.DB;
import org.compiere.util.Env;
/**
@@ -289,34 +288,6 @@ public class Doc_MatchPO extends Doc
return false;
}
- /**
- * Update Product Info (old).
- * - Costing (CostStandardPOQty, CostStandardPOAmt)
- * @param C_AcctSchema_ID accounting schema
- * @deprecated old costing
- */
- private void updateProductInfo (int C_AcctSchema_ID)
- {
- log.fine("M_MatchPO_ID=" + get_ID());
-
- // update Product Costing
- // requires existence of currency conversion !!
- StringBuffer sql = new StringBuffer (
- "UPDATE M_Product_Costing pc "
- + "SET (CostStandardPOQty,CostStandardPOAmt) = "
- + "(SELECT CostStandardPOQty + m.Qty,"
- + " CostStandardPOAmt + currencyConvert(ol.PriceActual,ol.C_Currency_ID,a.C_Currency_ID,ol.DateOrdered,null,ol.AD_Client_ID,ol.AD_Org_ID)*m.Qty "
- + "FROM M_MatchPO m, C_OrderLine ol, C_AcctSchema a "
- + "WHERE m.C_OrderLine_ID=ol.C_OrderLine_ID"
- + " AND pc.M_Product_ID=ol.M_Product_ID"
- + " AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
- + " AND m.M_MatchPO_ID=").append(get_ID()).append(") ")
- .append("WHERE pc.C_AcctSchema_ID=").append(C_AcctSchema_ID)
- .append(" AND pc.M_Product_ID=").append(getM_Product_ID());
- int no = DB.executeUpdate(sql.toString(), getTrxName());
- log.fine("M_Product_Costing - Updated=" + no);
- } // updateProductInfo
-
// Elaine 2008/6/20
private String createMatchPOCostDetail(MAcctSchema as)
{
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Order.java b/org.adempiere.base/src/org/compiere/acct/Doc_Order.java
index 7a7d2cf363..a626f5252b 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_Order.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_Order.java
@@ -343,7 +343,6 @@ public class Doc_Order extends Doc
if (getDocumentType().equals(DOCTYPE_POrder))
{
updateProductPO(as);
- updateProductInfo(as.getC_AcctSchema_ID());
BigDecimal grossAmt = getAmount(Doc.AMTTYPE_Gross);
@@ -773,52 +772,5 @@ public class Doc_Order extends Doc
fact.createLine (null, offset,
C_Currency_ID, null, total);
return fact;
- } // getCommitmentSalesRelease
-
- /**************************************************************************
- * Update Product Info (old)
- * - Costing (PriceLastPO)
- * - PO (PriceLastPO)
- * @param C_AcctSchema_ID accounting schema
- * @deprecated old costing
- */
- private void updateProductInfo (int C_AcctSchema_ID)
- {
- log.fine("C_Order_ID=" + get_ID());
-
- /** @todo Last.. would need to compare document/last updated date
- * would need to maintain LastPriceUpdateDate on _PO and _Costing */
-
- // update Product Costing
- // requires existence of currency conversion !!
- // if there are multiple lines of the same product last price uses first
- StringBuffer sql = new StringBuffer (
- "UPDATE M_Product_Costing pc "
- + "SET PriceLastPO = "
- + "(SELECT currencyConvert(ol.PriceActual,ol.C_Currency_ID,a.C_Currency_ID,o.DateOrdered,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) "
- + "FROM C_Order o, C_OrderLine ol, C_AcctSchema a "
- + "WHERE o.C_Order_ID=ol.C_Order_ID"
- + " AND pc.M_Product_ID=ol.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID ");
- if (DB.isOracle()) //jz
- {
- sql.append(" AND ROWNUM=1 ");
- }
- else
- sql.append(" AND ol.C_OrderLine_ID = (SELECT MIN(ol1.C_OrderLine_ID) "
- + "FROM C_Order o1, C_OrderLine ol1 "
- + "WHERE o1.C_Order_ID=ol1.C_Order_ID"
- + " AND pc.M_Product_ID=ol1.M_Product_ID ")
- .append(" AND o1.C_Order_ID=").append(get_ID()).append(") ");
- sql.append(" AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND o.C_Order_ID=")
- .append(get_ID()).append(") ")
- .append("WHERE EXISTS (SELECT * "
- + "FROM C_Order o, C_OrderLine ol, C_AcctSchema a "
- + "WHERE o.C_Order_ID=ol.C_Order_ID"
- + " AND pc.M_Product_ID=ol.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
- + " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND o.C_Order_ID=")
- .append(get_ID()).append(")");
- int no = DB.executeUpdate(sql.toString(), getTrxName());
- log.fine("M_Product_Costing - Updated=" + no);
- } // updateProductInfo
-
+ } // getCommitmentSalesRelease
} // Doc_Order
\ No newline at end of file
diff --git a/org.adempiere.base/src/org/compiere/acct/ProductInfo.java b/org.adempiere.base/src/org/compiere/acct/ProductInfo.java
index 75ec1da2b2..f2e74d147e 100644
--- a/org.adempiere.base/src/org/compiere/acct/ProductInfo.java
+++ b/org.adempiere.base/src/org/compiere/acct/ProductInfo.java
@@ -228,70 +228,6 @@ public class ProductInfo
return m_qty;
} // getQty
-
-
- /**
- * Update/Create initial Cost Record.
- * Check first for Purchase Price List,
- * then Product Purchase Costs
- * and then Price List
- * @param as accounting schema
- * @param create create record
- * @return costs
- */
- private BigDecimal updateCosts (MAcctSchema as, boolean create)
- {
- // Create Zero Record
- if (create)
- {
- StringBuffer sql = new StringBuffer ("INSERT INTO M_Product_Costing "
- + "(M_Product_ID,C_AcctSchema_ID,"
- + " AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,"
- + " CurrentCostPrice,CostStandard,FutureCostPrice,"
- + " CostStandardPOQty,CostStandardPOAmt,CostStandardCumQty,CostStandardCumAmt,"
- + " CostAverage,CostAverageCumQty,CostAverageCumAmt,"
- + " PriceLastPO,PriceLastInv, TotalInvQty,TotalInvAmt) "
- + "VALUES (");
- sql.append(m_M_Product_ID).append(",").append(as.getC_AcctSchema_ID()).append(",")
- .append(m_AD_Client_ID).append(",").append(m_AD_Org_ID).append(",")
- .append("'Y',SysDate,0,SysDate,0, 0,0,0, 0,0,0,0, 0,0,0, 0,0, 0,0)");
- int no = DB.executeUpdate(sql.toString(), m_trxName);
- if (no == 1)
- log.fine("CostingCreated");
- }
-
- // Try to find non ZERO Price
- String costSource = "PriceList-PO";
- BigDecimal costs = getPriceList (as, true);
- if (costs == null || costs.compareTo(Env.ZERO)==0)
- {
- costSource = "PO Cost";
- costs = getPOCost(as);
- }
- if (costs == null || costs.compareTo(Env.ZERO)==0)
- {
- costSource = "PriceList";
- costs = getPriceList (as, false);
- }
-
- // if not found use $1 (to be able to do material transactions)
- if (costs == null || costs.compareTo(Env.ZERO)==0)
- {
- costSource = "Not Found";
- costs = new BigDecimal("1");
- }
-
- // update current costs
- StringBuffer sql = new StringBuffer ("UPDATE M_Product_Costing ");
- sql.append("SET CurrentCostPrice=").append(costs)
- .append(" WHERE M_Product_ID=").append(m_M_Product_ID)
- .append(" AND C_AcctSchema_ID=").append(as.getC_AcctSchema_ID());
- int no = DB.executeUpdate(sql.toString(), m_trxName);
- if (no == 1)
- log.fine(costSource + " - " + costs);
- return costs;
- } // createCosts
-
/**
* Get PO Price from PriceList - and convert it to AcctSchema Currency
* @param as accounting schema
diff --git a/org.adempiere.base/src/org/compiere/model/I_M_Product_Costing.java b/org.adempiere.base/src/org/compiere/model/I_M_Product_Costing.java
deleted file mode 100644
index 890a62d6db..0000000000
--- a/org.adempiere.base/src/org/compiere/model/I_M_Product_Costing.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/******************************************************************************
- * Product: Adempiere ERP & CRM Smart Business Solution *
- * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
- * This program is free software, you can redistribute it and/or modify it *
- * under the terms version 2 of the GNU General Public License as published *
- * by the Free Software Foundation. This program is distributed in the hope *
- * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
- * See the GNU General Public License for more details. *
- * You should have received a copy of the GNU General Public License along *
- * with this program, if not, write to the Free Software Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
- * For the text or an alternative of this public license, you may reach us *
- * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
- * or via info@compiere.org or http://www.compiere.org/license.html *
- *****************************************************************************/
-package org.compiere.model;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import org.compiere.util.KeyNamePair;
-
-/** Generated Interface for M_Product_Costing
- * @author Adempiere (generated)
- * @version Release 3.6.0LTS
- */
-public interface I_M_Product_Costing
-{
-
- /** TableName=M_Product_Costing */
- public static final String Table_Name = "M_Product_Costing";
-
- /** AD_Table_ID=327 */
- public static final int Table_ID = MTable.getTable_ID(Table_Name);
-
- KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
-
- /** AccessLevel = 3 - Client - Org
- */
- BigDecimal accessLevel = BigDecimal.valueOf(3);
-
- /** Load Meta Data */
-
- /** Column name AD_Client_ID */
- public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
-
- /** Get Client.
- * Client/Tenant for this installation.
- */
- public int getAD_Client_ID();
-
- /** Column name AD_Org_ID */
- public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
-
- /** Set Organization.
- * Organizational entity within client
- */
- public void setAD_Org_ID (int AD_Org_ID);
-
- /** Get Organization.
- * Organizational entity within client
- */
- public int getAD_Org_ID();
-
- /** Column name C_AcctSchema_ID */
- public static final String COLUMNNAME_C_AcctSchema_ID = "C_AcctSchema_ID";
-
- /** Set Accounting Schema.
- * Rules for accounting
- */
- public void setC_AcctSchema_ID (int C_AcctSchema_ID);
-
- /** Get Accounting Schema.
- * Rules for accounting
- */
- public int getC_AcctSchema_ID();
-
- public I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
-
- /** Column name CostAverage */
- public static final String COLUMNNAME_CostAverage = "CostAverage";
-
- /** Set Average Cost.
- * Weighted average costs
- */
- public void setCostAverage (BigDecimal CostAverage);
-
- /** Get Average Cost.
- * Weighted average costs
- */
- public BigDecimal getCostAverage();
-
- /** Column name CostAverageCumAmt */
- public static final String COLUMNNAME_CostAverageCumAmt = "CostAverageCumAmt";
-
- /** Set Average Cost Amount Sum.
- * Cumulative average cost amounts (internal)
- */
- public void setCostAverageCumAmt (BigDecimal CostAverageCumAmt);
-
- /** Get Average Cost Amount Sum.
- * Cumulative average cost amounts (internal)
- */
- public BigDecimal getCostAverageCumAmt();
-
- /** Column name CostAverageCumQty */
- public static final String COLUMNNAME_CostAverageCumQty = "CostAverageCumQty";
-
- /** Set Average Cost Quantity Sum.
- * Cumulative average cost quantities (internal)
- */
- public void setCostAverageCumQty (BigDecimal CostAverageCumQty);
-
- /** Get Average Cost Quantity Sum.
- * Cumulative average cost quantities (internal)
- */
- public BigDecimal getCostAverageCumQty();
-
- /** Column name CostStandard */
- public static final String COLUMNNAME_CostStandard = "CostStandard";
-
- /** Set Standard Cost.
- * Standard Costs
- */
- public void setCostStandard (BigDecimal CostStandard);
-
- /** Get Standard Cost.
- * Standard Costs
- */
- public BigDecimal getCostStandard();
-
- /** Column name CostStandardCumAmt */
- public static final String COLUMNNAME_CostStandardCumAmt = "CostStandardCumAmt";
-
- /** Set Std Cost Amount Sum.
- * Standard Cost Invoice Amount Sum (internal)
- */
- public void setCostStandardCumAmt (BigDecimal CostStandardCumAmt);
-
- /** Get Std Cost Amount Sum.
- * Standard Cost Invoice Amount Sum (internal)
- */
- public BigDecimal getCostStandardCumAmt();
-
- /** Column name CostStandardCumQty */
- public static final String COLUMNNAME_CostStandardCumQty = "CostStandardCumQty";
-
- /** Set Std Cost Quantity Sum.
- * Standard Cost Invoice Quantity Sum (internal)
- */
- public void setCostStandardCumQty (BigDecimal CostStandardCumQty);
-
- /** Get Std Cost Quantity Sum.
- * Standard Cost Invoice Quantity Sum (internal)
- */
- public BigDecimal getCostStandardCumQty();
-
- /** Column name CostStandardPOAmt */
- public static final String COLUMNNAME_CostStandardPOAmt = "CostStandardPOAmt";
-
- /** Set Std PO Cost Amount Sum.
- * Standard Cost Purchase Order Amount Sum (internal)
- */
- public void setCostStandardPOAmt (BigDecimal CostStandardPOAmt);
-
- /** Get Std PO Cost Amount Sum.
- * Standard Cost Purchase Order Amount Sum (internal)
- */
- public BigDecimal getCostStandardPOAmt();
-
- /** Column name CostStandardPOQty */
- public static final String COLUMNNAME_CostStandardPOQty = "CostStandardPOQty";
-
- /** Set Std PO Cost Quantity Sum.
- * Standard Cost Purchase Order Quantity Sum (internal)
- */
- public void setCostStandardPOQty (BigDecimal CostStandardPOQty);
-
- /** Get Std PO Cost Quantity Sum.
- * Standard Cost Purchase Order Quantity Sum (internal)
- */
- public BigDecimal getCostStandardPOQty();
-
- /** Column name Created */
- public static final String COLUMNNAME_Created = "Created";
-
- /** Get Created.
- * Date this record was created
- */
- public Timestamp getCreated();
-
- /** Column name CreatedBy */
- public static final String COLUMNNAME_CreatedBy = "CreatedBy";
-
- /** Get Created By.
- * User who created this records
- */
- public int getCreatedBy();
-
- /** Column name CurrentCostPrice */
- public static final String COLUMNNAME_CurrentCostPrice = "CurrentCostPrice";
-
- /** Set Current Cost Price.
- * The currently used cost price
- */
- public void setCurrentCostPrice (BigDecimal CurrentCostPrice);
-
- /** Get Current Cost Price.
- * The currently used cost price
- */
- public BigDecimal getCurrentCostPrice();
-
- /** Column name FutureCostPrice */
- public static final String COLUMNNAME_FutureCostPrice = "FutureCostPrice";
-
- /** Set Future Cost Price */
- public void setFutureCostPrice (BigDecimal FutureCostPrice);
-
- /** Get Future Cost Price */
- public BigDecimal getFutureCostPrice();
-
- /** Column name IsActive */
- public static final String COLUMNNAME_IsActive = "IsActive";
-
- /** Set Active.
- * The record is active in the system
- */
- public void setIsActive (boolean IsActive);
-
- /** Get Active.
- * The record is active in the system
- */
- public boolean isActive();
-
- /** Column name M_Product_ID */
- public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
-
- /** Set Product.
- * Product, Service, Item
- */
- public void setM_Product_ID (int M_Product_ID);
-
- /** Get Product.
- * Product, Service, Item
- */
- public int getM_Product_ID();
-
- public I_M_Product getM_Product() throws RuntimeException;
-
- /** Column name PriceLastInv */
- public static final String COLUMNNAME_PriceLastInv = "PriceLastInv";
-
- /** Set Last Invoice Price.
- * Price of the last invoice for the product
- */
- public void setPriceLastInv (BigDecimal PriceLastInv);
-
- /** Get Last Invoice Price.
- * Price of the last invoice for the product
- */
- public BigDecimal getPriceLastInv();
-
- /** Column name PriceLastPO */
- public static final String COLUMNNAME_PriceLastPO = "PriceLastPO";
-
- /** Set Last PO Price.
- * Price of the last purchase order for the product
- */
- public void setPriceLastPO (BigDecimal PriceLastPO);
-
- /** Get Last PO Price.
- * Price of the last purchase order for the product
- */
- public BigDecimal getPriceLastPO();
-
- /** Column name TotalInvAmt */
- public static final String COLUMNNAME_TotalInvAmt = "TotalInvAmt";
-
- /** Set Total Invoice Amount.
- * Cumulative total lifetime invoice amount
- */
- public void setTotalInvAmt (BigDecimal TotalInvAmt);
-
- /** Get Total Invoice Amount.
- * Cumulative total lifetime invoice amount
- */
- public BigDecimal getTotalInvAmt();
-
- /** Column name TotalInvQty */
- public static final String COLUMNNAME_TotalInvQty = "TotalInvQty";
-
- /** Set Total Invoice Quantity.
- * Cumulative total lifetime invoice quantity
- */
- public void setTotalInvQty (BigDecimal TotalInvQty);
-
- /** Get Total Invoice Quantity.
- * Cumulative total lifetime invoice quantity
- */
- public BigDecimal getTotalInvQty();
-
- /** Column name Updated */
- public static final String COLUMNNAME_Updated = "Updated";
-
- /** Get Updated.
- * Date this record was updated
- */
- public Timestamp getUpdated();
-
- /** Column name UpdatedBy */
- public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
-
- /** Get Updated By.
- * User who updated this records
- */
- public int getUpdatedBy();
-}
diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java
index d4a8f9d238..a68f3443b4 100644
--- a/org.adempiere.base/src/org/compiere/model/MCost.java
+++ b/org.adempiere.base/src/org/compiere/model/MCost.java
@@ -290,14 +290,6 @@ public class MCost extends X_M_Cost
if (retValue == null || retValue.signum() == 0)
retValue = getLastPOPrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
}
- else if (MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod))
- {
- // migrate old costs
- MProductCosting pc = MProductCosting.get(product.getCtx(), product.getM_Product_ID(),
- as.getC_AcctSchema_ID(), product.get_TrxName());
- if (pc != null)
- retValue = pc.getCurrentCostPrice();
- }
else if (MCostElement.COSTINGMETHOD_UserDefined.equals(costingMethod))
;
else
diff --git a/org.adempiere.base/src/org/compiere/model/MProduct.java b/org.adempiere.base/src/org/compiere/model/MProduct.java
index 9c2a65ea30..389b7b9058 100644
--- a/org.adempiere.base/src/org/compiere/model/MProduct.java
+++ b/org.adempiere.base/src/org/compiere/model/MProduct.java
@@ -689,14 +689,6 @@ public class MProduct extends X_M_Product
insert_Accounting("M_Product_Acct", "M_Product_Category_Acct",
"p.M_Product_Category_ID=" + getM_Product_Category_ID());
insert_Tree(X_AD_Tree.TREETYPE_Product);
- //
- MAcctSchema[] mass = MAcctSchema.getClientAcctSchema(getCtx(), getAD_Client_ID(), get_TrxName());
- for (int i = 0; i < mass.length; i++)
- {
- // Old
- MProductCosting pcOld = new MProductCosting(this, mass[i].getC_AcctSchema_ID());
- pcOld.saveEx();
- }
}
// New Costing
@@ -740,11 +732,7 @@ public class MProduct extends X_M_Product
}
}
- // delete costing
- MProductCosting[] costings = MProductCosting.getOfProduct(getCtx(), get_ID(), get_TrxName());
- for (int i = 0; i < costings.length; i++)
- costings[i].delete(true, get_TrxName());
-
+ // delete costing
MCost.delete(this);
// [ 1674225 ] Delete Product: Costing deletion error
diff --git a/org.adempiere.base/src/org/compiere/model/MProductCosting.java b/org.adempiere.base/src/org/compiere/model/MProductCosting.java
deleted file mode 100644
index 1940ea87aa..0000000000
--- a/org.adempiere.base/src/org/compiere/model/MProductCosting.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/******************************************************************************
- * Product: Adempiere ERP & CRM Smart Business Solution *
- * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms version 2 of the GNU General Public License as published *
- * by the Free Software Foundation. This program is distributed in the hope *
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
- * See the GNU General Public License for more details. *
- * You should have received a copy of the GNU General Public License along *
- * with this program; if not, write to the Free Software Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
- * For the text or an alternative of this public license, you may reach us *
- * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
- * or via info@compiere.org or http://www.compiere.org/license.html *
- *****************************************************************************/
-package org.compiere.model;
-
-import java.sql.ResultSet;
-import java.util.List;
-import java.util.Properties;
-
-import org.compiere.util.Env;
-
-/**
- * Product Costing Model (old).
- * deprecated old costing
- *
- * @author Jorg Janke
- * @version $Id: MProductCosting.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
- */
-public class MProductCosting extends X_M_Product_Costing
-{
- /**
- *
- */
- private static final long serialVersionUID = 5563448335633481151L;
-
- /**
- * Get Costing Of Product
- * @param ctx context
- * @param M_Product_ID product
- * @param trxName trx
- * @return array of costs
- */
- public static MProductCosting[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
- {
- final String whereClause = "M_Product_ID=?";
-
- List costs =new Query(ctx, I_M_Product_Costing.Table_Name,whereClause, trxName )
- .setParameters(M_Product_ID)
- .list();
- return costs.toArray(new MProductCosting[costs.size()]);
- } // getOfProduct
-
- /**
- * Get Costing
- * @param ctx context
- * @param M_Product_ID product
- * @param C_AcctSchema_ID as
- * @param trxName trx
- * @return first product cosnting
- */
- public static MProductCosting get (Properties ctx, int M_Product_ID,
- int C_AcctSchema_ID, String trxName)
- {
- final String whereClause = "M_Product_ID=? AND C_AcctSchema_ID=?";
-
- return new Query(ctx, I_M_Product_Costing.Table_Name,whereClause, trxName )
- .setParameters(M_Product_ID, C_AcctSchema_ID)
- .firstOnly();
- } // get
-
- /**************************************************************************
- * Standard Constructor (odl)
- * @param ctx context
- * @param ignored (multi key)
- * @param trxName transaction
- */
- public MProductCosting (Properties ctx, int ignored, String trxName)
- {
- super (ctx, ignored, trxName);
- if (ignored != 0)
- throw new IllegalArgumentException("Multi-Key");
- else
- {
- // setM_Product_ID (0);
- // setC_AcctSchema_ID (0);
- //
- setCostAverage (Env.ZERO);
- setCostAverageCumAmt (Env.ZERO);
- setCostAverageCumQty (Env.ZERO);
- setCostStandard (Env.ZERO);
- setCostStandardCumAmt (Env.ZERO);
- setCostStandardCumQty (Env.ZERO);
- setCostStandardPOAmt (Env.ZERO);
- setCostStandardPOQty (Env.ZERO);
- setCurrentCostPrice (Env.ZERO);
- setFutureCostPrice (Env.ZERO);
- setPriceLastInv (Env.ZERO);
- setPriceLastPO (Env.ZERO);
- setTotalInvAmt (Env.ZERO);
- setTotalInvQty (Env.ZERO);
- }
- } // MProductCosting
-
- /**
- * Parent Constructor (old)
- * @param product parent
- * @param C_AcctSchema_ID accounting schema
- */
- public MProductCosting (MProduct product, int C_AcctSchema_ID)
- {
- super (product.getCtx(), 0, product.get_TrxName());
- setClientOrg(product);
- setM_Product_ID (product.getM_Product_ID());
- setC_AcctSchema_ID (C_AcctSchema_ID);
- } // MProductCosting
-
-
- /**
- * Load Constructor (old)
- * @param ctx context
- * @param rs result set
- * @param trxName transaction
- */
- public MProductCosting (Properties ctx, ResultSet rs, String trxName)
- {
- super(ctx, rs, trxName);
- } // MProductCosting
-
-} // MProductCosting
-
diff --git a/org.adempiere.base/src/org/compiere/model/ProductCost.java b/org.adempiere.base/src/org/compiere/model/ProductCost.java
index 232595fee5..1c6d6aaa30 100644
--- a/org.adempiere.base/src/org/compiere/model/ProductCost.java
+++ b/org.adempiere.base/src/org/compiere/model/ProductCost.java
@@ -283,17 +283,6 @@ public class ProductCost
log.fine("No Qty");
return null;
}
- /** Old Costing
- MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
- if (!client.isUseBetaFunctions())
- {
- BigDecimal itemCost = getProductItemCostOld(as, costingMethod);
- BigDecimal cost = m_qty.multiply(itemCost);
- cost = cost.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
- log.fine("Qty(" + m_qty + ") * Cost(" + itemCost + ") = " + cost);
- return cost;
- }
- **/
// No Product
if (m_product == null)
@@ -312,138 +301,6 @@ public class ProductCost
return cost;
} // getProductCosts
-
- /**
- * Get Product Costs per UOM for Accounting Schema in Accounting Schema Currency.
- * - if costType defined - cost
- * - else CurrentCosts
- * @param as accounting schema
- * @param costType - if null uses Accounting Schema Costs - see AcctSchema.COSTING_*
- * @return product costs
- */
- private BigDecimal getProductItemCostOld (MAcctSchema as, String costType)
- {
- BigDecimal current = null;
- BigDecimal cost = null;
- String cm = as.getCostingMethod();
- StringBuffer sql = new StringBuffer("SELECT CurrentCostPrice,"); // 1
- //
- if ((costType == null && MAcctSchema.COSTINGMETHOD_AveragePO.equals(cm))
- || MAcctSchema.COSTINGMETHOD_AveragePO.equals(costType))
- sql.append("COSTAVERAGE"); // 2
- // else if (AcctSchema.COSTING_FIFO.equals(cm))
- // sql.append("COSTFIFO");
- // else if (AcctSchema.COSTING_LIFO.equals(cm))
- // sql.append("COSTLIFO");
- else if ((costType == null && MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(cm))
- || MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costType))
- sql.append("PRICELASTPO");
- else // AcctSchema.COSTING_STANDARD
- sql.append("COSTSTANDARD");
- sql.append(" FROM M_Product_Costing WHERE M_Product_ID=? AND C_AcctSchema_ID=?");
-
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- try
- {
- pstmt = DB.prepareStatement(sql.toString(), null);
- pstmt.setInt(1, m_M_Product_ID);
- pstmt.setInt(2, as.getC_AcctSchema_ID());
- rs = pstmt.executeQuery();
- if (rs.next())
- {
- current = rs.getBigDecimal(1);
- cost = rs.getBigDecimal(2);
- }
- }
- catch (SQLException e)
- {
- log.log(Level.SEVERE, sql.toString(), e);
- }
- finally {
- DB.close(rs, pstmt);
- rs = null; pstmt = null;
- }
-
- // Return Costs
- if (costType != null && cost != null && cost.compareTo(Env.ZERO)!=0)
- {
- log.fine("Costs=" + cost);
- return cost;
- }
- else if (current != null && current.compareTo(Env.ZERO)!=0)
- {
- log.fine("Current=" + current);
- return current;
- }
-
- // Create/Update Cost Record
- boolean create = (cost == null && current == null);
- return updateCostsOld (as, create);
- } // getProductCostOld
-
- /**
- * Update/Create initial Cost Record.
- * Check first for Purchase Price List,
- * then Product Purchase Costs
- * and then Price List
- * @param as accounting schema
- * @param create create record
- * @return costs
- */
- private BigDecimal updateCostsOld (MAcctSchema as, boolean create)
- {
- // Create Zero Record
- if (create)
- {
- StringBuffer sql = new StringBuffer ("INSERT INTO M_Product_Costing "
- + "(M_Product_ID,C_AcctSchema_ID,"
- + " AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,"
- + " CurrentCostPrice,CostStandard,FutureCostPrice,"
- + " CostStandardPOQty,CostStandardPOAmt,CostStandardCumQty,CostStandardCumAmt,"
- + " CostAverage,CostAverageCumQty,CostAverageCumAmt,"
- + " PriceLastPO,PriceLastInv, TotalInvQty,TotalInvAmt) "
- + "VALUES (");
- sql.append(m_M_Product_ID).append(",").append(as.getC_AcctSchema_ID()).append(",")
- .append(as.getAD_Client_ID()).append(",").append(as.getAD_Org_ID()).append(",")
- .append("'Y',SysDate,0,SysDate,0, 0,0,0, 0,0,0,0, 0,0,0, 0,0, 0,0)");
- int no = DB.executeUpdate(sql.toString(), m_trxName);
- if (no == 1)
- log.fine("CostingCreated");
- }
-
- // Try to find non ZERO Price
- String costSource = "PriceList-PO";
- BigDecimal costs = getPriceList (as, true);
- if (costs == null || costs.compareTo(Env.ZERO)==0)
- {
- costSource = "PO Cost";
- costs = getPOCost(as);
- }
- if (costs == null || costs.compareTo(Env.ZERO)==0)
- {
- costSource = "PriceList";
- costs = getPriceList (as, false);
- }
-
- // if not found use $1 (to be able to do material transactions)
- if (costs == null || costs.compareTo(Env.ZERO)==0)
- {
- costSource = "Not Found";
- costs = new BigDecimal("1");
- }
-
- // update current costs
- StringBuffer sql = new StringBuffer ("UPDATE M_Product_Costing ");
- sql.append("SET CurrentCostPrice=").append(costs)
- .append(" WHERE M_Product_ID=").append(m_M_Product_ID)
- .append(" AND C_AcctSchema_ID=").append(as.getC_AcctSchema_ID());
- int no = DB.executeUpdate(sql.toString(), m_trxName);
- if (no == 1)
- log.fine(costSource + " - " + costs);
- return costs;
- } // createCosts
-
/**
* Get PO Price from PriceList - and convert it to AcctSchema Currency
* @param as accounting schema
diff --git a/org.adempiere.base/src/org/compiere/model/X_M_Product_Costing.java b/org.adempiere.base/src/org/compiere/model/X_M_Product_Costing.java
deleted file mode 100644
index cb881bfcdb..0000000000
--- a/org.adempiere.base/src/org/compiere/model/X_M_Product_Costing.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/******************************************************************************
- * Product: Adempiere ERP & CRM Smart Business Solution *
- * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
- * This program is free software, you can redistribute it and/or modify it *
- * under the terms version 2 of the GNU General Public License as published *
- * by the Free Software Foundation. This program is distributed in the hope *
- * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
- * See the GNU General Public License for more details. *
- * You should have received a copy of the GNU General Public License along *
- * with this program, if not, write to the Free Software Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
- * For the text or an alternative of this public license, you may reach us *
- * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
- * or via info@compiere.org or http://www.compiere.org/license.html *
- *****************************************************************************/
-/** Generated Model - DO NOT CHANGE */
-package org.compiere.model;
-
-import java.math.BigDecimal;
-import java.sql.ResultSet;
-import java.util.Properties;
-import org.compiere.util.Env;
-
-/** Generated Model for M_Product_Costing
- * @author Adempiere (generated)
- * @version Release 3.6.0LTS - $Id$ */
-public class X_M_Product_Costing extends PO implements I_M_Product_Costing, I_Persistent
-{
-
- /**
- *
- */
- private static final long serialVersionUID = 20100614L;
-
- /** Standard Constructor */
- public X_M_Product_Costing (Properties ctx, int M_Product_Costing_ID, String trxName)
- {
- super (ctx, M_Product_Costing_ID, trxName);
- /** if (M_Product_Costing_ID == 0)
- {
- setC_AcctSchema_ID (0);
- setCostAverage (Env.ZERO);
- setCostAverageCumAmt (Env.ZERO);
- setCostAverageCumQty (Env.ZERO);
- setCostStandard (Env.ZERO);
- setCostStandardCumAmt (Env.ZERO);
- setCostStandardCumQty (Env.ZERO);
- setCostStandardPOAmt (Env.ZERO);
- setCostStandardPOQty (Env.ZERO);
- setCurrentCostPrice (Env.ZERO);
- setFutureCostPrice (Env.ZERO);
- setM_Product_ID (0);
- setPriceLastInv (Env.ZERO);
- setPriceLastPO (Env.ZERO);
- setTotalInvAmt (Env.ZERO);
- setTotalInvQty (Env.ZERO);
- } */
- }
-
- /** Load Constructor */
- public X_M_Product_Costing (Properties ctx, ResultSet rs, String trxName)
- {
- super (ctx, rs, trxName);
- }
-
- /** AccessLevel
- * @return 3 - Client - Org
- */
- protected int get_AccessLevel()
- {
- return accessLevel.intValue();
- }
-
- /** Load Meta Data */
- protected POInfo initPO (Properties ctx)
- {
- POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
- return poi;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer ("X_M_Product_Costing[")
- .append(get_ID()).append("]");
- return sb.toString();
- }
-
- public I_C_AcctSchema getC_AcctSchema() throws RuntimeException
- {
- return (I_C_AcctSchema)MTable.get(getCtx(), I_C_AcctSchema.Table_Name)
- .getPO(getC_AcctSchema_ID(), get_TrxName()); }
-
- /** Set Accounting Schema.
- @param C_AcctSchema_ID
- Rules for accounting
- */
- public void setC_AcctSchema_ID (int C_AcctSchema_ID)
- {
- if (C_AcctSchema_ID < 1)
- set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, null);
- else
- set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID));
- }
-
- /** Get Accounting Schema.
- @return Rules for accounting
- */
- public int getC_AcctSchema_ID ()
- {
- Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
- if (ii == null)
- return 0;
- return ii.intValue();
- }
-
- /** Set Average Cost.
- @param CostAverage
- Weighted average costs
- */
- public void setCostAverage (BigDecimal CostAverage)
- {
- set_ValueNoCheck (COLUMNNAME_CostAverage, CostAverage);
- }
-
- /** Get Average Cost.
- @return Weighted average costs
- */
- public BigDecimal getCostAverage ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostAverage);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Average Cost Amount Sum.
- @param CostAverageCumAmt
- Cumulative average cost amounts (internal)
- */
- public void setCostAverageCumAmt (BigDecimal CostAverageCumAmt)
- {
- set_ValueNoCheck (COLUMNNAME_CostAverageCumAmt, CostAverageCumAmt);
- }
-
- /** Get Average Cost Amount Sum.
- @return Cumulative average cost amounts (internal)
- */
- public BigDecimal getCostAverageCumAmt ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostAverageCumAmt);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Average Cost Quantity Sum.
- @param CostAverageCumQty
- Cumulative average cost quantities (internal)
- */
- public void setCostAverageCumQty (BigDecimal CostAverageCumQty)
- {
- set_ValueNoCheck (COLUMNNAME_CostAverageCumQty, CostAverageCumQty);
- }
-
- /** Get Average Cost Quantity Sum.
- @return Cumulative average cost quantities (internal)
- */
- public BigDecimal getCostAverageCumQty ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostAverageCumQty);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Standard Cost.
- @param CostStandard
- Standard Costs
- */
- public void setCostStandard (BigDecimal CostStandard)
- {
- set_ValueNoCheck (COLUMNNAME_CostStandard, CostStandard);
- }
-
- /** Get Standard Cost.
- @return Standard Costs
- */
- public BigDecimal getCostStandard ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandard);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Std Cost Amount Sum.
- @param CostStandardCumAmt
- Standard Cost Invoice Amount Sum (internal)
- */
- public void setCostStandardCumAmt (BigDecimal CostStandardCumAmt)
- {
- set_ValueNoCheck (COLUMNNAME_CostStandardCumAmt, CostStandardCumAmt);
- }
-
- /** Get Std Cost Amount Sum.
- @return Standard Cost Invoice Amount Sum (internal)
- */
- public BigDecimal getCostStandardCumAmt ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardCumAmt);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Std Cost Quantity Sum.
- @param CostStandardCumQty
- Standard Cost Invoice Quantity Sum (internal)
- */
- public void setCostStandardCumQty (BigDecimal CostStandardCumQty)
- {
- set_ValueNoCheck (COLUMNNAME_CostStandardCumQty, CostStandardCumQty);
- }
-
- /** Get Std Cost Quantity Sum.
- @return Standard Cost Invoice Quantity Sum (internal)
- */
- public BigDecimal getCostStandardCumQty ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardCumQty);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Std PO Cost Amount Sum.
- @param CostStandardPOAmt
- Standard Cost Purchase Order Amount Sum (internal)
- */
- public void setCostStandardPOAmt (BigDecimal CostStandardPOAmt)
- {
- set_ValueNoCheck (COLUMNNAME_CostStandardPOAmt, CostStandardPOAmt);
- }
-
- /** Get Std PO Cost Amount Sum.
- @return Standard Cost Purchase Order Amount Sum (internal)
- */
- public BigDecimal getCostStandardPOAmt ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardPOAmt);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Std PO Cost Quantity Sum.
- @param CostStandardPOQty
- Standard Cost Purchase Order Quantity Sum (internal)
- */
- public void setCostStandardPOQty (BigDecimal CostStandardPOQty)
- {
- set_ValueNoCheck (COLUMNNAME_CostStandardPOQty, CostStandardPOQty);
- }
-
- /** Get Std PO Cost Quantity Sum.
- @return Standard Cost Purchase Order Quantity Sum (internal)
- */
- public BigDecimal getCostStandardPOQty ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardPOQty);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Current Cost Price.
- @param CurrentCostPrice
- The currently used cost price
- */
- public void setCurrentCostPrice (BigDecimal CurrentCostPrice)
- {
- set_Value (COLUMNNAME_CurrentCostPrice, CurrentCostPrice);
- }
-
- /** Get Current Cost Price.
- @return The currently used cost price
- */
- public BigDecimal getCurrentCostPrice ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CurrentCostPrice);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Future Cost Price.
- @param FutureCostPrice Future Cost Price */
- public void setFutureCostPrice (BigDecimal FutureCostPrice)
- {
- set_Value (COLUMNNAME_FutureCostPrice, FutureCostPrice);
- }
-
- /** Get Future Cost Price.
- @return Future Cost Price */
- public BigDecimal getFutureCostPrice ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FutureCostPrice);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- public I_M_Product getM_Product() throws RuntimeException
- {
- return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
- .getPO(getM_Product_ID(), get_TrxName()); }
-
- /** Set Product.
- @param M_Product_ID
- Product, Service, Item
- */
- public void setM_Product_ID (int M_Product_ID)
- {
- if (M_Product_ID < 1)
- set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
- else
- set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
- }
-
- /** Get Product.
- @return Product, Service, Item
- */
- public int getM_Product_ID ()
- {
- Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
- if (ii == null)
- return 0;
- return ii.intValue();
- }
-
- /** Set Last Invoice Price.
- @param PriceLastInv
- Price of the last invoice for the product
- */
- public void setPriceLastInv (BigDecimal PriceLastInv)
- {
- set_ValueNoCheck (COLUMNNAME_PriceLastInv, PriceLastInv);
- }
-
- /** Get Last Invoice Price.
- @return Price of the last invoice for the product
- */
- public BigDecimal getPriceLastInv ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceLastInv);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Last PO Price.
- @param PriceLastPO
- Price of the last purchase order for the product
- */
- public void setPriceLastPO (BigDecimal PriceLastPO)
- {
- set_ValueNoCheck (COLUMNNAME_PriceLastPO, PriceLastPO);
- }
-
- /** Get Last PO Price.
- @return Price of the last purchase order for the product
- */
- public BigDecimal getPriceLastPO ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceLastPO);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Total Invoice Amount.
- @param TotalInvAmt
- Cumulative total lifetime invoice amount
- */
- public void setTotalInvAmt (BigDecimal TotalInvAmt)
- {
- set_ValueNoCheck (COLUMNNAME_TotalInvAmt, TotalInvAmt);
- }
-
- /** Get Total Invoice Amount.
- @return Cumulative total lifetime invoice amount
- */
- public BigDecimal getTotalInvAmt ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalInvAmt);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-
- /** Set Total Invoice Quantity.
- @param TotalInvQty
- Cumulative total lifetime invoice quantity
- */
- public void setTotalInvQty (BigDecimal TotalInvQty)
- {
- set_ValueNoCheck (COLUMNNAME_TotalInvQty, TotalInvQty);
- }
-
- /** Get Total Invoice Quantity.
- @return Cumulative total lifetime invoice quantity
- */
- public BigDecimal getTotalInvQty ()
- {
- BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalInvQty);
- if (bd == null)
- return Env.ZERO;
- return bd;
- }
-}
\ No newline at end of file
diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Merge.java b/org.adempiere.ui/src/org/compiere/apps/form/Merge.java
index 9baa59df8f..47e1695f00 100644
--- a/org.adempiere.ui/src/org/compiere/apps/form/Merge.java
+++ b/org.adempiere.ui/src/org/compiere/apps/form/Merge.java
@@ -59,7 +59,7 @@ public class Merge
/** Tables to delete (not update) for M_Product */
public static String[] s_delete_Product = new String[]
{"M_Product_PO", "M_Replenish", "T_Replenish",
- "M_ProductPrice", "M_Product_Costing",
+ "M_ProductPrice",
"M_Cost", // teo_sarca [ 1704554 ]
"M_Product_Trl", "M_Product_Acct"}; // M_Storage