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

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



Revision: 2659
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2659&view=rev
Author:   einhverfr
Date:     2009-06-12 17:06:04 +0000 (Fri, 12 Jun 2009)

Log Message:
-----------
Correcting missing function in chart.sql

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

Modified: trunk/sql/modules/chart.sql
===================================================================
--- trunk/sql/modules/chart.sql	2009-06-12 16:46:43 UTC (rev 2658)
+++ trunk/sql/modules/chart.sql	2009-06-12 17:06:04 UTC (rev 2659)
@@ -82,31 +82,6 @@
 END;
 $$ LANGUAGE PLPGSQL;
 
-CREATE OR REPLACE FUNCTION chart_list_cash(in_account_class int)
-RETURNS SETOF chart AS
-$$
-DECLARE resultrow record;
-        link_string text;
-BEGIN
-        IF in_account_class = 1 THEN
-           link_string := '%AP_paid%';
-        ELSE 
-           link_string := '%AR_paid%';
-        END IF;
-
-        FOR resultrow IN
-          SELECT *  FROM chart
-          WHERE link LIKE link_string
-          ORDER BY accno
-          LOOP
-          return next resultrow;
-        END LOOP;
-END;
-$$ language plpgsql;
-
-COMMENT ON FUNCTION chart_list_cash(in_account_class int) IS
-$$ This function returns the cash account acording with in_account_class which must be 1 or 2 $$;
-
 CREATE OR REPLACE FUNCTION chart_get_ar_ap(in_account_class int)
 RETURNS SETOF chart AS
 $$
@@ -128,6 +103,19 @@
 COMMENT ON FUNCTION chart_get_ar_ap(in_account_class int) IS
 $$ This function returns the cash account acording with in_account_class which must be 1 or 2 $$;
 
+CREATE OR REPLACE FUNCTION chart_list_search(search text)
+RETURNS SETOF chart AS
+$$
+DECLARE out_row chart%ROWTYPE;
+BEGIN
+	FOR out_row IN 
+		SELECT * FROM chart WHERE accno ~* ('^'||search) OR description ~* ('^'||search) ORDER BY accno
+	LOOP
+		RETURN next out_row;
+	END LOOP;
+END;$$
+LANGUAGE 'plpgsql';
+							
 
 CREATE OR REPLACE FUNCTION chart_list_overpayment(in_account_class int)
 RETURNS SETOF chart AS


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