diff options
author | Mark Wells <mark@freeside.biz> | 2015-07-06 14:30:10 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-07-06 14:33:16 -0700 |
commit | 6400a0ec71fc47b217f4ab12bf95b74b77aeb260 (patch) | |
tree | bb5909782b011df6e06db4d189836d01547d2289 /FS | |
parent | a2cbe65edb241a8ba31b82af239f1bfc5070b8ca (diff) |
optionally include discounts in daily cashflow report, #37123
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Report/Table/Daily.pm | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/FS/FS/Report/Table/Daily.pm b/FS/FS/Report/Table/Daily.pm index 66739379d..8d623e766 100644 --- a/FS/FS/Report/Table/Daily.pm +++ b/FS/FS/Report/Table/Daily.pm @@ -121,16 +121,20 @@ sub data { my @newdata = (); my @newcolors = (); my @newlinks = (); + my @indices = (); foreach my $item ( @{$self->{'items'}} ) { - if ( grep { $_ != 0 } @{$data{'data'}->[$col]} ) { - push @newitems, $data{'items'}->[$col]; - push @newlabels, $data{'item_labels'}->[$col]; - push @newdata, $data{'data'}->[$col]; - push @newcolors, $data{'colors'}->[$col]; - push @newlinks, $data{'links'}->[$col]; - } - + my $is_nonzero = scalar( grep { $_ != 0 } @{ $data{'data'}->[$col] }); + next if ($self->{'remove_empty'} and $is_nonzero == 0); + # no daily reports can normalize yet + push @newitems, $data{'items'}->[$col]; + push @newlabels, $data{'item_labels'}->[$col]; + push @newdata, $data{'data'}->[$col]; + push @newcolors, $data{'colors'}->[$col]; + push @newlinks, $data{'links'}->[$col]; + push @indices, $col; + + } continue { $col++; } @@ -139,7 +143,10 @@ sub data { $data{'data'} = \@newdata; $data{'colors'} = \@newcolors; $data{'links'} = \@newlinks; + $data{'indices'} = \@indices; + } else { # not doing remove_empty; report back that all columns are included + $data{'indices'} = [ 0 .. scalar( @{$self->{'items'}} ) - 1 ]; } \%data; |