details:   http://code.openbravo.com/erp/devel/pi/rev/786b89452eb1
changeset: 4312:786b89452eb1
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Fri Jul 10 21:36:24 2009 +0200
summary:   Fixes bug 0009626: Conversion rate is not applied to witholding when 
posting cancelled payment from bank statement

diffstat:

 src/org/openbravo/erpCommon/ad_forms/DocLinePayment_data.xsql |   2 +-
 src/org/openbravo/erpCommon/ad_forms/DocPayment.java          |  27 
+++++++------
 2 files changed, 15 insertions(+), 14 deletions(-)

diffs (121 lines):

diff -r 47fb0e8ab60b -r 786b89452eb1 
src/org/openbravo/erpCommon/ad_forms/DocLinePayment_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/DocLinePayment_data.xsql     Fri Jul 
10 19:46:07 2009 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLinePayment_data.xsql     Fri Jul 
10 21:36:24 2009 +0200
@@ -26,7 +26,7 @@
       SELECT  DP.ISMANUAL, DP.ISRECEIPT,DP.AD_ORG_ID, DP.C_BPARTNER_ID, 
DP.DESCRIPTION, DP.C_DEBT_PAYMENT_ID,
       DP.AMOUNT, DP.WRITEOFFAMT, DP.ISPAID, DP.C_SETTLEMENT_CANCEL_ID, 
DP.C_SETTLEMENT_GENERATE_ID, DP.C_PROJECT_ID,
       '' AS DEBIT_ACCT, '' AS CREDIT_ACCT, '' AS C_GLITEM_ID, ISDIRECTPOSTING, 
DP.WithHoldingAmount,DP.C_INVOICE_ID,
-      CASE WHEN DP.C_SETTLEMENT_CANCEL_ID = ST.C_SETTLEMENT_ID AND DP.ISPAID = 
'Y' THEN C_WITHHOLDING_ID ELSE NULL END AS WITHHOLDING,
+      CASE WHEN DP.C_SETTLEMENT_CANCEL_ID = ST.C_SETTLEMENT_ID AND DP.ISPAID = 
'Y' THEN C_WITHHOLDING_ID ELSE NULL END AS C_WITHHOLDING_ID,
                        TRUNC(COALESCE((SELECT O.DATEACCT
                                          FROM C_ORDER O
                                                                WHERE 
DP.C_ORDER_ID = O.C_ORDER_ID),
diff -r 47fb0e8ab60b -r 786b89452eb1 
src/org/openbravo/erpCommon/ad_forms/DocPayment.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocPayment.java      Fri Jul 10 
19:46:07 2009 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocPayment.java      Fri Jul 10 
21:36:24 2009 +0200
@@ -40,7 +40,7 @@
 
   /**
    * Constructor
-   * 
+   *
    * @param AD_Client_ID
    *          AD_Client_ID
    */
@@ -55,7 +55,7 @@
 
   /**
    * Load Specific Document Details
-   * 
+   *
    * @return true if loadDocumentType was set
    */
   public boolean loadDocumentDetails(FieldProvider[] data, ConnectionProvider 
conn) {
@@ -71,7 +71,7 @@
 
   /**
    * Load Payment Line. Settlement Cancel
-   * 
+   *
    * @return DocLine Array
    */
   private DocLine[] loadLines(ConnectionProvider conn) {
@@ -124,7 +124,7 @@
 
   /**
    * Get Source Currency Balance - always zero
-   * 
+   *
    * @return Zero (always balanced)
    */
   public BigDecimal getBalance() {
@@ -134,9 +134,9 @@
 
   /**
    * Create Facts (the accounting logic) for STT, APP.
-   * 
+   *
    * <pre>
-   * 
+   *
    *  Flow:
    *    1. Currency conversion variations
    *    2. Non manual DPs in settlement
@@ -147,9 +147,9 @@
    *    4. Conceptos contables (manual sett and cancelation DP)
    *    5. Writeoff
    *    6. Bank in transit
-   * 
+   *
    * </pre>
-   * 
+   *
    * @param as
    *          accounting schema
    * @return Fact
@@ -311,7 +311,8 @@
         String IdAccount = WithholdingManualData.select_accounts(conn, 
line.C_WITHHOLDING_ID,
             idSchema);
         //
-        String sWithHoldAmt = line.WithHoldAmt;
+        String sWithHoldAmt = getConvertedAmt(line.WithHoldAmt, 
line.C_Currency_ID_From,
+                C_Currency_ID, DateAcct, "", AD_Client_ID, AD_Org_ID, conn);
 
         fact.createLine(line, Account.getAccount(conn, IdAccount), 
C_Currency_ID, (line.isReceipt
             .equals("Y") ? sWithHoldAmt : ""), (line.isReceipt.equals("Y") ? 
"" : sWithHoldAmt),
@@ -452,7 +453,7 @@
 
   /**
    * Get the account for Accounting Schema
-   * 
+   *
    * @param cBPartnerId
    *          business partner id
    * @param as
@@ -499,7 +500,7 @@
 
   /**
    * Get the account for Accounting Schema
-   * 
+   *
    * @param strcBankstatementlineId
    *          Line
    * @param as
@@ -539,7 +540,7 @@
 
   /**
    * Get the account for Accounting Schema
-   * 
+   *
    * @param strcCashlineId
    *          Line Id
    * @param as
@@ -588,7 +589,7 @@
 
   /**
    * Get Document Confirmation
-   * 
+   *
    * not used
    */
   public boolean getDocumentConfirmation(ConnectionProvider conn, String 
strRecordId) {

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to