sales report improvements, #15393
[freeside.git] / httemplate / graph / elements / monthly.html
index a451ea8..99db31e 100644 (file)
@@ -64,6 +64,7 @@ Example:
 <%init>
 
 my(%opt) = @_;
+$opt{'debug'} ||= $cgi->param('debug');
 
 my $conf = new FS::Conf;
 my $money_char = $opt{'disable_money'} ? '' : $conf->config('money_char');
@@ -115,15 +116,27 @@ my %reportopts = (
       'doublemonths' => $opt{'doublemonths'},
 );
 
+warn Dumper({ 'REPORTOPTS' => \%reportopts }) if $opt{'debug'};
+
 my $report;
 $report = new FS::Report::Table::Daily(%reportopts) if $opt{'daily'};
 $report = new FS::Report::Table::Monthly(%reportopts) unless $opt{'daily'};
 my $data = $report->data;
 
+warn Dumper({'DATA' => $data}) if $opt{'debug'};
+
 my $col_labels = [ map { my $m = $_; $m =~ s/^(\d+)\//$mon[$1-1] / ; $m }
                              @{$data->{label}} ];
 $col_labels = $data->{label} if $opt{'daily'};
 
+if ( $opt{'remove_empty'} ) {
+  # need to filter out series labels for collapsed rows
+  $opt{'graph_labels'} = [ 
+    map { $opt{'graph_labels'}[$_] } 
+    @{ $data->{indices} }
+  ];
+}
+
 my @links;
 foreach my $link (@{ $data->{'links'} }) {
   my @speriod = @{$data->{'speriod'}};