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

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



Revision: 4738
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4738&view=rev
Author:   einhverfr
Date:     2012-05-20 14:07:20 +0000 (Sun, 20 May 2012)
Log Message:
-----------
Aging summary sproc added

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

Modified: trunk/sql/modules/Report.sql
===================================================================
--- trunk/sql/modules/Report.sql	2012-05-20 13:48:53 UTC (rev 4737)
+++ trunk/sql/modules/Report.sql	2012-05-20 14:07:20 UTC (rev 4738)
@@ -11,7 +11,8 @@
 	address1 text,
 	address2 text,
 	address3 text,
-	city_province text,
+	city text,
+        state text,
 	mail_code text,
 	country text,
 	contact_name text,
@@ -56,7 +57,7 @@
 		SELECT c.entity_id, c.meta_number, e.name,
 		       l.line_one as address1, l.line_two as address2, 
 		       l.line_three as address3,
-		       l.city_province, l.mail_code, country.name as country, 
+		       l.city, l.state, l.mail_code, country.name as country, 
 		       e.name as contact_name, 
 	               a.invnumber, a.transdate, a.till, a.ordnumber, 
 		       a.ponumber, a.notes, 
@@ -149,6 +150,22 @@
 END;
 $$ language plpgsql;
 
+CREATE OR REPLACE FUNCTION report__invoice_aging_summary
+(in_entity_id int, in_entity_class int, in_accno text, in_to_date timestamp,
+ in_business_units int[])) 
+RETURNS SETOF report_aging_item
+AS $$
+SELECT entity_id, account_number, name, address1, address2, address3, city, 
+       state, mail_code, country, contact_name, invnumber, null, null, null, 
+       null, null, sum(c0), sum(c30), sum(c60), sum(c90), null, null, curr,
+       null, null
+  FROM report__invoice_aging_summary($1, $2, $3, $4)
+ GROUP BY entity_id, account_number, name, address1, address2, address3, city, 
+       state, mail_code, country, contact_name, invnumber, curr
+ ORDER BY account_number
+$$ LANGUAGE SQL;
+
+
 DROP TYPE IF EXISTS gl_report_item CASCADE;
 
 CREATE TYPE gl_report_item AS (

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