summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-08-28 18:45:30 -0700
committerMark Wells <mark@freeside.biz>2012-08-28 18:45:30 -0700
commit36e4318e1ccec27ae76a3d1505718a3d47af67c9 (patch)
tree1f2ba1acf1c2718351354a94e913f4693c8cd20a /httemplate
parentf98d0226901f7355652add424783f7f207aef596 (diff)
sqlradius data volume report improvements, #18823
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/search/sqlradius_usage.html23
1 files changed, 15 insertions, 8 deletions
diff --git a/httemplate/search/sqlradius_usage.html b/httemplate/search/sqlradius_usage.html
index dd06c10fa..29ef4c0e8 100644
--- a/httemplate/search/sqlradius_usage.html
+++ b/httemplate/search/sqlradius_usage.html
@@ -27,9 +27,9 @@
'Customer',
'Package',
@svc_header,
- 'Upload',
- 'Download',
- 'Total',
+ 'Upload (GB)',
+ 'Download (GB)',
+ 'Total (GB)',
],
'footer' => \@footer,
'fields' => [ #\&FS::UI::Web::cust_fields,
@@ -139,7 +139,8 @@ my @svc_usage = map {
return '' if !exists($usage_by_username{$username});
my $value = $usage_by_username{ $username }->[$i];
$total_usage[$i] += $value;
- FS::UI::bytecount::display_bytecount($value);
+ # for now, always show in GB, rounded to 3 digits
+ bytes_to_gb($value);
}
} (0,1,2);
@@ -167,7 +168,8 @@ my @svc_header = @{ $svc_header{$svcdb} };
my @svc_fields = @{ $svc_fields{$svcdb} };
# svc_x search params
-my %search_hash = ( 'agentnum' => $agentnum );
+my %search_hash = ( 'agentnum' => $agentnum,
+ 'exportnum' => $export->exportnum );
my $sql_query = $class->search(\%search_hash);
$sql_query->{'select'} .= ', part_pkg.pkg';
@@ -183,12 +185,17 @@ my $skip_cols = 1 + scalar(@svc_header);
my @footer = (
'',
FS::Record->scalar_sql($sql_query->{count_query}) . ' services',
- ('&nbsp;') x $skip_cols,
- map {
+ ('') x $skip_cols,
+ map {
+ my $i = $_;
sub { # defer this until the rows have been processed
- FS::UI::bytecount::display_bytecount($total_usage[$_])
+ bytes_to_gb($total_usage[$i])
}
} (0,1,2)
);
+sub bytes_to_gb {
+ $_[0] ? sprintf('%.3f', $_[0] / (1024*1024*1024.0)) : '';
+}
+
</%init>