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

SF.net SVN: ledger-smb:[5961] branches/1.3



Revision: 5961
          http://sourceforge.net/p/ledger-smb/code/5961
Author:   ehuelsmann
Date:     2013-08-23 23:03:41 +0000 (Fri, 23 Aug 2013)
Log Message:
-----------
Allow selection of multiple draft transaction types.

Modified Paths:
--------------
    branches/1.3/scripts/drafts.pl
    branches/1.3/sql/modules/Drafts.sql
    branches/1.3/sql/modules/Fixes.sql

Modified: branches/1.3/scripts/drafts.pl
===================================================================
--- branches/1.3/scripts/drafts.pl	2013-08-23 22:18:57 UTC (rev 5960)
+++ branches/1.3/scripts/drafts.pl	2013-08-23 23:03:41 UTC (rev 5961)
@@ -164,7 +164,7 @@
     $draft->{script} = "drafts.pl";
     $draft->{callback} = $draft->escape(string => $callback);
     my @columns = 
-        qw(select id transdate reference description amount);
+        qw(select type id transdate reference description amount);
 
     my $base_href = "drafts.pl";
     my $search_href = "$base_href?action=list_drafts";
@@ -178,6 +178,7 @@
 
     my $column_names = {
         'select' => 'Select',
+         type => 'Type',
          amount =>  'AR/AP/GL Total',
          description => 'Description',
          id => 'ID',
@@ -186,7 +187,13 @@
     };
     my $sort_href = "$search_href&order_by";
     my @sort_columns = qw(id transdate reference description amount);
-    
+
+    my %type_descriptions = (
+        'ar' => $request->{_locale}->text('AR'),
+        'ap' => $request->{_locale}->text('AP'),
+        'gl' => $request->{_locale}->text('GL')
+    );
+
     my $count = 0;
     my @rows;
     for my $result (@search_results){
@@ -200,9 +207,10 @@
                                            name  => "draft_$result->{id}"
                                  }
             },
+            type => $type_descriptions{$result->{type}},
             amount => $draft->format_amount(
-                                     amount => $result->{amount}
-				),
+                amount => $result->{amount}
+                ),
             reference => { 
                   text => $result->{reference},
                   href => "$request->{type}.pl?action=edit&id=$result->{id}" .

Modified: branches/1.3/sql/modules/Drafts.sql
===================================================================
--- branches/1.3/sql/modules/Drafts.sql	2013-08-23 22:18:57 UTC (rev 5960)
+++ branches/1.3/sql/modules/Drafts.sql	2013-08-23 23:03:41 UTC (rev 5961)
@@ -14,30 +14,33 @@
 BEGIN
 	FOR out_row IN
 		SELECT trans.id, trans.transdate, trans.reference, 
-			trans.description, 
-			sum(case when lower(in_type) = 'ap' AND chart.link = 'AP'
+			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,
-                                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)),
-				approved from ap
-			WHERE lower(in_type) = 'ap'
+				approved, 'ap' as type from ap
+			WHERE lower(in_type) = 'ap' or in_type is null
 			UNION
 			SELECT id, transdate, invnumber as reference,
 				description, 
-				approved from ar
-			WHERE lower(in_type) = 'ar'
+				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')
@@ -47,7 +50,8 @@
 				or trans.transdate <= in_to_date)
 			AND trans.approved IS FALSE
 			AND v.id IS NULL
-		GROUP BY trans.id, trans.transdate, trans.description, trans.reference
+		GROUP BY trans.id, trans.transdate, trans.description, trans.reference,
+                         trans.type
 		HAVING (in_with_accno IS NULL or in_with_accno = 
 			ANY(as_array(chart.accno)))
 		ORDER BY trans.reference

Modified: branches/1.3/sql/modules/Fixes.sql
===================================================================
--- branches/1.3/sql/modules/Fixes.sql	2013-08-23 22:18:57 UTC (rev 5960)
+++ branches/1.3/sql/modules/Fixes.sql	2013-08-23 23:03:41 UTC (rev 5961)
@@ -528,3 +528,5 @@
 ALTER FUNCTION admin__save_user(int, int, text, text, bool) SET datestyle = 'ISO,YMD';
 ALTER FUNCTION user__change_password(text) SET datestyle = 'ISO,YMD';
 COMMIT;
+
+DROP TYPE draft_search_result CASCADE;
\ No newline at end of file

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