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

SF.net SVN: ledger-smb:[6795] trunk/LedgerSMB



Revision: 6795
          http://sourceforge.net/p/ledger-smb/code/6795
Author:   einhverfr
Date:     2014-02-07 07:13:49 +0000 (Fri, 07 Feb 2014)
Log Message:
-----------
Fixing 1035, meaningless total of balance being displayed

Modified Paths:
--------------
    trunk/LedgerSMB/Report/GL.pm
    trunk/LedgerSMB/Report.pm

Modified: trunk/LedgerSMB/Report/GL.pm
===================================================================
--- trunk/LedgerSMB/Report/GL.pm	2014-02-07 06:16:12 UTC (rev 6794)
+++ trunk/LedgerSMB/Report/GL.pm	2014-02-07 07:13:49 UTC (rev 6795)
@@ -341,6 +341,10 @@
 
 =cut
 
+sub _exclude_from_totals {
+    return {running_balance => 1};
+}
+
 sub run_report{
     my ($self) = @_;
     my $accno = $self->accno;

Modified: trunk/LedgerSMB/Report.pm
===================================================================
--- trunk/LedgerSMB/Report.pm	2014-02-07 06:16:12 UTC (rev 6794)
+++ trunk/LedgerSMB/Report.pm	2014-02-07 07:13:49 UTC (rev 6795)
@@ -176,6 +176,21 @@
     return [];
 }
 
+=item _exclude_from_totals 
+
+Returns a hashref with the keys pointing to true values for column id's that 
+should not appear on the total row.
+
+This is useful in avoiding a running total column from being added together and
+a meaningless sum displayed on the totals row.
+
+=cut
+
+sub _exclude_from_totals {
+    return {};
+}
+
+
 =item render
 
 This takes no arguments and simply renders the report as is.
@@ -221,8 +236,10 @@
     my $col_val = undef;
     my $old_subtotal = {};
     my @newrows;
+    my $exclude = $self->_exclude_from_totals;
     for my $r (@{$self->rows}){
         for my $k (keys %$r){
+            next if $exclude->{$k};
             if (eval { $r->{$k}->isa('LedgerSMB::PGNumber') }){
                 $total_row->{$k} ||= LedgerSMB::PGNumber->from_input('0');
                 $total_row->{$k}->badd($r->{$k});

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


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits