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

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



Revision: 5629
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5629&view=rev
Author:   einhverfr
Date:     2013-01-25 15:31:49 +0000 (Fri, 25 Jan 2013)
Log Message:
-----------
PNL reports now respect precision, as to GL reports.  Other reports need to be reviewed

Modified Paths:
--------------
    trunk/LedgerSMB/Report/GL.pm
    trunk/LedgerSMB/Report/PNL/ECA.pm
    trunk/LedgerSMB/Report/PNL/Income_Statement.pm
    trunk/LedgerSMB/Report/PNL/Invoice.pm
    trunk/LedgerSMB/Report/PNL/Product.pm
    trunk/LedgerSMB/Report/PNL.pm
    trunk/LedgerSMB/Report.pm
    trunk/css/ledgersmb.css

Modified: trunk/LedgerSMB/Report/GL.pm
===================================================================
--- trunk/LedgerSMB/Report/GL.pm	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/LedgerSMB/Report/GL.pm	2013-01-25 15:31:49 UTC (rev 5629)
@@ -107,11 +107,13 @@
     {col_id => 'debits',
        name => LedgerSMB::Report::text('Debits'),
        type => 'text',
+      money => 1,
      pwidth => '2', },
 
     {col_id => 'credits',
        name => LedgerSMB::Report::text('Credits'),
        type => 'text',
+      money => 1,
      pwidth => '2', },
 
     {col_id => 'source',
@@ -157,6 +159,7 @@
     {col_id => 'running_balance',
        name => LedgerSMB::Report::text('Balance'),
        type => 'text',
+      money => 1,
      pwidth => '3', },
     );
     my @bclasses = LedgerSMB::Business_Unit_Class->list('1', 'gl');

Modified: trunk/LedgerSMB/Report/PNL/ECA.pm
===================================================================
--- trunk/LedgerSMB/Report/PNL/ECA.pm	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/LedgerSMB/Report/PNL/ECA.pm	2013-01-25 15:31:49 UTC (rev 5629)
@@ -93,12 +93,6 @@
           ];
 }
 
-=item columns
-
-=cut
-
-sub columns { return []  }
-
 =back
 
 =head1 METHODS

Modified: trunk/LedgerSMB/Report/PNL/Income_Statement.pm
===================================================================
--- trunk/LedgerSMB/Report/PNL/Income_Statement.pm	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/LedgerSMB/Report/PNL/Income_Statement.pm	2013-01-25 15:31:49 UTC (rev 5629)
@@ -66,12 +66,6 @@
             text => LedgerSMB::Report::text('Reporting Basis') }];
 }
 
-=item columns
-
-=cut
-
-sub columns { return []  }
-
 =back
 
 =head1 METHODS

Modified: trunk/LedgerSMB/Report/PNL/Invoice.pm
===================================================================
--- trunk/LedgerSMB/Report/PNL/Invoice.pm	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/LedgerSMB/Report/PNL/Invoice.pm	2013-01-25 15:31:49 UTC (rev 5629)
@@ -90,12 +90,6 @@
     ];
 }
 
-=item columns
-
-=cut
-
-sub columns { return []  }
-
 =back
 
 =head1 METHODS

Modified: trunk/LedgerSMB/Report/PNL/Product.pm
===================================================================
--- trunk/LedgerSMB/Report/PNL/Product.pm	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/LedgerSMB/Report/PNL/Product.pm	2013-01-25 15:31:49 UTC (rev 5629)
@@ -80,12 +80,6 @@
     ];
 }
 
-=item columns
-
-=cut
-
-sub columns { return []  }
-
 =back
 
 =head1 METHODS

Modified: trunk/LedgerSMB/Report/PNL.pm
===================================================================
--- trunk/LedgerSMB/Report/PNL.pm	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/LedgerSMB/Report/PNL.pm	2013-01-25 15:31:49 UTC (rev 5629)
@@ -82,7 +82,9 @@
 
 =cut
 
-sub columns { return []  }
+sub columns { [{col_id => 'amount',
+                money => 1  }]
+}
 
 =back
 
@@ -121,9 +123,9 @@
     for my $k (keys %{$data->{E}}){
        $e_total += $data->{E}->{$k}->{$label}->{amount}; 
     }
-    $data->{totals}->{$label}->{I} = $i_total;
-    $data->{totals}->{$label}->{E} = $e_total;
-    $data->{totals}->{$label}->{total} = $i_total - $e_total;
+    $data->{totals}->{$label}->{I} = $i_total->to_output(money => 1);
+    $data->{totals}->{$label}->{E} = $e_total->to_output(money => 1);
+    $data->{totals}->{$label}->{total} = ($i_total - $e_total)->to_output(money => 1);
     $self->account_data($data);
 }
 

Modified: trunk/LedgerSMB/Report.pm
===================================================================
--- trunk/LedgerSMB/Report.pm	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/LedgerSMB/Report.pm	2013-01-25 15:31:49 UTC (rev 5629)
@@ -236,6 +236,19 @@
     $name = $name . '_' . $self->from_date->to_output if $self->{from_date};
     $name = $name . '-' . $self->to_date->to_output if $self->{to_date};
     $name = undef unless $request->{format};
+    my $columns = $self->show_cols($request);
+
+    for my $col (@$columns){
+        if ($col->{money}) {
+            $col->{class} = 'money';
+            for my $row(@{$self->rows}){
+                 if ( eval {$row->{$col->{col_id}}->can('to_output')}){
+                    $row->{$col->{col_id}} = $row->{$col->{col_id}}->to_output(money => 1);
+                 }       
+            }
+        }
+    } 
+
     $template = LedgerSMB::Template->new(
         user => $LedgerSMB::App_State::User,
         locale => $LedgerSMB::App_State::Locale,
@@ -248,7 +261,7 @@
                       request => $request,
                          name => $self->name,
                        hlines => $self->header_lines,
-                      columns => $self->show_cols($request), 
+                      columns => $columns, 
                     order_url => $self->order_url,
                       buttons => $self->buttons,
                          rows => $self->rows});

Modified: trunk/css/ledgersmb.css
===================================================================
--- trunk/css/ledgersmb.css	2013-01-25 10:23:28 UTC (rev 5628)
+++ trunk/css/ledgersmb.css	2013-01-25 15:31:49 UTC (rev 5629)
@@ -1,5 +1,8 @@
 /* stylesheet for ledger-smb */
 
+td.money {
+   text-align: right;
+}
 /* general stuff */
 A:link { text-decoration: none; }
 A:visited {text-decoration: none; }

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