diff --git a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java index 5fc2be2af1..bdadacea6a 100644 --- a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java +++ b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java @@ -146,7 +146,7 @@ public class CalloutRMA extends CalloutEngine { return ""; MRMA rma = new MRMA(ctx, M_RMA_ID, null); - MProductPricing pp = new MProductPricing(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx()); + MProductPricing pp = new MProductPricing(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null); int taxId = 0; int precision = 0; diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java index a88914c794..e8b3f4f666 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -327,7 +327,7 @@ public class CalloutInvoice extends CalloutEngine boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -564,7 +564,7 @@ public class CalloutInvoice extends CalloutEngine if (QtyInvoiced == null) QtyInvoiced = QtyEntered; boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null); pp.setM_PriceList_ID(M_PriceList_ID); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); @@ -845,7 +845,7 @@ public class CalloutInvoice extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 89050f16d0..7cc24c63aa 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -800,7 +800,7 @@ public class CalloutOrder extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -1096,7 +1096,7 @@ public class CalloutOrder extends CalloutEngine if (QtyOrdered == null) QtyOrdered = QtyEntered; boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null); pp.setM_PriceList_ID(M_PriceList_ID); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); @@ -1425,7 +1425,7 @@ public class CalloutOrder extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java index 87f57e588a..5391757bda 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java @@ -100,7 +100,7 @@ public class CalloutRequisition extends CalloutEngine int C_BPartner_ID = line.getC_BPartner_ID(); BigDecimal Qty = line.getQty(); boolean isSOTrx = false; - MProductPricing pp = new MProductPricing (line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx); + MProductPricing pp = new MProductPricing (line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null); // int M_PriceList_ID = req.getM_PriceList_ID(); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java b/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java index 7d6357cd84..695c6201cd 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java +++ b/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java @@ -72,7 +72,7 @@ public class ProjectLinePricing extends SvrProcess // boolean isSOTrx = true; MProductPricing pp = new MProductPricing (projectLine.getM_Product_ID(), - project.getC_BPartner_ID(), projectLine.getPlannedQty(), isSOTrx); + project.getC_BPartner_ID(), projectLine.getPlannedQty(), isSOTrx, get_TrxName()); pp.setM_PriceList_ID(project.getM_PriceList_ID()); pp.setPriceDate(project.getDateContract()); // diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index c2957335dd..e0a80eafb4 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -379,7 +379,7 @@ public class MInvoiceLine extends X_C_InvoiceLine // if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID); m_productPricing = new MProductPricing (getM_Product_ID(), - C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx); + C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx, get_TrxName()); m_productPricing.setM_PriceList_ID(M_PriceList_ID); m_productPricing.setPriceDate(m_DateInvoiced); // diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLine.java b/org.adempiere.base/src/org/compiere/model/MOrderLine.java index 36c8e1c5ab..ffa04d4299 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrderLine.java +++ b/org.adempiere.base/src/org/compiere/model/MOrderLine.java @@ -324,7 +324,7 @@ public class MOrderLine extends X_C_OrderLine protected MProductPricing getProductPricing (int M_PriceList_ID) { m_productPrice = new MProductPricing (getM_Product_ID(), - getC_BPartner_ID(), getQtyOrdered(), m_IsSOTrx); + getC_BPartner_ID(), getQtyOrdered(), m_IsSOTrx, get_TrxName()); m_productPrice.setM_PriceList_ID(M_PriceList_ID); m_productPrice.setPriceDate(getDateOrdered()); // diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index 3474a11ff7..b49cd5357e 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -36,23 +36,31 @@ import org.compiere.util.Trace; public class MProductPricing { - String trxName=null; + private String trxName=null; + /** + * Constructor + * @param M_Product_ID product + * @param C_BPartner_ID partner + * @param Qty quantity + * @param isSOTrx SO or PO + * @param trxName the transaction + */ public MProductPricing (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; - 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; - } + { + 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; + 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; + } /** diff --git a/org.adempiere.base/src/org/compiere/model/MProjectLine.java b/org.adempiere.base/src/org/compiere/model/MProjectLine.java index c01137b648..22f92c20fe 100644 --- a/org.adempiere.base/src/org/compiere/model/MProjectLine.java +++ b/org.adempiere.base/src/org/compiere/model/MProjectLine.java @@ -148,7 +148,7 @@ public class MProjectLine extends X_C_ProjectLine return limitPrice; boolean isSOTrx = true; MProductPricing pp = new MProductPricing (getM_Product_ID(), - m_parent.getC_BPartner_ID(), getPlannedQty(), isSOTrx); + m_parent.getC_BPartner_ID(), getPlannedQty(), isSOTrx, get_TrxName()); pp.setM_PriceList_ID(m_parent.getM_PriceList_ID()); if (pp.calculatePrice()) limitPrice = pp.getPriceLimit(); diff --git a/org.adempiere.base/src/org/compiere/model/MRMALine.java b/org.adempiere.base/src/org/compiere/model/MRMALine.java index 86ab492117..d9899cf8b6 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMALine.java +++ b/org.adempiere.base/src/org/compiere/model/MRMALine.java @@ -147,7 +147,7 @@ public class MRMALine extends X_M_RMALine } else if (getM_Product_ID() != 0) { - MProductPricing pp = new MProductPricing (getM_Product_ID(), getParent().getC_BPartner_ID(), Env.ONE, getParent().isSOTrx()); + MProductPricing pp = new MProductPricing (getM_Product_ID(), getParent().getC_BPartner_ID(), Env.ONE, getParent().isSOTrx(), get_TrxName()); MInvoice invoice = getParent().getOriginalInvoice(); if (invoice != null) diff --git a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java index a2b6c9ab73..322c82de36 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java +++ b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java @@ -234,7 +234,7 @@ public class MRequisitionLine extends X_M_RequisitionLine if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID); boolean isSOTrx = false; MProductPricing pp = new MProductPricing (getM_Product_ID(), - getC_BPartner_ID(), getQty(), isSOTrx); + getC_BPartner_ID(), getQty(), isSOTrx, get_TrxName()); pp.setM_PriceList_ID(M_PriceList_ID); // pp.setPriceDate(getDateOrdered()); //