1 <% include( 'elements/search.html',
2 'title' => 'Unused Prepaid Cards'.
3 ($agent ? ' for '. $agent->agent : ''),
5 'Generate cards' => $p.'edit/prepay_credit.cgi',
7 'name' => 'prepaid cards',
8 'query' => { 'table' => 'prepay_credit',
11 'count_query' => $count_query,
13 'header' => [ '#', qw(Amount Time Upload Download Total Agent) ],
16 sub { sprintf('$%.2f', shift->amount ) },
18 $c->seconds ? duration_exact($c->seconds) : ''
22 ? FS::UI::bytecount::bytecount_unexact($c->upbytes)
27 ? FS::UI::bytecount::bytecount_unexact($c->downbytes)
32 ? FS::UI::bytecount::bytecount_unexact($c->totalbytes)
35 sub { my $agent = shift->agent;
36 $agent ? $agent->agent : '';
46 sub { my $agent = shift->agent;
47 $agent ? [ "${p}edit/agent.cgi?", 'agentnum' ] : '';
55 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
59 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
60 $hashref->{agentnum} = $1;
61 $agent = qsearchs('agent', { 'agentnum' => $1 } );
64 my $count_query = 'SELECT COUNT(*) FROM prepay_credit';
65 $count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent;