diff options
author | Mark Wells <mark@freeside.biz> | 2014-10-16 16:23:11 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-10-16 16:23:11 -0700 |
commit | 98ea15536afc6896cce08a41b877d6cb52444d14 (patch) | |
tree | 55dc39e6c6fddc530adb764e3d1f4558feb2532f /httemplate/graph | |
parent | 83f29f7300305134cb0c2e680ca7346927d4e9fe (diff) |
make package churn report actually show package churn, #7990
Diffstat (limited to 'httemplate/graph')
-rw-r--r-- | httemplate/graph/cust_pkg.html (renamed from httemplate/graph/cust_pkg.cgi) | 44 | ||||
-rw-r--r-- | httemplate/graph/elements/monthly.html | 16 | ||||
-rw-r--r-- | httemplate/graph/elements/report.html | 6 | ||||
-rw-r--r-- | httemplate/graph/report_cust_pkg.html | 8 |
4 files changed, 37 insertions, 37 deletions
diff --git a/httemplate/graph/cust_pkg.cgi b/httemplate/graph/cust_pkg.html index cdd95e10a..3b6552ba8 100644 --- a/httemplate/graph/cust_pkg.cgi +++ b/httemplate/graph/cust_pkg.html @@ -7,9 +7,12 @@ 'links' => \@links, 'params' => \@params, 'agentnum' => $agentnum, - 'sprintf' => '%u', + 'sprintf' => ( $normalize ? '%0.1f%%' : '%u'), + 'normalize' => ( $normalize ? 0 : undef ), 'disable_money' => 1, 'remove_empty' => (scalar(@group_keys) > 1 ? 1 : 0), + 'nototal' => 1, + 'no_graph' => [ 1, 0, 0, 0, 0 ], # don't graph 'active' &> <%init> @@ -30,36 +33,29 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { my $agentname = $agent ? $agent->agent.' ' : ''; -my @base_items = qw( setup_pkg susp_pkg cancel_pkg ); +my @base_items = qw( active_pkg setup_pkg susp_pkg unsusp_pkg cancel_pkg ); my %base_labels = ( + 'active_pkg' => 'Active packages', 'setup_pkg' => 'New orders', 'susp_pkg' => 'Suspensions', -# 'unsusp' => 'Unsuspensions', + 'unsusp_pkg' => 'Unsuspensions', 'cancel_pkg' => 'Cancellations', ); my %base_colors = ( + 'active_pkg' => '000000', #black 'setup_pkg' => '00cc00', #green 'susp_pkg' => 'ff9900', #yellow - #'unsusp' => '', #light green? - 'cancel_pkg' => 'cc0000', #red ? 'ff0000' + 'unsusp_pkg' => '44ff44', #light green + 'cancel_pkg' => 'cc0000', #red ); -my %base_links = ( - 'setup_pkg' => { 'link' => "${p}search/cust_pkg.cgi?agentnum=$agentnum;", - 'fromparam' => 'setup_begin', - 'toparam' => 'setup_end', - }, - 'susp_pkg' => { 'link' => "${p}search/cust_pkg.cgi?agentnum=$agentnum;", - 'fromparam' => 'susp_begin', - 'toparam' => 'susp_end', - }, - 'cancel_pkg' => { 'link' => "${p}search/cust_pkg.cgi?agentnum=$agentnum;", - 'fromparam' => 'cancel_begin', - 'toparam' => 'cancel_end', - }, -); +my %base_links; +foreach my $status (qw(active setup cancel susp unsusp)) { + $base_links{$status.'_pkg'} = + "${p}search/cust_pkg_churn.html?agentnum=$agentnum;status=$status;"; +} my %filter_params = ( # not agentnum, that's elsewhere @@ -76,7 +72,7 @@ foreach my $link (values %base_links) { if (ref($value)) { $value = join(',', @$value); } - $link->{'link'} .= "$key=$value;" if length($value); + $link .= "$key=$value;" if length($value); } } @@ -143,9 +139,9 @@ if (scalar(@group_keys) > 1) { # and colors (?!) push @colors, $scheme->colorset->[$i]->[1]; # and links... - my %this_link = %{ $base_links{$_} }; - $this_link{link} .= "$breakdown=$key;"; - push @links, \%this_link; + my $this_link = $base_links{$_}; + $this_link .= "$breakdown=$key;"; + push @links, $this_link; $i++; } #foreach (@base_items $hue += 35; @@ -158,4 +154,6 @@ if (scalar(@group_keys) > 1) { @params = map { [ %filter_params ] } @base_items; } +my $normalize = $cgi->param('normalize'); + </%init> diff --git a/httemplate/graph/elements/monthly.html b/httemplate/graph/elements/monthly.html index 939f18a35..4b988f166 100644 --- a/httemplate/graph/elements/monthly.html +++ b/httemplate/graph/elements/monthly.html @@ -125,6 +125,7 @@ my %reportopts = ( 'cust_classnum'=> $opt{'cust_classnum'}, 'remove_empty' => $opt{'remove_empty'}, 'doublemonths' => $opt{'doublemonths'}, + 'normalize' => $opt{'normalize'}, ); warn Dumper({ 'REPORTOPTS' => \%reportopts }) if $opt{'debug'}; @@ -147,17 +148,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; diff --git a/httemplate/graph/elements/report.html b/httemplate/graph/elements/report.html index b3ba9ee22..cffc82816 100644 --- a/httemplate/graph/elements/report.html +++ b/httemplate/graph/elements/report.html @@ -108,11 +108,11 @@ any delimiter and linked from the elements in @data. % foreach ( @{ shift( @data ) } ) { % $total += $_; % $bottom_total[$col-1] += $_ unless $opt{no_graph}[$row]; -% $worksheet->write($row, $col++, sprintf($sprintf, $_) ); +% $worksheet->write_number($row, $col++, sprintf($sprintf, $_) ); % } % if ( !$opt{'nototal'} ) { % $bottom_total[$col-1] += $total unless $opt{no_graph}[$row]; -% $worksheet->write($row, $col++, sprintf($sprintf, $total) ); +% $worksheet->write_number($row, $col++, sprintf($sprintf, $total) ); % } % } % @@ -120,7 +120,7 @@ any delimiter and linked from the elements in @data. % if ( $opt{'bottom_total'} ) { % $row++; % $worksheet->write($row, $col++, 'Total'); -% $worksheet->write($row, $col++, sprintf($sprintf, $_)) foreach @bottom_total; +% $worksheet->write_number($row, $col++, sprintf($sprintf, $_)) foreach @bottom_total; % } % % $workbook->close();# or die "Error creating .xls file: $!"; diff --git a/httemplate/graph/report_cust_pkg.html b/httemplate/graph/report_cust_pkg.html index 1425ff089..0da5016a7 100644 --- a/httemplate/graph/report_cust_pkg.html +++ b/httemplate/graph/report_cust_pkg.html @@ -1,6 +1,6 @@ <% include('/elements/header.html', 'Package Churn Summary' ) %> -<FORM ACTION="cust_pkg.cgi" METHOD="GET"> +<FORM ACTION="cust_pkg.html" METHOD="GET"> <TABLE BGCOLOR="#cccccc" CELLSPACING=0> @@ -54,6 +54,12 @@ }, &> +<& /elements/tr-checkbox.html, + 'field' => 'normalize', + 'value' => 1, + 'label' => 'Show percentages' +&> + </TABLE> <BR><INPUT TYPE="submit" VALUE="Display"> |