IDEMPIERE-2825 - Pluggable product pricing
This commit is contained in:
parent
acf10e57a5
commit
43cfdd2a96
|
@ -20,6 +20,8 @@ package org.adempiere.model;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.compiere.model.CalloutEngine;
|
import org.compiere.model.CalloutEngine;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
|
@ -30,7 +32,6 @@ import org.compiere.model.MInvoice;
|
||||||
import org.compiere.model.MInvoiceLine;
|
import org.compiere.model.MInvoiceLine;
|
||||||
import org.compiere.model.MOrder;
|
import org.compiere.model.MOrder;
|
||||||
import org.compiere.model.MOrderLine;
|
import org.compiere.model.MOrderLine;
|
||||||
import org.compiere.model.MProductPricing;
|
|
||||||
import org.compiere.model.MRMA;
|
import org.compiere.model.MRMA;
|
||||||
import org.compiere.model.MRMALine;
|
import org.compiere.model.MRMALine;
|
||||||
import org.compiere.model.Query;
|
import org.compiere.model.Query;
|
||||||
|
@ -146,7 +147,8 @@ public class CalloutRMA extends CalloutEngine {
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
MRMA rma = new MRMA(ctx, M_RMA_ID, null);
|
MRMA rma = new MRMA(ctx, M_RMA_ID, null);
|
||||||
MProductPricing pp = new MProductPricing(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null);
|
||||||
int taxId = 0;
|
int taxId = 0;
|
||||||
int precision = 0;
|
int precision = 0;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
@ -327,7 +329,8 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
||||||
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced");
|
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced");
|
||||||
MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
||||||
//
|
//
|
||||||
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
@ -564,7 +567,8 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
if (QtyInvoiced == null)
|
if (QtyInvoiced == null)
|
||||||
QtyInvoiced = QtyEntered;
|
QtyInvoiced = QtyEntered;
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null);
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
||||||
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
||||||
|
@ -845,7 +849,8 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
||||||
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
||||||
//
|
//
|
||||||
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
|
|
@ -24,6 +24,8 @@ import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
@ -800,7 +802,8 @@ public class CalloutOrder extends CalloutEngine
|
||||||
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
||||||
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
||||||
//
|
//
|
||||||
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
@ -1096,7 +1099,8 @@ public class CalloutOrder extends CalloutEngine
|
||||||
if (QtyOrdered == null)
|
if (QtyOrdered == null)
|
||||||
QtyOrdered = QtyEntered;
|
QtyOrdered = QtyEntered;
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null);
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
|
||||||
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
||||||
|
@ -1425,7 +1429,8 @@ public class CalloutOrder extends CalloutEngine
|
||||||
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
|
||||||
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
||||||
MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
|
||||||
//
|
//
|
||||||
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.adempiere.model.GridTabWrapper;
|
import org.adempiere.model.GridTabWrapper;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
|
@ -100,7 +102,8 @@ public class CalloutRequisition extends CalloutEngine
|
||||||
int C_BPartner_ID = line.getC_BPartner_ID();
|
int C_BPartner_ID = line.getC_BPartner_ID();
|
||||||
BigDecimal Qty = line.getQty();
|
BigDecimal Qty = line.getQty();
|
||||||
boolean isSOTrx = false;
|
boolean isSOTrx = false;
|
||||||
MProductPricing pp = new MProductPricing (line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null);
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setInitialValues(line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null);
|
||||||
//
|
//
|
||||||
int M_PriceList_ID = req.getM_PriceList_ID();
|
int M_PriceList_ID = req.getM_PriceList_ID();
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
|
|
|
@ -19,7 +19,8 @@ package org.compiere.process;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.model.MProductPricing;
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.compiere.model.MProject;
|
import org.compiere.model.MProject;
|
||||||
import org.compiere.model.MProjectLine;
|
import org.compiere.model.MProjectLine;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -71,8 +72,9 @@ public class ProjectLinePricing extends SvrProcess
|
||||||
throw new IllegalArgumentException("No PriceList");
|
throw new IllegalArgumentException("No PriceList");
|
||||||
//
|
//
|
||||||
boolean isSOTrx = true;
|
boolean isSOTrx = true;
|
||||||
MProductPricing pp = new MProductPricing (projectLine.getM_Product_ID(),
|
IProductPricing pp = Core.getProductPricing();
|
||||||
project.getC_BPartner_ID(), projectLine.getPlannedQty(), isSOTrx, get_TrxName());
|
pp.setInitialValues(projectLine.getM_Product_ID(), project.getC_BPartner_ID(),
|
||||||
|
projectLine.getPlannedQty(), isSOTrx, get_TrxName());
|
||||||
pp.setM_PriceList_ID(project.getM_PriceList_ID());
|
pp.setM_PriceList_ID(project.getM_PriceList_ID());
|
||||||
pp.setPriceDate(project.getDateContract());
|
pp.setPriceDate(project.getDateContract());
|
||||||
//
|
//
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.DefaultProductPricingFactory">
|
||||||
|
<implementation class="org.adempiere.base.DefaultProductPricingFactory"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.base.IProductPricingFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -22,6 +22,7 @@ bin.includes = META-INF/,\
|
||||||
OSGI-INF/defaultaddressvalidationfactory.xml,\
|
OSGI-INF/defaultaddressvalidationfactory.xml,\
|
||||||
OSGI-INF/defaulttaxproviderfactory.xml,\
|
OSGI-INF/defaulttaxproviderfactory.xml,\
|
||||||
OSGI-INF/addressvalidationeventhandler.xml,\
|
OSGI-INF/addressvalidationeventhandler.xml,\
|
||||||
|
OSGI-INF/defaultproductpricingfactory.xml\
|
||||||
schema/,\
|
schema/,\
|
||||||
bsh-2.0b6.jar,\
|
bsh-2.0b6.jar,\
|
||||||
commons-validator-1.6.jar
|
commons-validator-1.6.jar
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2017 Diego Ruiz *
|
||||||
|
* Copyright (C) 2017 Bx Service GmbH *
|
||||||
|
* 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. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.adempiere.base;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
import org.compiere.model.I_C_InvoiceLine;
|
||||||
|
import org.compiere.model.I_C_OrderLine;
|
||||||
|
import org.compiere.model.I_C_ProjectLine;
|
||||||
|
import org.compiere.model.I_M_RMALine;
|
||||||
|
import org.compiere.model.I_M_RequisitionLine;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
|
public abstract class AbstractProductPricing implements IProductPricing {
|
||||||
|
|
||||||
|
protected int m_M_Product_ID;
|
||||||
|
protected int m_C_BPartner_ID;
|
||||||
|
protected BigDecimal m_Qty = Env.ONE;
|
||||||
|
protected boolean m_isSOTrx = true;
|
||||||
|
protected String trxName = null;
|
||||||
|
|
||||||
|
protected int m_M_PriceList_Version_ID = 0;
|
||||||
|
protected int m_M_PriceList_ID = 0;
|
||||||
|
protected Timestamp m_PriceDate;
|
||||||
|
|
||||||
|
public AbstractProductPricing() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInitialValues(int M_Product_ID, int C_BPartner_ID, BigDecimal qty, boolean isSOTrx, String trxName) {
|
||||||
|
this.trxName=trxName;
|
||||||
|
m_M_Product_ID = M_Product_ID;
|
||||||
|
m_C_BPartner_ID = C_BPartner_ID;
|
||||||
|
|
||||||
|
if (qty != null && Env.ZERO.compareTo(qty) != 0)
|
||||||
|
m_Qty = qty;
|
||||||
|
m_isSOTrx = isSOTrx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getM_Product_ID() {
|
||||||
|
return m_M_Product_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getM_PriceList_ID() {
|
||||||
|
return m_M_PriceList_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setM_PriceList_ID(int M_PriceList_ID) {
|
||||||
|
m_M_PriceList_ID = M_PriceList_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setM_PriceList_Version_ID(int M_PriceList_Version_ID) {
|
||||||
|
m_M_PriceList_Version_ID = M_PriceList_Version_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Timestamp getPriceDate() {
|
||||||
|
return m_PriceDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPriceDate(Timestamp priceDate) {
|
||||||
|
m_PriceDate = priceDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOrderLine(I_C_OrderLine orderLine, String trxName) {
|
||||||
|
m_M_Product_ID = orderLine.getM_Product_ID();
|
||||||
|
m_C_BPartner_ID = orderLine.getC_BPartner_ID();
|
||||||
|
BigDecimal qty = orderLine.getQtyOrdered();
|
||||||
|
if (qty != null && Env.ZERO.compareTo(qty) != 0)
|
||||||
|
m_Qty = qty;
|
||||||
|
m_isSOTrx = orderLine.getC_Order().isSOTrx();
|
||||||
|
m_PriceDate = orderLine.getDateOrdered();
|
||||||
|
this.trxName = trxName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName) {
|
||||||
|
m_M_Product_ID = invoiceLine.getM_Product_ID();
|
||||||
|
m_C_BPartner_ID = invoiceLine.getC_Invoice().getC_BPartner_ID();
|
||||||
|
BigDecimal qty = invoiceLine.getQtyInvoiced();
|
||||||
|
if (qty != null && Env.ZERO.compareTo(qty) != 0)
|
||||||
|
m_Qty = qty;
|
||||||
|
m_isSOTrx = invoiceLine.getC_Invoice().isSOTrx();
|
||||||
|
m_PriceDate = invoiceLine.getC_Invoice().getDateInvoiced();
|
||||||
|
this.trxName = trxName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProjectLine(I_C_ProjectLine projectLine, String trxName) {
|
||||||
|
m_M_Product_ID = projectLine.getM_Product_ID();
|
||||||
|
m_C_BPartner_ID = projectLine.getC_Project().getC_BPartner_ID();
|
||||||
|
BigDecimal qty = projectLine.getPlannedQty();
|
||||||
|
if (qty != null && Env.ZERO.compareTo(qty) != 0)
|
||||||
|
m_Qty = qty;
|
||||||
|
m_isSOTrx = true;
|
||||||
|
this.trxName = trxName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRequisitionLine(I_M_RequisitionLine reqLine, String trxName) {
|
||||||
|
m_M_Product_ID = reqLine.getM_Product_ID();
|
||||||
|
m_C_BPartner_ID = reqLine.getC_BPartner_ID();
|
||||||
|
BigDecimal qty = reqLine.getQty();
|
||||||
|
if (qty != null && Env.ZERO.compareTo(qty) != 0)
|
||||||
|
m_Qty = qty;
|
||||||
|
m_isSOTrx = false;
|
||||||
|
this.trxName = trxName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRMALine(I_M_RMALine rmaLine, String trxName) {
|
||||||
|
m_M_Product_ID = rmaLine.getM_Product_ID();
|
||||||
|
m_C_BPartner_ID = rmaLine.getM_RMA().getC_BPartner_ID();
|
||||||
|
m_Qty = Env.ONE;
|
||||||
|
m_isSOTrx = rmaLine.getM_RMA().isSOTrx();
|
||||||
|
this.trxName = trxName;
|
||||||
|
}
|
||||||
|
}
|
|
@ -450,4 +450,26 @@ public class Core {
|
||||||
|
|
||||||
return myPaymentExporter;
|
return myPaymentExporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get ProductPricing instance
|
||||||
|
*
|
||||||
|
* @return instance of the IProductPricing or null
|
||||||
|
*/
|
||||||
|
public static IProductPricing getProductPricing() {
|
||||||
|
|
||||||
|
List<IProductPricingFactory> factoryList =
|
||||||
|
Service.locator().list(IProductPricingFactory.class).getServices();
|
||||||
|
if (factoryList != null) {
|
||||||
|
for(IProductPricingFactory factory : factoryList) {
|
||||||
|
IProductPricing myProductPricing = factory.newProductPricingInstance();
|
||||||
|
if (myProductPricing != null) {
|
||||||
|
return myProductPricing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.adempiere.base;
|
||||||
|
|
||||||
|
import org.compiere.model.MProductPricing;
|
||||||
|
|
||||||
|
public class DefaultProductPricingFactory implements IProductPricingFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public DefaultProductPricingFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractProductPricing newProductPricingInstance() {
|
||||||
|
return new MProductPricing();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2017 Diego Ruiz *
|
||||||
|
* Copyright (C) 2017 Bx Service GmbH *
|
||||||
|
* 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. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.adempiere.base;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
import org.compiere.model.I_C_InvoiceLine;
|
||||||
|
import org.compiere.model.I_C_OrderLine;
|
||||||
|
import org.compiere.model.I_C_ProjectLine;
|
||||||
|
import org.compiere.model.I_M_RMALine;
|
||||||
|
import org.compiere.model.I_M_RequisitionLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product Price Calculations
|
||||||
|
*/
|
||||||
|
public interface IProductPricing {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the initial values that the old MProductPricing uses
|
||||||
|
* for backward compatibility
|
||||||
|
* @param M_Product_ID
|
||||||
|
* @param C_BPartner_ID
|
||||||
|
* @param qty
|
||||||
|
* @param isSOTrx
|
||||||
|
* @param trxName
|
||||||
|
*/
|
||||||
|
void setInitialValues(int M_Product_ID, int C_BPartner_ID,
|
||||||
|
BigDecimal qty, boolean isSOTrx, String trxName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Price
|
||||||
|
* @return true if calculated
|
||||||
|
*/
|
||||||
|
boolean calculatePrice();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Discount Percentage
|
||||||
|
* @return Discount
|
||||||
|
*/
|
||||||
|
BigDecimal getDiscount();
|
||||||
|
|
||||||
|
int getM_Product_ID();
|
||||||
|
|
||||||
|
int getM_PriceList_ID();
|
||||||
|
|
||||||
|
void setM_PriceList_ID(int M_PriceList_ID);
|
||||||
|
|
||||||
|
void setM_PriceList_Version_ID(int M_PriceList_Version_ID);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Price Date
|
||||||
|
* @return date
|
||||||
|
*/
|
||||||
|
Timestamp getPriceDate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Price Date
|
||||||
|
* @param priceDate date
|
||||||
|
*/
|
||||||
|
void setPriceDate(Timestamp priceDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get C_UOM_ID
|
||||||
|
* @return uom
|
||||||
|
*/
|
||||||
|
int getC_UOM_ID();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Price List
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
BigDecimal getPriceList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Price Std
|
||||||
|
* @return std
|
||||||
|
*/
|
||||||
|
BigDecimal getPriceStd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Price Limit
|
||||||
|
* @return limit
|
||||||
|
*/
|
||||||
|
BigDecimal getPriceLimit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Price List Currency
|
||||||
|
* @return currency
|
||||||
|
*/
|
||||||
|
int getC_Currency_ID();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is Price List enforced?
|
||||||
|
* @return enforce limit
|
||||||
|
*/
|
||||||
|
boolean isEnforcePriceLimit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a DiscountSchema active?
|
||||||
|
* @return active Discount Schema
|
||||||
|
*/
|
||||||
|
boolean isDiscountSchema();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the Price Calculated (i.e. found)?
|
||||||
|
* @return calculated
|
||||||
|
*/
|
||||||
|
boolean isCalculated();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set order line and calculate the parameters from it
|
||||||
|
* @param orderLine
|
||||||
|
* @param trxName
|
||||||
|
*/
|
||||||
|
void setOrderLine(I_C_OrderLine orderLine, String trxName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set invoice line and calculate the parameters from it
|
||||||
|
* @param invoiceLine
|
||||||
|
* @param trxName
|
||||||
|
*/
|
||||||
|
void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set project line and calculate the parameters from it
|
||||||
|
* @param projectLine
|
||||||
|
* @param trxName
|
||||||
|
*/
|
||||||
|
void setProjectLine(I_C_ProjectLine projectLine, String trxName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set requisition line and calculate the parameters from it
|
||||||
|
* @param reqLine
|
||||||
|
* @param trxName
|
||||||
|
*/
|
||||||
|
void setRequisitionLine(I_M_RequisitionLine reqLine, String trxName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set rma line and calculate the parameters from it
|
||||||
|
* @param rmaLine
|
||||||
|
* @param trxName
|
||||||
|
*/
|
||||||
|
void setRMALine(I_M_RMALine rmaLine, String trxName);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2017 Diego Ruiz *
|
||||||
|
* Copyright (C) 2017 Bx Service GmbH *
|
||||||
|
* 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. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.adempiere.base;
|
||||||
|
|
||||||
|
public interface IProductPricingFactory {
|
||||||
|
|
||||||
|
public AbstractProductPricing newProductPricingInstance();
|
||||||
|
|
||||||
|
}
|
|
@ -15,9 +15,9 @@ package org.adempiere.exceptions;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.compiere.model.MPriceList;
|
import org.compiere.model.MPriceList;
|
||||||
import org.compiere.model.MProduct;
|
import org.compiere.model.MProduct;
|
||||||
import org.compiere.model.MProductPricing;
|
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ public class ProductNotOnPriceListException extends AdempiereException
|
||||||
|
|
||||||
public static final String AD_Message = "ProductNotOnPriceList";
|
public static final String AD_Message = "ProductNotOnPriceList";
|
||||||
|
|
||||||
public ProductNotOnPriceListException(MProductPricing productPricing, int documentLineNo)
|
public ProductNotOnPriceListException(IProductPricing productPricing, int documentLineNo)
|
||||||
{
|
{
|
||||||
super(buildMessage(productPricing, documentLineNo));
|
super(buildMessage(productPricing, documentLineNo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String buildMessage (MProductPricing pp, int documentLineNo)
|
private static final String buildMessage (IProductPricing pp, int documentLineNo)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (documentLineNo > 0)
|
if (documentLineNo > 0)
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.base.Core;
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.adempiere.model.ITaxProvider;
|
import org.adempiere.model.ITaxProvider;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
@ -177,7 +178,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
/** Cached Precision */
|
/** Cached Precision */
|
||||||
private Integer m_precision = null;
|
private Integer m_precision = null;
|
||||||
/** Product Pricing */
|
/** Product Pricing */
|
||||||
private MProductPricing m_productPricing = null;
|
private IProductPricing m_productPricing = null;
|
||||||
/** Parent */
|
/** Parent */
|
||||||
private MInvoice m_parent = null;
|
private MInvoice m_parent = null;
|
||||||
|
|
||||||
|
@ -378,10 +379,9 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
return;
|
return;
|
||||||
//
|
//
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID);
|
||||||
m_productPricing = new MProductPricing (getM_Product_ID(),
|
m_productPricing = Core.getProductPricing();
|
||||||
C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx, get_TrxName());
|
m_productPricing.setInvoiceLine(this, get_TrxName());
|
||||||
m_productPricing.setM_PriceList_ID(M_PriceList_ID);
|
m_productPricing.setM_PriceList_ID(M_PriceList_ID);
|
||||||
m_productPricing.setPriceDate(m_DateInvoiced);
|
|
||||||
//
|
//
|
||||||
setPriceActual (m_productPricing.getPriceStd());
|
setPriceActual (m_productPricing.getPriceStd());
|
||||||
setPriceList (m_productPricing.getPriceList());
|
setPriceList (m_productPricing.getPriceList());
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.base.Core;
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.adempiere.exceptions.ProductNotOnPriceListException;
|
import org.adempiere.exceptions.ProductNotOnPriceListException;
|
||||||
import org.adempiere.model.ITaxProvider;
|
import org.adempiere.model.ITaxProvider;
|
||||||
|
@ -196,7 +197,7 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
//
|
//
|
||||||
protected boolean m_IsSOTrx = true;
|
protected boolean m_IsSOTrx = true;
|
||||||
// Product Pricing
|
// Product Pricing
|
||||||
protected MProductPricing m_productPrice = null;
|
protected IProductPricing m_productPrice = null;
|
||||||
|
|
||||||
/** Tax */
|
/** Tax */
|
||||||
protected MTax m_tax = null;
|
protected MTax m_tax = null;
|
||||||
|
@ -321,12 +322,11 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
* @param M_PriceList_ID id
|
* @param M_PriceList_ID id
|
||||||
* @return product pricing
|
* @return product pricing
|
||||||
*/
|
*/
|
||||||
protected MProductPricing getProductPricing (int M_PriceList_ID)
|
protected IProductPricing getProductPricing (int M_PriceList_ID)
|
||||||
{
|
{
|
||||||
m_productPrice = new MProductPricing (getM_Product_ID(),
|
m_productPrice = Core.getProductPricing();
|
||||||
getC_BPartner_ID(), getQtyOrdered(), m_IsSOTrx, get_TrxName());
|
m_productPrice.setOrderLine(this, get_TrxName());
|
||||||
m_productPrice.setM_PriceList_ID(M_PriceList_ID);
|
m_productPrice.setM_PriceList_ID(M_PriceList_ID);
|
||||||
m_productPrice.setPriceDate(getDateOrdered());
|
|
||||||
//
|
//
|
||||||
m_productPrice.calculatePrice();
|
m_productPrice.calculatePrice();
|
||||||
return m_productPrice;
|
return m_productPrice;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.sql.ResultSet;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.AbstractProductPricing;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -33,13 +34,19 @@ import org.compiere.util.Trace;
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: MProductPricing.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
|
* @version $Id: MProductPricing.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
|
||||||
*/
|
*/
|
||||||
public class MProductPricing
|
public class MProductPricing extends AbstractProductPricing
|
||||||
{
|
{
|
||||||
|
|
||||||
private String trxName=null;
|
private String trxName=null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New constructor to be used with the ProductPriceFactories
|
||||||
|
*/
|
||||||
|
public MProductPricing() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Old Constructor to keep backward
|
||||||
|
* compatibility
|
||||||
* @param M_Product_ID product
|
* @param M_Product_ID product
|
||||||
* @param C_BPartner_ID partner
|
* @param C_BPartner_ID partner
|
||||||
* @param Qty quantity
|
* @param Qty quantity
|
||||||
|
@ -49,17 +56,7 @@ public class MProductPricing
|
||||||
public MProductPricing (int M_Product_ID, int C_BPartner_ID,
|
public MProductPricing (int M_Product_ID, int C_BPartner_ID,
|
||||||
BigDecimal Qty, boolean isSOTrx, String trxName)
|
BigDecimal Qty, boolean isSOTrx, String trxName)
|
||||||
{
|
{
|
||||||
this.trxName=trxName;
|
setInitialValues(M_Product_ID, C_BPartner_ID, Qty, isSOTrx, trxName);
|
||||||
|
|
||||||
m_M_Product_ID = M_Product_ID;
|
|
||||||
m_C_BPartner_ID = C_BPartner_ID;
|
|
||||||
if (Qty != null && Env.ZERO.compareTo(Qty) != 0)
|
|
||||||
m_Qty = Qty;
|
|
||||||
m_isSOTrx = isSOTrx;
|
|
||||||
int thereAreVendorBreakRecords = DB.getSQLValue(trxName,
|
|
||||||
"SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)",
|
|
||||||
m_M_Product_ID, m_C_BPartner_ID);
|
|
||||||
m_useVendorBreak = thereAreVendorBreakRecords > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,13 +73,20 @@ public class MProductPricing
|
||||||
{
|
{
|
||||||
this(M_Product_ID,C_BPartner_ID,Qty,isSOTrx,null);
|
this(M_Product_ID,C_BPartner_ID,Qty,isSOTrx,null);
|
||||||
} // MProductPricing
|
} // MProductPricing
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInitialValues(int M_Product_ID, int C_BPartner_ID, BigDecimal qty, boolean isSOTrx, String trxName) {
|
||||||
|
super.setInitialValues(M_Product_ID, C_BPartner_ID, qty, isSOTrx, trxName);
|
||||||
|
checkVendorBreak();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkVendorBreak() {
|
||||||
|
int thereAreVendorBreakRecords = DB.getSQLValue(trxName,
|
||||||
|
"SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)",
|
||||||
|
m_M_Product_ID, m_C_BPartner_ID);
|
||||||
|
m_useVendorBreak = thereAreVendorBreakRecords > 0;
|
||||||
|
}
|
||||||
|
|
||||||
private int m_M_Product_ID;
|
|
||||||
private int m_C_BPartner_ID;
|
|
||||||
private BigDecimal m_Qty = Env.ONE;
|
|
||||||
private boolean m_isSOTrx = true;
|
|
||||||
//
|
|
||||||
private int m_M_PriceList_ID = 0;
|
|
||||||
private int m_M_PriceList_Version_ID = 0;
|
private int m_M_PriceList_Version_ID = 0;
|
||||||
private Timestamp m_PriceDate;
|
private Timestamp m_PriceDate;
|
||||||
/** Precision -1 = no rounding */
|
/** Precision -1 = no rounding */
|
||||||
|
@ -828,32 +832,13 @@ public class MProductPricing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Get Product ID
|
|
||||||
* @return id
|
|
||||||
*/
|
|
||||||
public int getM_Product_ID()
|
|
||||||
{
|
|
||||||
return m_M_Product_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get PriceList ID
|
|
||||||
* @return pl
|
|
||||||
*/
|
|
||||||
public int getM_PriceList_ID()
|
|
||||||
{
|
|
||||||
return m_M_PriceList_ID;
|
|
||||||
} // getM_PriceList_ID
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set PriceList
|
* Set PriceList
|
||||||
* @param M_PriceList_ID pl
|
* @param M_PriceList_ID pl
|
||||||
*/
|
*/
|
||||||
public void setM_PriceList_ID( int M_PriceList_ID)
|
public void setM_PriceList_ID( int M_PriceList_ID)
|
||||||
{
|
{
|
||||||
m_M_PriceList_ID = M_PriceList_ID;
|
super.setM_PriceList_ID(M_PriceList_ID);
|
||||||
m_calculated = false;
|
m_calculated = false;
|
||||||
} // setM_PriceList_ID
|
} // setM_PriceList_ID
|
||||||
|
|
||||||
|
@ -872,26 +857,17 @@ public class MProductPricing
|
||||||
*/
|
*/
|
||||||
public void setM_PriceList_Version_ID (int M_PriceList_Version_ID)
|
public void setM_PriceList_Version_ID (int M_PriceList_Version_ID)
|
||||||
{
|
{
|
||||||
m_M_PriceList_Version_ID = M_PriceList_Version_ID;
|
super.setM_PriceList_Version_ID(M_PriceList_Version_ID);
|
||||||
m_calculated = false;
|
m_calculated = false;
|
||||||
} // setM_PriceList_Version_ID
|
} // setM_PriceList_Version_ID
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Price Date
|
|
||||||
* @return date
|
|
||||||
*/
|
|
||||||
public Timestamp getPriceDate()
|
|
||||||
{
|
|
||||||
return m_PriceDate;
|
|
||||||
} // getPriceDate
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Price Date
|
* Set Price Date
|
||||||
* @param priceDate date
|
* @param priceDate date
|
||||||
*/
|
*/
|
||||||
public void setPriceDate(Timestamp priceDate)
|
public void setPriceDate(Timestamp priceDate)
|
||||||
{
|
{
|
||||||
m_PriceDate = priceDate;
|
super.setPriceDate(priceDate);
|
||||||
m_calculated = false;
|
m_calculated = false;
|
||||||
} // setPriceDate
|
} // setPriceDate
|
||||||
|
|
||||||
|
@ -1006,4 +982,34 @@ public class MProductPricing
|
||||||
return m_calculated;
|
return m_calculated;
|
||||||
} // isCalculated
|
} // isCalculated
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOrderLine(I_C_OrderLine orderLine, String trxName) {
|
||||||
|
super.setOrderLine(orderLine, trxName);
|
||||||
|
checkVendorBreak();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName) {
|
||||||
|
super.setInvoiceLine(invoiceLine, trxName);
|
||||||
|
checkVendorBreak();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProjectLine(I_C_ProjectLine projectLine, String trxName) {
|
||||||
|
super.setProjectLine(projectLine, trxName);
|
||||||
|
checkVendorBreak();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRequisitionLine(I_M_RequisitionLine reqLine, String trxName) {
|
||||||
|
super.setRequisitionLine(reqLine, trxName);
|
||||||
|
checkVendorBreak();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRMALine(I_M_RMALine rmaLine, String trxName) {
|
||||||
|
super.setRMALine(rmaLine, trxName);
|
||||||
|
checkVendorBreak();
|
||||||
|
}
|
||||||
|
|
||||||
} // MProductPrice
|
} // MProductPrice
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
|
@ -146,9 +148,8 @@ public class MProjectLine extends X_C_ProjectLine
|
||||||
return limitPrice;
|
return limitPrice;
|
||||||
if (getProject() == null)
|
if (getProject() == null)
|
||||||
return limitPrice;
|
return limitPrice;
|
||||||
boolean isSOTrx = true;
|
IProductPricing pp = Core.getProductPricing();
|
||||||
MProductPricing pp = new MProductPricing (getM_Product_ID(),
|
pp.setProjectLine(this, get_TrxName());
|
||||||
m_parent.getC_BPartner_ID(), getPlannedQty(), isSOTrx, get_TrxName());
|
|
||||||
pp.setM_PriceList_ID(m_parent.getM_PriceList_ID());
|
pp.setM_PriceList_ID(m_parent.getM_PriceList_ID());
|
||||||
if (pp.calculatePrice())
|
if (pp.calculatePrice())
|
||||||
limitPrice = pp.getPriceLimit();
|
limitPrice = pp.getPriceLimit();
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.base.Core;
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.adempiere.model.ITaxProvider;
|
import org.adempiere.model.ITaxProvider;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
@ -147,7 +148,8 @@ public class MRMALine extends X_M_RMALine
|
||||||
}
|
}
|
||||||
else if (getM_Product_ID() != 0)
|
else if (getM_Product_ID() != 0)
|
||||||
{
|
{
|
||||||
MProductPricing pp = new MProductPricing (getM_Product_ID(), getParent().getC_BPartner_ID(), Env.ONE, getParent().isSOTrx(), get_TrxName());
|
IProductPricing pp = Core.getProductPricing();
|
||||||
|
pp.setRMALine(this, get_TrxName());
|
||||||
|
|
||||||
MInvoice invoice = getParent().getOriginalInvoice();
|
MInvoice invoice = getParent().getOriginalInvoice();
|
||||||
if (invoice != null)
|
if (invoice != null)
|
||||||
|
|
|
@ -23,6 +23,8 @@ import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.Core;
|
||||||
|
import org.adempiere.base.IProductPricing;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -232,9 +234,8 @@ public class MRequisitionLine extends X_M_RequisitionLine
|
||||||
return;
|
return;
|
||||||
//
|
//
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID);
|
||||||
boolean isSOTrx = false;
|
IProductPricing pp = Core.getProductPricing();
|
||||||
MProductPricing pp = new MProductPricing (getM_Product_ID(),
|
pp.setRequisitionLine(this, get_TrxName());
|
||||||
getC_BPartner_ID(), getQty(), isSOTrx, get_TrxName());
|
|
||||||
pp.setM_PriceList_ID(M_PriceList_ID);
|
pp.setM_PriceList_ID(M_PriceList_ID);
|
||||||
// pp.setPriceDate(getDateOrdered());
|
// pp.setPriceDate(getDateOrdered());
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue