summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-10-17 09:41:12 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-10-17 09:48:29 -0400
commitf654e068b6e7be55bdbd749293c1bda7737cf870 (patch)
tree843df1771e186692b7b6db0b60d55bbcbcb60526 /httemplate
parent5dabafc5e63ae7559ca6d2867e653660b981e639 (diff)
RT# 78019 - Added total revenue line to Package churn report
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/graph/cust_pkg.html13
-rw-r--r--httemplate/graph/elements/monthly.html2
-rw-r--r--httemplate/graph/elements/report.html3
3 files changed, 14 insertions, 4 deletions
diff --git a/httemplate/graph/cust_pkg.html b/httemplate/graph/cust_pkg.html
index 3b6552ba8..68c5b2136 100644
--- a/httemplate/graph/cust_pkg.html
+++ b/httemplate/graph/cust_pkg.html
@@ -7,12 +7,13 @@
'links' => \@links,
'params' => \@params,
'agentnum' => $agentnum,
- 'sprintf' => ( $normalize ? '%0.1f%%' : '%u'),
+ 'sprintf' => ( $normalize ? '%0.1f%%' : '%u'),
+ 'sprintf_fields' => $sprintf_fields,
'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'
+ 'no_graph' => [ 1, 0, 0, 0, 0, 1 ], # don't graph 'active, total_revenue'
&>
<%init>
@@ -33,7 +34,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
my $agentname = $agent ? $agent->agent.' ' : '';
-my @base_items = qw( active_pkg setup_pkg susp_pkg unsusp_pkg cancel_pkg );
+my @base_items = qw( active_pkg setup_pkg susp_pkg unsusp_pkg cancel_pkg total_revenue_pkg );
my %base_labels = (
'active_pkg' => 'Active packages',
@@ -41,6 +42,7 @@ my %base_labels = (
'susp_pkg' => 'Suspensions',
'unsusp_pkg' => 'Unsuspensions',
'cancel_pkg' => 'Cancellations',
+ 'total_revenue_pkg' => 'Total Revenue'
);
my %base_colors = (
@@ -49,8 +51,13 @@ my %base_colors = (
'susp_pkg' => 'ff9900', #yellow
'unsusp_pkg' => '44ff44', #light green
'cancel_pkg' => 'cc0000', #red
+ 'total_revenue_pkg' => '0000ff', #blue
);
+my $sprintf_fields = {
+ 'total_revenue_pkg' => '%.2f', #format to 2 decimal places
+};
+
my %base_links;
foreach my $status (qw(active setup cancel susp unsusp)) {
$base_links{$status.'_pkg'} =
diff --git a/httemplate/graph/elements/monthly.html b/httemplate/graph/elements/monthly.html
index 1a9428115..cfe5a3c6d 100644
--- a/httemplate/graph/elements/monthly.html
+++ b/httemplate/graph/elements/monthly.html
@@ -59,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
@@ -79,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' ) {
diff --git a/httemplate/graph/elements/report.html b/httemplate/graph/elements/report.html
index b5d214816..70c3a9e94 100644
--- a/httemplate/graph/elements/report.html
+++ b/httemplate/graph/elements/report.html
@@ -249,7 +249,7 @@ any delimiter and linked from the elements in @data.
% my $e = 0;
% foreach ( @$data_row ) {
% my $entry = $_;
-% $entry = $money_char . sprintf($sprintf, $entry);
+% $entry = $money_char . sprintf($sprintf_fields->{$row} ? $sprintf_fields->{$row} : $sprintf, $entry);
% $entry = $link_prefix . shift(@$links) . "\">$entry</A>" if $link_prefix;
% push @{$cell[$i]}, $entry;
% $bottom_total[$e++] += $_ unless $opt{no_graph}[$i-1];
@@ -343,6 +343,7 @@ my $conf = new FS::Conf;
my $money_char = $opt{'disable_money'} ? '' : $conf->config('money_char');
my @items = @{ $opt{'items'} };
+my $sprintf_fields = $opt{'sprintf_fields'};
foreach my $other (qw( col_labels row_labels graph_labels axis_labels colors links )) {
if ( ref($opt{$other}) eq 'HASH' ) {