X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fsqlradius_usage.html;h=29ef4c0e868fe7cb46bf76cdab91f194a6eab005;hp=dd06c10fa4086d79e46e0ebe8b05253d1dd2698e;hb=36e4318e1ccec27ae76a3d1505718a3d47af67c9;hpb=f98d0226901f7355652add424783f7f207aef596 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)) : ''; +} +