details:   https://code.openbravo.com/erp/devel/pi/rev/f0a5ce61435b
changeset: 15882:f0a5ce61435b
user:      Javier Etxarri <javier.echarri <at> openbravo.com>
date:      Fri Mar 23 13:52:53 2012 +0100
summary:   Fixes issue 20075: Error when posting Match Invoice in foreign 
currency

details:   https://code.openbravo.com/erp/devel/pi/rev/013958cc16f6
changeset: 15883:013958cc16f6
user:      Javier Etxarri <javier.echarri <at> openbravo.com>
date:      Fri Mar 23 14:04:21 2012 +0100
summary:   issue issue 20010: Error in Create Credit process when there is a 
discount line in Return from Customer

diffstat:

 src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (23 lines):

diff -r 01288f09856b -r 013958cc16f6 
src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java     Fri Mar 23 
12:36:56 2012 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java     Fri Mar 23 
14:04:21 2012 +0100
@@ -215,9 +215,16 @@
     }
     ProductInfo p = new ProductInfo(data[0].getField("M_Product_Id"), conn);
     for (DocLine docLineInvoice : p_lines) {
-      bdExpenses.toString();
-      String strAmount = (changeSign) ? new 
BigDecimal(docLineInvoice.getAmount()).multiply(
-          new BigDecimal(-1)).toString() : docLineInvoice.getAmount();
+      String strAmount = "";
+      if (strInvoiceCurrency != costCurrencyId) {
+        strAmount = getConvertedAmt((changeSign) ? new 
BigDecimal(docLineInvoice.getAmount())
+            .multiply(new BigDecimal(-1)).toString() : 
docLineInvoice.getAmount(),
+            strInvoiceCurrency, costCurrencyId, strDate, "", vars.getClient(), 
vars.getOrg(), conn);
+      } else {
+        strAmount = (changeSign) ? new 
BigDecimal(docLineInvoice.getAmount()).multiply(
+            new BigDecimal(-1)).toString() : docLineInvoice.getAmount();
+      }
+
       cr = fact.createLine(docLineInvoice, 
p.getAccount(ProductInfo.ACCTTYPE_P_Expense, as, conn),
           costCurrencyId, "0", strAmount, Fact_Acct_Group_ID, 
nextSeqNo(SeqNo), DocumentType, conn);
       if (cr == null && ZERO.compareTo(new BigDecimal(strAmount)) != 0) {

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to