1 <% include( 'elements/search.html',
2 'title' => 'Unused Prepaid Cards'.
3 ($agent ? ' for '. $agent->agent : ''),
6 'Generate cards' => $p.'edit/prepay_credit.cgi',
8 'name' => 'prepaid cards',
9 'query' => { 'table' => 'prepay_credit',
10 'hashref' => $hashref,
12 'count_query' => $count_query,
14 'header' => [ '#', qw(Amount Time Upload Download Total Agent) ],
17 sub { sprintf('$%.2f', shift->amount ) },
19 $c->seconds ? duration_exact($c->seconds) : ''
23 ? FS::UI::bytecount::bytecount_unexact($c->upbytes)
28 ? FS::UI::bytecount::bytecount_unexact($c->downbytes)
33 ? FS::UI::bytecount::bytecount_unexact($c->totalbytes)
36 sub { my $agent = shift->agent;
37 $agent ? $agent->agent : '';
47 sub { my $agent = shift->agent;
48 $agent ? [ "${p}view/agent.cgi?", 'agentnum' ] : '';
56 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
60 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
61 $hashref->{agentnum} = $1;
62 $agent = qsearchs('agent', { 'agentnum' => $1 } );
65 my $count_query = 'SELECT COUNT(*) FROM prepay_credit';
66 $count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent;