% if ( $part_svc->part_export_usage ) { % % my $last_bill; % my %plandata; % if ( $cust_pkg ) { % #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really % #belong in plan data % %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->seconds_since_sqlradacct( $last_bill, time ); % my $hour = int($seconds/3600); % my $min = int( ($seconds%3600) / 60 ); % my $sec = $seconds%60; % % my $input = $svc->attribute_since_sqlradacct( % $last_bill, time, 'AcctInputOctets' % ) / 1073741824; % my $output = $svc->attribute_since_sqlradacct( % $last_bill, time, 'AcctOutputOctets' % ) / 1073741824; % % my $last_mac = $svc->attribute_last_sqlradacct( 'CallingStationId' ); % if ( $last_mac =~ /^\s*(([\dA-F]{2}[\-:]){5}[\dA-F]{2})/i % and my $vendor = Net::MAC::Vendor::lookup($1) % ) % { % $last_mac .= ' ('. $vendor->[0]. ')'; % } RADIUS session information
<% ntable('#cccccc',2) %> % if ( $seconds ) { Online <% $hour %>h <% $min %>m <% $sec %>s % } else { Has not logged on % } % if ( $cust_pkg ) { since last bill (<% time2str('%a %b %o %Y', $last_bill) %>) % if ( length($plandata{recur_included_hours}) ) { - <% $plandata{recur_included_hours} %> total hours in plan % }
% } else { (no billing cycle available for unaudited account)
% } Upload: <% sprintf("%.3f", $input) %> gigabytes
Download: <% sprintf("%.3f", $output) %> gigabytes
% if ( $svc->table eq 'svc_acct' ) { Last Login: <% $svc->last_login_text %>
% } % if ( length($last_mac) ) { Last Source or MAC: <% $last_mac %>
% } % my $href = qq!this billing cycle | <% $href %>;begin=<% time-15552000 %>">past six months | <% $href %>">all sessions
% } <%init> my %opt = @_; my $svc = $opt{'svc'}; my $part_svc = $opt{'part_svc'}; my $cust_pkg = $opt{'cust_pkg'};