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

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



Revision: 2466
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2466&view=rev
Author:   einhverfr
Date:     2009-02-27 00:55:29 +0000 (Fri, 27 Feb 2009)

Log Message:
-----------
Adding sort capability to reconciliation reports.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject.pm
    trunk/UI/reconciliation/report.html
    trunk/scripts/recon.pl
    trunk/t/02-number-handling.t

Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm	2009-02-27 00:29:53 UTC (rev 2465)
+++ trunk/LedgerSMB/DBObject.pm	2009-02-27 00:55:29 UTC (rev 2466)
@@ -83,18 +83,13 @@
         $self->merge($base);
     }
     $self->__validate__();
+    $self->{_order_method} = {};
     return $self;
 }
 
 sub set_ordering {
-    my $self = shift  @_;
-    my %args = @_;
-
-    if (not defined $self->{_order_method}){
-        $self->{_order_method} = {};
-    }   
-
-    $self->{_order_method}->{$args{method}} = $args{column};
+    my ($self, $args) = @_;
+    $self->{_order_method}->{$args->{method}} = $args->{column};
 }
 
 sub exec_method {
@@ -142,10 +137,10 @@
         }
         for (@in_args) { push @call_args, $_ } ;
         $self->{call_args} = ..hidden..;
-        return $self->call_procedure( procname => $funcname, args => ..hidden.. );
+        return $self->call_procedure( procname => $funcname, args => ..hidden.., order_by => $self->{_order_method}->{"$funcname"} );
     }
     else {
-        return $self->call_procedure( procname => $funcname, args => ..hidden.. );
+        return $self->call_procedure( procname => $funcname, args => ..hidden.., order_by => $self->{_order_method}->{"$funcname"} );
     }
 }
 

Modified: trunk/UI/reconciliation/report.html
===================================================================
--- trunk/UI/reconciliation/report.html	2009-02-27 00:29:53 UTC (rev 2465)
+++ trunk/UI/reconciliation/report.html	2009-02-27 00:55:29 UTC (rev 2466)
@@ -137,6 +137,14 @@
 	type = "hidden",
 	value = report_id,
 } ?><?lsmb IF NOT submitted ?>
+<?lsmb INCLUDE select element_data = {
+	name = "line_order",
+	label = text('Order By'), #'
+	options = sort_options,
+	text_attr = 'label',
+	value_attr = 'id',
+	class = 'sort'
+} ?>
 <?lsmb INCLUDE button element_data = {
 	name = "action",
 	text = text('Update'),

Modified: trunk/scripts/recon.pl
===================================================================
--- trunk/scripts/recon.pl	2009-02-27 00:29:53 UTC (rev 2465)
+++ trunk/scripts/recon.pl	2009-02-27 00:55:29 UTC (rev 2466)
@@ -76,7 +76,14 @@
     my $recon = LedgerSMB::DBObject::Reconciliation->new(base => $request);
     $recon->add_entries($recon->import_file()) if !$recon->{submitted};
     $recon->{dbh}->commit;
+    if ($recon->{line_order}){
+       $recon->set_ordering(
+		{method => 'reconciliation__report_details', 
+		column  => $recon->{line_order}}
+       );
+    }
     $recon->update();
+    $recon->debug({file => '/tmp/recon'});
     _display_report($recon);
 }
 
@@ -298,6 +305,13 @@
             format=>'HTML',
             path=>"UI"
         );
+        $recon->{sort_options} = [
+		{id => 'clear_time', label => $recon->{_locale}->text('Clear date')},
+		{id => 'scn', label => $recon->{_locale}->text('Source')},
+		{id => 'post_date', label => $recon->{_locale}->text('Post Date')},
+		{id => 'our_balance', label => $recon->{_locale}->text('Our Balance')},
+		{id => 'their_balance', label => $recon->{_locale}->text('Their Balance')},
+        ];
         for my $l (@{$recon->{report_lines}}){
             $l->{their_balance} = $recon->format_amount({amount => $l->{their_balance}, money => 1});
             $l->{our_balance} = $recon->format_amount({amount => $l->{our_balance}, money => 1});

Modified: trunk/t/02-number-handling.t
===================================================================
--- trunk/t/02-number-handling.t	2009-02-27 00:29:53 UTC (rev 2465)
+++ trunk/t/02-number-handling.t	2009-02-27 00:55:29 UTC (rev 2466)
@@ -159,23 +159,23 @@
 }
 
 $expected = $form->parse_amount({'numberformat' => '1000.00'}, '0.00');
-#is($form->format_amount({'numberformat' => '1000.00'} , $expected, 2, 'x'), 'x',
-#	"form: 0.00 with dash x");
-#is($lsmb->format_amount('user' => {'numberformat' => '1000.00'}, 
-#	'amount' => $expected, 'precision' => 2, 
-#	'neg_format' => 'x'), 'x',
-#	"lsmb: 0.00 with dash x");
-#is($form->format_amount({'numberformat' => '1000.00'} , $expected, 2, ''), '',
-#	"form: 0.00 with dash ''");
-#is($lsmb->format_amount('user' => {'numberformat' => '1000.00'}, 
-#	'amount' => $expected, 'precision' => 2, 
-#	'neg_format' => ''), '',
-#	"lsmb: 0.00 with dash ''");
-#is($form->format_amount({'numberformat' => '1000.00'} , $expected, 2), '',
-#	"form: 0.00 with undef dash");
-#is($lsmb->format_amount('user' => {'numberformat' => '1000.00'}, 
-#	'amount' => $expected, 'precision' => 2), '',
-#	"lsmb: 0.00 with undef dash");
+is($form->format_amount({'numberformat' => '1000.00'} , $expected, 2, 'x'), 'x',
+	"form: 0.00 with dash x");
+is($lsmb->format_amount('user' => {'numberformat' => '1000.00'}, 
+	'amount' => $expected, 'precision' => 2, 
+	'neg_format' => 'x'), '0.00',
+	"lsmb: 0.00 with dash x");
+is($form->format_amount({'numberformat' => '1000.00'} , $expected, 2, ''), '',
+	"form: 0.00 with dash ''");
+is($lsmb->format_amount('user' => {'numberformat' => '1000.00'}, 
+	'amount' => $expected, 'precision' => 2, 
+	'neg_format' => ''), '0.00',
+	"lsmb: 0.00 with dash ''");
+is($form->format_amount({'numberformat' => '1000.00'} , $expected, 2), '',
+	"form: 0.00 with undef dash");
+is($lsmb->format_amount('user' => {'numberformat' => '1000.00'}, 
+	'amount' => $expected, 'precision' => 2), '0.00',
+	"lsmb: 0.00 with undef dash");
 $ENV{GATEWAY_INTERFACE} = 'yes';
 $form->{pre} = 'Blah';
 $form->{header} = 'Blah';


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