diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-08-29 15:19:17 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-08-29 15:19:17 -0700 |
| commit | 33aa032478e29000c8c0d4fbe7bf8cb25c277606 (patch) | |
| tree | dca9779a3f3990ee26268575bb135081f9f1b23c /httemplate/search/sqlradius_usage.html | |
| parent | 0e17277ed0cc243452dfc07d1bd702502c7d50c3 (diff) | |
| parent | 36e4318e1ccec27ae76a3d1505718a3d47af67c9 (diff) | |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/search/sqlradius_usage.html')
| -rw-r--r-- | httemplate/search/sqlradius_usage.html | 23 |
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', - (' ') 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> |
