RT# 78019 - Added total revenue line to Package churn report
[freeside.git] / httemplate / graph / elements / monthly.html
index c736de6..cfe5a3c 100644 (file)
@@ -27,7 +27,7 @@ Example:
     'start_year'      => $syear,
     'end_month'       => $emonth,
     'end_year'        => $eyear,
-
+    '12mo'            => 0,
 
     #optional, pulled from CGI params if not specified, 
     #only if 'daily' option is given
@@ -37,6 +37,7 @@ Example:
     #optional
     'agentnum'        => $agentnum,
     'refnum'          => $refnum,
+    'cust_classnum'   => \@classnums,
     'nototal'         => 1,
     'graph_type'      => 'LinesPoints',
     'remove_empty'    => 1,
@@ -58,6 +59,7 @@ Example:
             'no_graph'      => \@no_graph,
             'bottom_link'   => \@bottom_link,
             'transpose'     => $opt{'daily'},
+            'sprintf_fields' => $sprintf_fields,
             map { $_, $opt{$_} } (qw(title
                                     nototal
                                     graph_type
@@ -78,6 +80,7 @@ my $fromparam = $opt{'link_fromparam'} || 'begin';
 my $toparam   = $opt{'link_toparam'} || 'end';
 
 my @items = @{ $opt{'items'} };
+my $sprintf_fields = $opt{'sprintf_fields'};
 
 foreach my $other (qw( labels graph_labels colors links )) {
   if ( ref($opt{$other}) eq 'HASH' ) {
@@ -95,6 +98,8 @@ $opt{'start_year'}  ||= $cgi->param('start_year'); # || 1899+$curyear;
 $opt{'end_month'} ||= $cgi->param('end_month'); # || $curmon+1;
 $opt{'end_year'}  ||= $cgi->param('end_year'); # || 1900+$curyear;
 
+$opt{'12mo'} ||= $cgi->param('12mo') ? 1 : 0;
+
 $opt{'projection'} ||= $cgi->param('projection') ? 1 : 0;
 
 if ( $opt{'daily'} ) { # daily granularity
@@ -118,11 +123,14 @@ my %reportopts = (
       'end_day'      => $opt{'end_day'},
       'end_month'    => $opt{'end_month'},
       'end_year'     => $opt{'end_year'},
+      '12mo'         => $opt{'12mo'},
       'projection'   => $opt{'projection'},
       'agentnum'     => $opt{'agentnum'},
       'refnum'       => $opt{'refnum'},
+      'cust_classnum'=> $opt{'cust_classnum'},
       'remove_empty' => $opt{'remove_empty'},
       'doublemonths' => $opt{'doublemonths'},
+      'normalize'    => $opt{'normalize'},
 );
 
 warn Dumper({ 'REPORTOPTS' => \%reportopts }) if $opt{'debug'};
@@ -145,17 +153,12 @@ $col_labels = $data->{label} if $opt{'daily'};
 my @colors;
 my @graph_labels;
 my @no_graph;
-if ( $opt{'remove_empty'} ) {
+#if ( $opt{'remove_empty'} ) { # no, always do this
   # then filter out per-item things for collapsed rows
-  foreach my $i (@{ $data->{'indices'} }) {
-    push @colors,       $opt{'colors'}[$i];
-    push @graph_labels, $opt{'graph_labels'}[$i];
-    push @no_graph,     $opt{'no_graph'}[$i];
-  }
-} else {
-  @colors       = @{ $opt{'colors'} };
-  @graph_labels = @{ $opt{'graph_labels'} };
-  @no_graph     = @{ $opt{'no_graph'} || [] };
+foreach my $i (@{ $data->{'indices'} }) {
+  push @colors,       $opt{'colors'}[$i];
+  push @graph_labels, $opt{'graph_labels'}[$i];
+  push @no_graph,     $opt{'no_graph'}[$i];
 }
 
 my @links;