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

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



Revision: 2416
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2416&view=rev
Author:   einhverfr
Date:     2008-11-22 22:59:56 +0000 (Sat, 22 Nov 2008)

Log Message:
-----------
Correcting bad join which caused payable batches not to show up in batch details

Modified Paths:
--------------
    trunk/sql/modules/Voucher.sql
    trunk/sql/modules/test/Voucher.sql

Modified: trunk/sql/modules/Voucher.sql
===================================================================
--- trunk/sql/modules/Voucher.sql	2008-11-22 22:22:57 UTC (rev 2415)
+++ trunk/sql/modules/Voucher.sql	2008-11-22 22:59:56 UTC (rev 2416)
@@ -57,7 +57,9 @@
 			a.amount, a.transdate, 'Payable'
 		FROM voucher v
 		JOIN ap a ON (v.trans_id = a.id)
-		JOIN entity e ON (a.entity_id = e.id)
+		JOIN entity_credit_account eca 
+			ON (eca.id = a.entity_credit_account)
+		JOIN entity e ON (eca.entity_id = e.id)
 		WHERE v.batch_id = in_batch_id 
 			AND v.batch_class = (select id from batch_class 
 					WHERE class = 'ap')
@@ -67,7 +69,9 @@
 			a.amount, a.transdate, 'Receivable'
 		FROM voucher v
 		JOIN ar a ON (v.trans_id = a.id)
-		JOIN entity e ON (a.entity_id = e.id)
+		JOIN entity_credit_account eca 
+			ON (eca.id = a.entity_credit_account)
+		JOIN entity e ON (eca.entity_id = e.id)
 		WHERE v.batch_id = in_batch_id 
 			AND v.batch_class = (select id from batch_class 
 					WHERE class = 'ar')

Modified: trunk/sql/modules/test/Voucher.sql
===================================================================
--- trunk/sql/modules/test/Voucher.sql	2008-11-22 22:22:57 UTC (rev 2415)
+++ trunk/sql/modules/test/Voucher.sql	2008-11-22 22:59:56 UTC (rev 2416)
@@ -26,6 +26,9 @@
 INSERT INTO voucher (trans_id, batch_id, batch_class)
 values (-5, currval('batch_id_seq'), 3);
 
+INSERT INTO test_result(test_name, success)
+select 'Voucher Seach finds Payable Vouchers',  count(*)=1 
+from voucher_list( currval('batch_id_seq')::int);
 
 INSERT INTO test_result (test_name, success)
 SELECT 'partial payment support', count(*) > 1 


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