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

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



Revision: 5963
          http://sourceforge.net/p/ledger-smb/code/5963
Author:   ehuelsmann
Date:     2013-08-24 09:46:47 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
'Forward port' the 'select all drafts' changes made on the 1.3 branch.

Modified Paths:
--------------
    trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm
    trunk/sql/modules/Drafts.sql

Modified: trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm
===================================================================
--- trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm	2013-08-24 09:19:05 UTC (rev 5962)
+++ trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm	2013-08-24 09:46:47 UTC (rev 5963)
@@ -82,6 +82,10 @@
        name => '',
        type => 'checkbox' },
 
+    {col_id => 'class',
+       name => LedgerSMB::Report::text('Type'),
+       type => 'text'},
+
     {col_id => 'id',
        name => LedgerSMB::Report::text('ID'),
        type => 'text',
@@ -140,7 +144,7 @@
 =cut
 
 sub header_lines {
-    return [{name => 'type',
+    return [{name => 'class',
              text => LedgerSMB::Report::text('Batch Type')},
             {name => 'reference',
              text => LedgerSMB::Report::text('Reference')},
@@ -186,7 +190,7 @@
 
 =cut
 
-has 'type' => (is => 'rw', isa => 'Maybe[Str]');
+has 'class' => (is => 'rw', isa => 'Maybe[Str]');
 
 =item amount_gt
 

Modified: trunk/sql/modules/Drafts.sql
===================================================================
--- trunk/sql/modules/Drafts.sql	2013-08-24 09:19:05 UTC (rev 5962)
+++ trunk/sql/modules/Drafts.sql	2013-08-24 09:46:47 UTC (rev 5963)
@@ -8,6 +8,7 @@
         invoice bool,
 	reference text,
 	description text,
+	type text,
 	amount numeric
 );
 
@@ -19,30 +20,33 @@
 BEGIN
 	FOR out_row IN
 		SELECT trans.id, trans.transdate, trans.invoice, 
-                       trans.reference, trans.description, 
-			sum(case when lower(in_type) = 'ap' AND chart.link = 'AP'
+                       trans.reference, trans.description, trans.type,
+			sum(case when (lower(in_type) = 'ap' or in_type is null)
+                                      AND chart.link = 'AP'
 				 THEN line.amount
-				 WHEN lower(in_type) = 'ar' AND chart.link = 'AR'
+				 WHEN (lower(in_type) = 'ar' or in_type is null)
+                                      AND chart.link = 'AR'
 				 THEN line.amount * -1
-				 WHEN lower(in_type) = 'gl' AND line.amount > 0
+				 WHEN (lower(in_type) = 'gl' or in_type is null)
+                                      AND line.amount > 0
 				 THEN line.amount
 			 	 ELSE 0
 			    END) as amount
 		FROM (
 			SELECT id, transdate, reference, 
 				description, false as invoice,
-                                approved from gl
-			WHERE lower(in_type) = 'gl'
+                                approved, 'gl' as type from gl
+			WHERE lower(in_type) = 'gl' or in_type is null
 			UNION
 			SELECT id, transdate, invnumber as reference, 
 				(SELECT name FROM eca__get_entity(entity_credit_account)),
-				invoice, approved from ap
-			WHERE lower(in_type) = 'ap'
+				invoice, approved, 'ap' as type from ap
+			WHERE lower(in_type) = 'ap' or in_type is null
 			UNION
 			SELECT id, transdate, invnumber as reference,
 				description, 
-				invoice, approved from ar
-			WHERE lower(in_type) = 'ar'
+				invoice, approved, 'ar' as type from ar
+			WHERE lower(in_type) = 'ar' or in_type is null
 			) trans
 		JOIN acc_trans line ON (trans.id = line.trans_id)
 		JOIN chart ON (line.chart_id = chart.id and charttype = 'A')
@@ -53,7 +57,7 @@
 			AND trans.approved IS FALSE
 			AND v.id IS NULL
 		GROUP BY trans.id, trans.transdate, trans.description, 
-                         trans.reference, trans.invoice
+                         trans.reference, trans.invoice, trans.type
 		HAVING (in_with_accno IS NULL or in_with_accno = 
 			ANY(as_array(chart.accno)))
 		ORDER BY trans.reference

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


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits