Fix bug [ 1657372 ] M_MatchInv records can not be balanced
complete solution including Accounted values
This commit is contained in:
parent
0bed0fa571
commit
ca7563a039
|
|
@ -32,6 +32,7 @@ import org.compiere.util.*;
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Chris Farley: Fix Bug [ 1657372 ] M_MatchInv records can not be balanced
|
* Chris Farley: Fix Bug [ 1657372 ] M_MatchInv records can not be balanced
|
||||||
* https://sourceforge.net/forum/message.php?msg_id=4151117
|
* https://sourceforge.net/forum/message.php?msg_id=4151117
|
||||||
|
* Carlos Ruiz - globalqss: Add setAmtAcct method rounded by Currency
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class FactLine extends X_Fact_Acct
|
public final class FactLine extends X_Fact_Acct
|
||||||
|
|
@ -211,6 +212,32 @@ public final class FactLine extends X_Fact_Acct
|
||||||
setAmtAcctCr (AmtAcctCr);
|
setAmtAcctCr (AmtAcctCr);
|
||||||
} // setAmtAcct
|
} // setAmtAcct
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Accounted Amounts rounded by currency
|
||||||
|
* @param C_Currency_ID currency
|
||||||
|
* @param AmtAcctDr acct amount dr
|
||||||
|
* @param AmtAcctCr acct amount cr
|
||||||
|
*/
|
||||||
|
public void setAmtAcct(int C_Currency_ID, BigDecimal AmtAcctDr, BigDecimal AmtAcctCr)
|
||||||
|
{
|
||||||
|
setAmtAcctDr (AmtAcctDr);
|
||||||
|
setAmtAcctCr (AmtAcctCr);
|
||||||
|
// Currency Precision
|
||||||
|
int precision = MCurrency.getStdPrecision(getCtx(), C_Currency_ID);
|
||||||
|
if (AmtAcctDr != null && AmtAcctDr.scale() > precision)
|
||||||
|
{
|
||||||
|
BigDecimal AmtAcctDr1 = AmtAcctDr.setScale(precision, BigDecimal.ROUND_HALF_UP);
|
||||||
|
log.warning("Accounted DR Precision " + AmtAcctDr + " -> " + AmtAcctDr1);
|
||||||
|
setAmtAcctDr(AmtAcctDr1);
|
||||||
|
}
|
||||||
|
if (AmtAcctCr != null && AmtAcctCr.scale() > precision)
|
||||||
|
{
|
||||||
|
BigDecimal AmtAcctCr1 = AmtAcctCr.setScale(precision, BigDecimal.ROUND_HALF_UP);
|
||||||
|
log.warning("Accounted CR Precision " + AmtAcctCr + " -> " + AmtAcctCr1);
|
||||||
|
setAmtAcctCr(AmtAcctCr1);
|
||||||
|
}
|
||||||
|
} // setAmtAcct
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Document Info
|
* Set Document Info
|
||||||
* @param doc document
|
* @param doc document
|
||||||
|
|
@ -943,8 +970,9 @@ public final class FactLine extends X_Fact_Acct
|
||||||
// Accounted Amounts - reverse
|
// Accounted Amounts - reverse
|
||||||
BigDecimal dr = fact.getAmtAcctDr();
|
BigDecimal dr = fact.getAmtAcctDr();
|
||||||
BigDecimal cr = fact.getAmtAcctCr();
|
BigDecimal cr = fact.getAmtAcctCr();
|
||||||
setAmtAcctDr (cr.multiply(multiplier));
|
// setAmtAcctDr (cr.multiply(multiplier));
|
||||||
setAmtAcctCr (dr.multiply(multiplier));
|
// setAmtAcctCr (dr.multiply(multiplier));
|
||||||
|
setAmtAcct(fact.getC_Currency_ID(), cr.multiply(multiplier), dr.multiply(multiplier));
|
||||||
// Source Amounts
|
// Source Amounts
|
||||||
setAmtSource(fact.getC_Currency_ID(), getAmtAcctDr(), getAmtAcctCr());
|
setAmtSource(fact.getC_Currency_ID(), getAmtAcctDr(), getAmtAcctCr());
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue