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

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



Revision: 4290
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4290&view=rev
Author:   einhverfr
Date:     2012-02-07 06:28:15 +0000 (Tue, 07 Feb 2012)
Log Message:
-----------
Correcting Payment.sql load errors

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

Modified: branches/1.3/sql/modules/Payment.sql
===================================================================
--- branches/1.3/sql/modules/Payment.sql	2012-02-07 06:06:05 UTC (rev 4289)
+++ branches/1.3/sql/modules/Payment.sql	2012-02-07 06:28:15 UTC (rev 4290)
@@ -1087,9 +1087,7 @@
         SELECT * INTO t_exchangerate FROM currency_get_exchangerate(
               in_currency, in_date_reversed, in_account_class);
 
-        SELECT
-
-        IF (in_currency IS NULL OR in_currency = t_currs[0]) THEN
+        IF in_currency IS NULL OR in_currency = t_currs[0] THEN
                 t_exchangerate := 1;
         ELSIF t_exchangerate IS NULL THEN
                 t_exchangerate := in_exchangerate;
@@ -1113,12 +1111,14 @@
 		SELECT a.*, c.ar_ap_account_id
 		FROM acc_trans a
 		JOIN (select id, curr, entity_credit_account, buy as fxrate
-			FROM ar WHERE in_account_class = 2
+			FROM ar 
                         JOIN exchangerate USING (transdate, curr)
+                       WHERE in_account_class = 2
 			UNION
 			SELECT id, curr, entity_credit_account, sell as fxrate
-			FROM ap WHERE in_account_class = 1
+			FROM ap
                         JOIN exchangerate USING (transdate, curr)
+                       WHERE in_account_class = 1
 		) arap ON (a.trans_id = arap.id)
 		JOIN entity_credit_account c 
 			ON (arap.entity_credit_account = c.id)
@@ -1176,7 +1176,7 @@
 COMMENT ON FUNCTION payment__reverse
 (in_source text, in_date_paid date, in_credit_id int, in_cash_accno text,
         in_date_reversed date, in_account_class int, in_batch_id int,
-        in_voucher_id int) IS $$
+        in_voucher_id int, in_exchangerate numeric) IS $$
 Reverses a payment.  All fields are mandatory except batch_id and voucher_id
 because they determine the identity of the payment to be reversed.
 $$;

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