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

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



Revision: 2527
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2527&view=rev
Author:   einhverfr
Date:     2009-03-23 23:21:15 +0000 (Mon, 23 Mar 2009)

Log Message:
-----------
Ordering stuff added to UI for drafts and batches

Modified Paths:
--------------
    trunk/scripts/drafts.pl
    trunk/scripts/vouchers.pl
    trunk/sql/modules/Drafts.sql
    trunk/sql/modules/Voucher.sql

Modified: trunk/scripts/drafts.pl
===================================================================
--- trunk/scripts/drafts.pl	2009-03-23 21:55:05 UTC (rev 2526)
+++ trunk/scripts/drafts.pl	2009-03-23 23:21:15 UTC (rev 2527)
@@ -56,6 +56,12 @@
             $callback .= "&$_=$draft->{$_}";
         }
     }
+    if ($draft->{order_by}){
+        $draft->set_ordering(
+		{method => 'draft__search', 
+		 column => $draft->{order_by}}
+        );
+    }
     my @search_results = $draft->search;
     $draft->{script} = "drafts.pl";
     $draft->{callback} = $draft->escape(string => $callback);
@@ -63,20 +69,20 @@
         qw(select id transdate reference description amount);
 
     my $base_href = "drafts.pl";
-    my $search_href = "$base_href?action=list_transactions";
+    my $search_href = "$base_href?action=list_drafts";
     my $draft_href= "$base_href?action=get_transaction";
 
     for my $key (
-       qw(class_id approved created_by description amount_gt amount_lt)
+       qw(type approved created_by description amount_gt amount_lt)
     ){
-       $search_href .= "&$key=$draft->{key}";
+       $search_href .= "&$key=$draft->{$key}";
     }
 
     my %column_heading = (
         'select'          => $draft->{_locale}->text('Select'),
         amount => {
              text => $draft->{_locale}->text('AR/AP/GL Total'),
-             href => "$search_href&order_by=transaction_total"
+             href => "$search_href&order_by=amount"
         },
         description       => {
              text => $draft->{_locale}->text('Description'),

Modified: trunk/scripts/vouchers.pl
===================================================================
--- trunk/scripts/vouchers.pl	2009-03-23 21:55:05 UTC (rev 2526)
+++ trunk/scripts/vouchers.pl	2009-03-23 23:21:15 UTC (rev 2527)
@@ -162,6 +162,12 @@
 sub list_batches {
     my ($request) = @_;
     my $batch = LedgerSMB::Batch->new(base => $request);
+    if ($batch->{order_by}){
+        $batch->set_ordering(
+		{method => 'batch_search', 
+		 column => $batch->{order_by}}
+        );
+    }
     my @search_results = $batch->get_search_results({custom_types => $custom_batch_types});
     $batch->{script} = "vouchers.pl";
 
@@ -175,7 +181,7 @@
     for my $key (
        qw(class_id approved created_by description amount_gt amount_lt)
     ){
-       $search_href .= "&$key=$batch->{key}";
+       $search_href .= "&$key=$batch->{$key}";
     }
 
     my %column_heading = (
@@ -198,7 +204,7 @@
         },
         id                => {
              text => $batch->{_locale}->text('ID'),
-             href => "$search_href&order_by=control_code"
+             href => "$search_href&order_by=id"
         },
     );
     my $count = 0;

Modified: trunk/sql/modules/Drafts.sql
===================================================================
--- trunk/sql/modules/Drafts.sql	2009-03-23 21:55:05 UTC (rev 2526)
+++ trunk/sql/modules/Drafts.sql	2009-03-23 23:21:15 UTC (rev 2527)
@@ -48,6 +48,7 @@
 		GROUP BY trans.id, trans.transdate, trans.description, trans.reference
 		HAVING (in_with_accno IS NULL or in_with_accno = 
 			ANY(as_array(chart.accno)))
+		ORDER BY trans.reference
 	LOOP
 		RETURN NEXT out_row;
 	END LOOP;

Modified: trunk/sql/modules/Voucher.sql
===================================================================
--- trunk/sql/modules/Voucher.sql	2009-03-23 21:55:05 UTC (rev 2526)
+++ trunk/sql/modules/Voucher.sql	2009-03-23 23:21:15 UTC (rev 2527)
@@ -213,6 +213,7 @@
 			sum(coalesce(ar.amount - ar.paid, ap.amount - ap.paid, 
 				al.amount))
 			<= in_amount_lt)
+		ORDER BY b.control_code, b.description
 		
 	LOOP
 		RETURN NEXT out_value;


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