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

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



Revision: 2726
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2726&view=rev
Author:   einhverfr
Date:     2009-07-14 23:52:46 +0000 (Tue, 14 Jul 2009)

Log Message:
-----------
End of year functions now load

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

Modified: trunk/sql/modules/EndOfYear.sql
===================================================================
--- trunk/sql/modules/EndOfYear.sql	2009-07-14 23:23:40 UTC (rev 2725)
+++ trunk/sql/modules/EndOfYear.sql	2009-07-14 23:52:46 UTC (rev 2726)
@@ -95,7 +95,7 @@
 RETURNS bool AS
 $$
 BEGIN
-	PROCESS * FROM account_checkpoint WHERE end_date = in_end_date;
+	SELECT count(*) FROM account_checkpoint WHERE end_date = in_end_date;
 
 	IF NOT FOUND THEN
 		RETURN FALSE;
@@ -103,8 +103,8 @@
 
 	DELETE FROM account_checkpoint WHERE end_date = in_end_date;
 
-	PROCESS * FROM yearend 
-	WHERE transdate = in_end_date and reversed is not true
+	SELECT count(*) FROM yearend 
+	WHERE transdate = in_end_date and reversed is not true;
 
 	IF FOUND THEN
 		INSERT INTO gl (reference, description, approved)
@@ -132,7 +132,7 @@
 (in_transdate date, in_account_id int)
 RETURNS numeric AS
 $$
-DECLARE balance numeric
+DECLARE balance numeric;
 BEGIN
 	SELECT amount INTO balance FROM account_checkpoint 
 	WHERE account_id = in_account_id AND end_date < in_trans_date
@@ -151,13 +151,13 @@
 	WHERE ac.chart_id = in_account_id AND acc_trans > cp.end_date
 		and ac.approved and a.approved;
 
-	RETURN balance
+	RETURN balance;
 END;
 $$ LANGUAGE PLPGSQL;
 
 CREATE OR REPLACE FUNCTION eoy_earnings_accounts() RETURNS setof account AS 
 $$
-SELECT id, accno, description from account 
+SELECT * FROM account
 WHERE category = 'Q'
 ORDER BY accno;
 $$ language sql;


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