From 76f79e7a1f7d1afe8423c27e0cf379fb37bbef77 Mon Sep 17 00:00:00 2001 From: bayucahya Date: Thu, 13 Nov 2008 03:50:36 +0000 Subject: [PATCH] BF [ 2268355 ] Invoice price variance doesn't use transactional currency Which lead to generate unnecessary suspense and currency balancing http://sourceforge.net/tracker/index.php?func=detail&aid=2268355&group_id=176962&atid=879332 --- base/src/org/compiere/acct/Doc_MatchInv.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/base/src/org/compiere/acct/Doc_MatchInv.java b/base/src/org/compiere/acct/Doc_MatchInv.java index 858d038cbc..70d836b3c0 100644 --- a/base/src/org/compiere/acct/Doc_MatchInv.java +++ b/base/src/org/compiere/acct/Doc_MatchInv.java @@ -46,6 +46,8 @@ import org.compiere.util.Env; * FR [ 1840016 ] Avoid usage of clearing accounts - subject to C_AcctSchema.IsPostIfClearingEqual * Avoid posting if both accounts Not Invoiced Receipts and Inventory Clearing are equal * + * @author Bayu Cahya, Sistematika + *
  • BF [ 2268355 ] Invoice price variance doesn't use transactional currency */ public class Doc_MatchInv extends Doc { @@ -259,12 +261,16 @@ public class Doc_MatchInv extends Doc // Invoice Price Variance difference - BigDecimal ipv = cr.getAcctBalance().add(dr.getAcctBalance()).negate(); + // Bayu, Sistematika + // BF [ 2268355 ] Invoice price variance doesn't use transactional currency + BigDecimal ipv = cr.getSourceBalance().add(dr.getSourceBalance()).negate(); if (ipv.signum() != 0) { + MInvoice m_invoice = m_invoiceLine.getParent(); + int C_Currency_ID = m_invoice.getC_Currency_ID(); FactLine pv = fact.createLine(null, m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as), - as.getC_Currency_ID(), ipv); + C_Currency_ID, ipv); pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID()); pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID()); pv.setC_Project_ID(m_invoiceLine.getC_Project_ID()); @@ -273,6 +279,7 @@ public class Doc_MatchInv extends Doc pv.setUser2_ID(m_invoiceLine.getUser2_ID()); } log.fine("IPV=" + ipv + "; Balance=" + fact.getSourceBalance()); + // end Bayu // Elaine 2008/6/20 /* Source move to MInvoice.createMatchInvCostDetail() // Cost Detail Record - data from Expense/IncClearing (CR) record