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

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



Revision: 2491
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2491&view=rev
Author:   einhverfr
Date:     2009-03-13 01:02:09 +0000 (Fri, 13 Mar 2009)

Log Message:
-----------
Ordering changes are now complete

Modified Paths:
--------------
    trunk/UI/reconciliation/search.html
    trunk/scripts/recon.pl
    trunk/sql/modules/Reconciliaton.sql

Modified: trunk/UI/reconciliation/search.html
===================================================================
--- trunk/UI/reconciliation/search.html	2009-03-12 21:15:44 UTC (rev 2490)
+++ trunk/UI/reconciliation/search.html	2009-03-13 01:02:09 UTC (rev 2491)
@@ -46,6 +46,7 @@
 		<?lsmb INCLUDE select element_data = {
 			label = text('Account:'),
 			class = "chart_id",
+                        name = "chart_id",
 			options = account_list,
 			text_attr = 'name',
 			value_attr = 'id'

Modified: trunk/scripts/recon.pl
===================================================================
--- trunk/scripts/recon.pl	2009-03-12 21:15:44 UTC (rev 2490)
+++ trunk/scripts/recon.pl	2009-03-13 01:02:09 UTC (rev 2491)
@@ -123,6 +123,12 @@
 		$request->{submitted} = undef;
         }
         my $search = LedgerSMB::DBObject::Reconciliation->new(base => $request, copy => 'all');
+        if ($search->{order_by}){
+            $search->set_ordering({
+			method => 'reconciliation__search', 
+			column => $search->{order_by},
+            });
+        }
         my @results = $search->search();
         my @accounts = $search->get_accounts();
         my $act_hash = {};
@@ -133,15 +139,41 @@
             $row->{account} = $act_hash->{"$row->{chart_id}"};
         }
         my $base_url = "recon.pl?action=update_recon_set";
+        my $search_url = "recon.pl?action=get_results".
+            "&date_from=$search->{date_from}&date_to=$search->{date_to}".
+             "&amount_from=$search->{amount_from}&".
+             "amount_to=$search->{amount_to}&chart_id=$search->{chart_id}".
+             "&approved=$search->{approved}&submitted=$search->{submitted}";
         $columns = {
             "select"         => $request->{_locale}->text('Select'),	
-            account          => $request->{_locale}->text('Account'),	
-            their_total      => $request->{_locale}->text('Balance'),
-            end_date         => $request->{_locale}->text('Statement Date'),
-            submitted        => $request->{_locale}->text('Submitted'),
-            approved         => $request->{_locale}->text('Approved'), 
-            updated          => $request->{_locale}->text('Last Updated'), 
-            entered_username => $request->{_locale}->text('Username'), 
+            account          => {
+		text => $request->{_locale}->text('Account'),	
+		href => $search_url,
+	    },
+            their_total      => {
+                text => $request->{_locale}->text('Balance'),
+                href => "$search_url&order_by=their_total",
+            },
+            end_date         => {
+                text => $request->{_locale}->text('Statement Date'),
+                href => "$search_url&order_by=end_date",
+            },
+            submitted        => {
+		text => $request->{_locale}->text('Submitted'),
+                href => "$search_url&order_by=submitted",
+            },
+            approved         => {
+		text => $request->{_locale}->text('Approved'), 
+		href => "$search_url&order_by=approved",
+            },
+            updated          => {
+		text => $request->{_locale}->text('Last Updated'), 
+		href => "$search_url&order_by=updated",
+            },
+            entered_username => {
+		text => $request->{_locale}->text('Username'), 
+		href => "$search_url&order_by=entered_username",
+            },
         };
 	my $cols = [];
 	my @acts = $search->get_accounts;

Modified: trunk/sql/modules/Reconciliaton.sql
===================================================================
--- trunk/sql/modules/Reconciliaton.sql	2009-03-12 21:15:44 UTC (rev 2490)
+++ trunk/sql/modules/Reconciliaton.sql	2009-03-13 01:02:09 UTC (rev 2491)
@@ -355,7 +355,8 @@
 DECLARE report cr_report;
 BEGIN
 	FOR report IN
-		SELECT * FROM cr_report
+		SELECT r.* FROM cr_report r
+		JOIN chart c ON (r.chart_id = c.id)
 		WHERE 
 			(in_date_from IS NULL OR in_date_from <= end_date) and
 			(in_date_to IS NULL OR in_date_to >= end_date) AND
@@ -366,7 +367,7 @@
 			(in_chart_id IS NULL OR in_chart_id = chart_id) AND
 			(in_submitted IS NULL or in_submitted = submitted) AND
 			(in_approved IS NULL OR in_approved = approved)
-		ORDER BY end_date, their_total
+		ORDER BY c.accno, end_date, their_total
 	LOOP
 		RETURN NEXT report;
 	END LOOP; 


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