[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4226] branches/1.3/sql/modules/Payment.sql



Revision: 4226
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4226&view=rev
Author:   ehuelsmann
Date:     2011-12-17 16:47:41 +0000 (Sat, 17 Dec 2011)
Log Message:
-----------
payment_post should find the old exchange rate using
the transaction date and currency. Adding currency to the JOIN.

Modified Paths:
--------------
    branches/1.3/sql/modules/Payment.sql

Modified: branches/1.3/sql/modules/Payment.sql
===================================================================
--- branches/1.3/sql/modules/Payment.sql	2011-12-17 11:22:07 UTC (rev 4225)
+++ branches/1.3/sql/modules/Payment.sql	2011-12-17 16:47:41 UTC (rev 4226)
@@ -669,12 +669,14 @@
         ELSIF (in_account_class = 2) THEN
            SELECT buy INTO old_exchangerate 
            FROM exchangerate e
-           JOIN ap a on (a.transdate = e.transdate )
+           JOIN ap a ON (a.transdate = e.transdate)
+                        AND (a.curr = e.curr)
            WHERE a.id = in_transaction_id[out_count];
         ELSE 
            SELECT sell INTO old_exchangerate 
            FROM exchangerate e
-           JOIN ar a on (a.transdate = e.transdate )
+           JOIN ar a ON (a.transdate = e.transdate)
+                        AND (a.curr = e.curr)
            WHERE a.id = in_transaction_id[out_count];
         END IF;
         -- Now we post the AP/AR transaction

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.