details:   https://code.openbravo.com/erp/devel/pi/rev/52f07f8abaa9
changeset: 13333:52f07f8abaa9
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Thu Jul 28 17:57:07 2011 +0200
summary:   Fixes bug 18118: Posting is broken while mixing invoices and GL 
items whenever the result payment is posted while being deposited

details:   https://code.openbravo.com/erp/devel/pi/rev/038a1d151bb0
changeset: 13334:038a1d151bb0
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Thu Jul 28 17:57:43 2011 +0200
summary:   Reformatting file

diffstat:

 src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java |  54 
++++-----
 1 files changed, 26 insertions(+), 28 deletions(-)

diffs (93 lines):

diff -r 951aa8d5e79f -r 038a1d151bb0 
src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java Thu Jul 
28 17:33:23 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java Thu Jul 
28 17:57:43 2011 +0200
@@ -30,7 +30,6 @@
 
 import org.apache.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
-import org.openbravo.advpaymentmngt.APRM_FinaccTransactionV;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.dal.core.OBContext;
@@ -42,8 +41,6 @@
 import org.openbravo.erpCommon.utility.FieldProviderFactory;
 import org.openbravo.erpCommon.utility.SequenceIdData;
 import org.openbravo.model.common.businesspartner.BusinessPartner;
-import org.openbravo.model.common.currency.ConversionRateDoc;
-import org.openbravo.model.common.currency.Currency;
 import org.openbravo.model.common.enterprise.AcctSchemaTableDocType;
 import 
org.openbravo.model.financialmgmt.accounting.FIN_FinancialAccountAccounting;
 import org.openbravo.model.financialmgmt.accounting.coa.AccountingCombination;
@@ -145,13 +142,12 @@
         FieldProviderFactory.setField(data[i], "cGlItemId",
             paymentDetails.get(i).getGLItem() != null ? 
paymentDetails.get(i).getGLItem().getId()
                 : "");
-        FieldProviderFactory.setField(data[i], "cInvoiceId",
-                       paymentDetails.get(i)
-                
.getFINPaymentScheduleDetailList().get(0).getInvoicePaymentSchedule() != null
-                && 
paymentDetails.get(i).getFINPaymentScheduleDetailList().get(0)
-                    .getInvoicePaymentSchedule().getInvoice() != null ? 
paymentDetails
-                
.get(i).getFINPaymentScheduleDetailList().get(0).getInvoicePaymentSchedule()
-                .getInvoice().getId(): "");
+        FieldProviderFactory.setField(data[i], "cInvoiceId", 
paymentDetails.get(i)
+            
.getFINPaymentScheduleDetailList().get(0).getInvoicePaymentSchedule() != null
+            && paymentDetails.get(i).getFINPaymentScheduleDetailList().get(0)
+                .getInvoicePaymentSchedule().getInvoice() != null ? 
paymentDetails.get(i)
+            
.getFINPaymentScheduleDetailList().get(0).getInvoicePaymentSchedule().getInvoice()
+            .getId() : "");
         // Calculate Business Partner from payment header or from details if 
header is null
         BusinessPartner bPartner = payment.getBusinessPartner() != null ? 
payment
             .getBusinessPartner() : 
(paymentDetails.get(i).getFINPaymentScheduleDetailList().get(0)
@@ -431,9 +427,9 @@
           fact.createLine(
               line,
               getAccountGLItem(OBDal.getInstance().get(GLItem.class, 
line.getCGlItemId()), as,
-                  isReceipt, conn), paymentCurrencyId, 
line.getPaymentAmount(), line
-                  .getDepositAmount(), Fact_Acct_Group_ID, nextSeqNo(SeqNo), 
DocumentType, null,
-              paymentToSchemaConversionRate, conn);
+                  isReceipt, conn), paymentCurrencyId, isReceipt ? "" : 
line.getAmount(),
+              isReceipt ? line.getAmount() : "", Fact_Acct_Group_ID, 
nextSeqNo(SeqNo),
+              DocumentType, null, paymentToSchemaConversionRate, conn);
         } else {
           fact.createLine(
               line,
@@ -458,22 +454,24 @@
       }
     } else {
       fact.createLine(
-                 null, 
-                 getAccountPayment(conn, txnFinPayment.getPaymentMethod(), 
txnFinPayment.getAccount(), as,
-                         txnFinPayment.isReceipt()), 
-                         txnFinPayment.getCurrency().getId(),
-             !txnFinPayment.isReceipt() ? txnFinPayment.getAmount().toString()
-                 : "", txnFinPayment.isReceipt() ? txnFinPayment.getAmount()
-                 .toString() : "", Fact_Acct_Group_ID, nextSeqNo(SeqNo), 
DocumentType, paymentDate,
-             docToSchemaConversionRate, EXCHANGE_DOCTYPE_Payment, 
txnFinPayment.getId(), conn);
+          null,
+          getAccountPayment(conn, txnFinPayment.getPaymentMethod(), 
txnFinPayment.getAccount(), as,
+              txnFinPayment.isReceipt()), txnFinPayment.getCurrency().getId(), 
!txnFinPayment
+              .isReceipt() ? txnFinPayment.getAmount().toString() : "",
+          txnFinPayment.isReceipt() ? txnFinPayment.getAmount().toString() : 
"",
+          Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, paymentDate,
+          docToSchemaConversionRate, EXCHANGE_DOCTYPE_Payment, 
txnFinPayment.getId(), conn);
     }
-    fact.createLine(null, getAccountUponDepositWithdrawal(conn, 
txnFinPayment.getPaymentMethod(),
-            transaction.getAccount(), as, txnFinPayment.isReceipt()), 
C_Currency_ID, 
-            transaction.getDepositAmount().toString(), 
transaction.getPaymentAmount().toString(),
-            Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, null, 
docToSchemaConversionRate, EXCHANGE_DOCTYPE_Transaction, transaction.getId(), 
conn);
-    if(!transaction.getForeignCurrency().equals(as.getC_Currency_ID())){
-       MultiCurrency=true;
-       createFactCurrencyBalancing(as, conn, fact, Fact_Acct_Group_ID, 
transaction);
+    fact.createLine(
+        null,
+        getAccountUponDepositWithdrawal(conn, txnFinPayment.getPaymentMethod(),
+            transaction.getAccount(), as, txnFinPayment.isReceipt()), 
C_Currency_ID, transaction
+            .getDepositAmount().toString(), 
transaction.getPaymentAmount().toString(),
+        Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, null, 
docToSchemaConversionRate,
+        EXCHANGE_DOCTYPE_Transaction, transaction.getId(), conn);
+    if (!transaction.getForeignCurrency().equals(as.getC_Currency_ID())) {
+      MultiCurrency = true;
+      createFactCurrencyBalancing(as, conn, fact, Fact_Acct_Group_ID, 
transaction);
     }
     SeqNo = "0";
     return fact;

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to