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

SF.net SVN: ledger-smb:[2215] trunk/sql/modules/Payment.sql



Revision: 2215
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2215&view=rev
Author:   einhverfr
Date:     2008-07-18 21:36:05 +0000 (Fri, 18 Jul 2008)

Log Message:
-----------
Corrects bug:  vendor filter not applied to vouchers in same batch.

Modified Paths:
--------------
    trunk/sql/modules/Payment.sql

Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql	2008-07-14 02:27:14 UTC (rev 2214)
+++ trunk/sql/modules/Payment.sql	2008-07-18 21:36:05 UTC (rev 2215)
@@ -252,8 +252,6 @@
 			 AND p.due <> 0
 		         AND a.amount <> a.paid 
 			 AND NOT a.on_hold
-			 AND (in_meta_number IS NULL 
-				OR in_meta_number = c.meta_number)
 			 AND NOT (t.locked_by IS NOT NULL AND t.locked_by IN 
 				(select "session_id" FROM "session"
 				WHERE users_id IN 
@@ -266,9 +264,11 @@
 		                                               = in_ar_ap_accno)
 		                    ))
 		GROUP BY c.id, e.name, c.meta_number, c.threshold
-		  HAVING sum(p.due) > c.threshold
+		  HAVING (in_meta_number IS NULL 
+				OR in_meta_number = c.meta_number) AND 
+			(sum(p.due) > c.threshold
 			OR sum(case when a.batch_id = in_batch_id then 1
-                                  else 0 END) > 0
+                                  else 0 END) > 0)
 	LOOP
 		RETURN NEXT payment_item;
 	END LOOP;


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