X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fsvc_acct.cgi;h=78c3a3809dc08a5645513f3761b4dbe9a4d7477b;hb=021e1ac77366fb0765cb364af0c09f5f2df92266;hp=3fb9156cc2811851450905b9edc281c9605bb58f;hpb=497bd20a2aa6a33cff22c25232929b3d7aeaac86;p=freeside.git
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index 3fb9156cc..78c3a3809 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -60,35 +60,49 @@ function areyousure(href) {
if ( $part_svc->part_export('sqlradius') ) {
my $last_bill;
+ my %plandata;
if ( $cust_pkg ) {
#false laziness w/httemplate/edit/part_pkg... this stuff doesn't really
#belong in plan data
- my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
- split("\n", $cust_pkg->part_pkg->plandata );
+ %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
+ split("\n", $cust_pkg->part_pkg->plandata );
$last_bill = $cust_pkg->last_bill;
} else {
$last_bill = 0;
+ %plandata = ();
}
my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time );
- my $h = int($seconds/3600);
- my $m = int( ($seconds%3600) / 60 );
- my $s = $seconds%60;
+ my $hour = int($seconds/3600);
+ my $min = int( ($seconds%3600) / 60 );
+ my $sec = $seconds%60;
+
+ my $input = $svc_acct->attribute_since_sqlradacct(
+ $last_bill, time, 'AcctInputOctets'
+ ) / 1048576;
+ my $output = $svc_acct->attribute_since_sqlradacct(
+ $last_bill, time, 'AcctOutputOctets'
+ ) / 1048576;
if ( $seconds ) {
- print "Online $hh $mm $ss";
+ print "Online $hourh $minm $secs";
} else {
print 'Has not logged on';
}
if ( $cust_pkg ) {
- print ' this billing cycle (since '. time2str(%C, $last_bill). ') - '.
- $plandata{recur_included_hours}. ' total hours in plan
';
+ print ' since last bill ('. time2str("%C", $last_bill). ') - '.
+ $plandata{recur_included_hours}. ' total hours in plan
';
} else {
- print ' (no billing cycle available for unaudited account)
';
+ print ' (no billing cycle available for unaudited account)
';
}
+ print 'Input: '. sprintf("%.3f", $input). ' megabytes
';
+ print 'Output: '. sprintf("%.3f", $output). ' megabytes
';
+
+ print '
';
+
}
#print qq!
Send account information!;
@@ -126,7 +140,9 @@ if ( $conf->exists('security_phrase') ) {
$svc_acct->sec_phrase. '';
}
-my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
+my $svc_acct_pop = $svc_acct->popnum
+ ? qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum})
+ : '';
print "