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

SF.net SVN: ledger-smb:[2485] trunk



Revision: 2485
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2485&view=rev
Author:   einhverfr
Date:     2009-03-11 17:23:56 +0000 (Wed, 11 Mar 2009)

Log Message:
-----------
Reconciliation sets now update the bank total when update button pressed

Modified Paths:
--------------
    trunk/sql/modules/Reconciliaton.sql
    trunk/sql/modules/test/Reconciliation.sql
    trunk/t/43-dbtest.t

Modified: trunk/sql/modules/Reconciliaton.sql
===================================================================
--- trunk/sql/modules/Reconciliaton.sql	2009-03-11 16:25:38 UTC (rev 2484)
+++ trunk/sql/modules/Reconciliaton.sql	2009-03-11 17:23:56 UTC (rev 2485)
@@ -259,7 +259,7 @@
 that within each category, one submits in order of amount.  We should therefore
 wrap it in another function which can operate on a set.  Implementation TODO.$$;
 
-create or replace function reconciliation__pending_transactions (in_end_date DATE, in_chart_id int, in_report_id int) RETURNS int as $$
+create or replace function reconciliation__pending_transactions (in_end_date DATE, in_chart_id int, in_report_id int, in_their_total numeric) RETURNS int as $$
     
     DECLARE
         gl_row RECORD;
@@ -290,7 +290,9 @@
 			ac.memo, ac.voucher_id, gl.table
 		HAVING count(rl.id) = 0;
 
-		UPDATE cr_report set updated = now() where id = in_report_id;
+		UPDATE cr_report set updated = now(),
+			their_total = coalesce(in_their_total, their_total)
+		where id = in_report_id;
     RETURN in_report_id;
     END;
 $$ LANGUAGE plpgsql;

Modified: trunk/sql/modules/test/Reconciliation.sql
===================================================================
--- trunk/sql/modules/test/Reconciliation.sql	2009-03-11 16:25:38 UTC (rev 2484)
+++ trunk/sql/modules/test/Reconciliation.sql	2009-03-11 17:23:56 UTC (rev 2485)
@@ -12,7 +12,7 @@
 	reconciliation__new_report_id(-200, 100, now()::date) > 0;
 
 INSERT INTO test_result(test_name, success)
-SELECT 'Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -200, currval('cr_report_id_seq')::int) > 0;
+SELECT 'Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -200, currval('cr_report_id_seq')::int, 110) > 0;
 
 INSERT INTO test_result(test_name, success)
 SELECT 'Correct number of GL groups', count(*) = 4 from cr_report_line where scn like '% gl %' and report_id = currval('cr_report_id_seq')::int;
@@ -38,7 +38,7 @@
 	reconciliation__new_report_id(-201, 100, now()::date) > 0;
 
 INSERT INTO test_result(test_name, success)
-SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -201, currval('cr_report_id_seq')::int) > 0;
+SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -201, currval('cr_report_id_seq')::int, 110) > 0;
 
 INSERT INTO test_result(test_name, success)
 SELECT '1 Correct number of GL groups', count(*) = 4 from cr_report_line where scn like '% gl %' and report_id = currval('cr_report_id_seq')::int;
@@ -69,12 +69,17 @@
 	reconciliation__new_report_id(-201, 100, now()::date) > 0;
 
 INSERT INTO test_result(test_name, success)
-SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -201, currval('cr_report_id_seq')::int) > 0;
+SELECT '1 Pending Transactions Ran', reconciliation__pending_transactions(now()::date, -201, currval('cr_report_id_seq')::int, 110) > 0;
 
 
+INSERT INTO test_result(test_name, success)
 SELECT 'Report Submitted', reconciliation__submit_set(currval('cr_report_id_seq')::int, (select as_array(id::int) from cr_report_line where report_id = currval('cr_report_id_seq')::int));
 
 INSERT INTO test_result(test_name, success)
+SELECT 'Their Balance Updated', their_total = 110 
+FROM reconciliation__report_summary(currval('cr_report_id_seq')::int);
+
+INSERT INTO test_result(test_name, success)
 SELECT 'Cleared balance pre-approval is 10', reconciliation__get_cleared_balance(-201) = 10;
 
 INSERT INTO test_result(test_name, success)

Modified: trunk/t/43-dbtest.t
===================================================================
--- trunk/t/43-dbtest.t	2009-03-11 16:25:38 UTC (rev 2484)
+++ trunk/t/43-dbtest.t	2009-03-11 17:23:56 UTC (rev 2485)
@@ -5,7 +5,7 @@
 	plan skip_all => 'Skipping all.  Told not to test db.';
 }
 else {
-	plan tests => 80;
+	plan tests => 82;
 	if (defined $ENV{LSMB_NEW_DB}){
 		$ENV{PGDATABASE} = $ENV{LSMB_NEW_DB};
 	}


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