%= $url = "$selfurl?action=";
%by_pkg_label = (); # not used yet, but I'm sure it will be...
@svc_phone = ();
@svc_port = ();
@svc_pbx = ();
@bytes_svcs = (); # contains svc_acct and svc_broadband
@bytes_cols = qw(seconds_used seconds upbytes_used upbytes downbytes_used downbytes totalbytes_used totalbytes);
%bytes_show = map { $_ => 0 } @bytes_cols;
foreach my $svc (@svcs) {
$by_pkg_label{ $svc->{pkg_label} } ||= [];
push @{ $by_pkg_label{ $svc->{pkg_label} } }, $svc;
if (( $svc->{svcdb} eq 'svc_acct' ) || ( $svc->{svcdb} eq 'svc_broadband' )) {
foreach my $field (@bytes_cols) {
$bytes_show{$field} = 1 if length($svc->{$field}) or (($field !~ /_used$/) && $svc->{'recharge_'.$field});
}
push @bytes_svcs, $svc;
} elsif ( $svc->{svcdb} eq 'svc_phone' ) {
push @svc_phone, $svc;
} elsif ( $svc->{svcdb} eq 'svc_port' ) {
push @svc_port, $svc;
} elsif ( $svc->{svcdb} eq 'svc_pbx' ) {
push @svc_pbx, $svc;
}
}
'';
%>
<%= include('header', 'Account usage') %>
<%= if ( $error ) {
$OUT .= qq!$error
!;
} ''; %>
<%= if ( @bytes_svcs ) {
$OUT .= '
Account | '; $OUT .= 'Time used | ' if $bytes_show{'seconds_used'}; $OUT .= 'Time remaining | ' if $bytes_show{'seconds'}; $OUT .= 'Upload used | ' if $bytes_show{'upbytes_used'}; $OUT .= 'Upload remaining | ' if $bytes_show{'upbytes'}; $OUT .= 'Download used | ' if $bytes_show{'downbytes_used'}; $OUT .= 'Download remaining | ' if $bytes_show{'downbytes'}; $OUT .= 'Total used | ' if $bytes_show{'totalbytes_used'}; $OUT .= 'Total remaining | ' if $bytes_show{'totalbytes'}; $OUT .= '
---|---|---|---|---|---|---|---|---|
' . qq!!. $svc->{'label'}. ': '. $username .' | '; foreach my $field (@bytes_cols) { $OUT .= '' . $svc->{$field} . ' | ' if $bytes_show{$field}; } if ( $svc->{'recharge_amount'} ) { my $link = "${url}process_order_recharge;". "svcnum=$svc->{'svcnum'}"; $OUT .= '|||||||
'; $OUT .= qq!!.'Recharge for $'; $OUT .= $svc->{'recharge_amount'} . ' with'; $OUT .= ' | '; foreach my $field ( qw(seconds upbytes downbytes totalbytes) ) { $OUT .= '' if $bytes_show{$field.'_used'}; if ($bytes_show{$field}) { $OUT .= ' | '; $OUT .= $svc->{'recharge_'.$field} if $svc->{'recharge_'.$field}; $OUT .= ' | '; } } $OUT .= '||||||
Total Used | '; foreach my $field (@bytes_cols) { if ($bytes_show{$field}) { $OUT .= ''; $OUT .= $bytes_used_total{$field} || '0' if $field =~ /_used$/; $OUT .= ' | '; } } $OUT .= '
Number | '; if ( $any{outbound} ) { $OUT .= 'Dialed | '; } if ( $any{inbound} ) { $OUT .= 'Received | '; } $OUT .= '
---|---|---|
'. $svc_x->{'label'}. ': '. $svc_x->{'value'}; $OUT .= ' | '; # usage summary w/ links for my $dir (qw(outbound inbound)) { if ( $dir eq 'inbound' ) { $link .= ';inbound=1'; } if ( $svc_x->{$dir} ) { $OUT .= ''.qq!! . sprintf('%d calls (%.0f minutes)', $svc_x->{$dir}->{'count'}, $svc_x->{$dir}->{'duration'} / 60 ) . ' | '; } elsif ( $any{$dir} ) { $OUT .= ''; } } $OUT .= ' |
Remaining minutes | |||
---|---|---|---|
$description | $remain | / | $total |
* shared among all your phone plans |
Service | |
---|---|
'. $svc_port->{'label'}. ': '. $svc_port->{'value'}.' | '; $OUT .= qq!