4 %if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
5 % $hashref->{agentnum} = $1;
6 % $agent = qsearchs('agent', { 'agentnum' => $1 } );
9 %my $count_query = 'SELECT COUNT(*) FROM prepay_credit';
10 %$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent;
12 <% include( 'elements/search.html',
13 'title' => 'Unused Prepaid Cards'.
14 ($agent ? ' for '. $agent->agent : ''),
17 'Generate cards' => $p.'edit/prepay_credit.cgi',
19 'name' => 'prepaid cards',
20 'query' => { 'table' => 'prepay_credit',
21 'hashref' => $hashref,
23 'count_query' => $count_query,
25 'header' => [ '#', qw(Amount Time Upload Download Total Agent) ],
28 sub { sprintf('$%.2f', shift->amount ) },
30 $c->seconds ? duration_exact($c->seconds) : ''
34 ? FS::UI::Web::bytecount_unexact($c->upbytes)
39 ? FS::UI::Web::bytecount_unexact($c->downbytes)
44 ? FS::UI::Web::bytecount_unexact($c->totalbytes)
47 sub { my $agent = shift->agent;
48 $agent ? $agent->agent : '';
58 sub { my $agent = shift->agent;
59 $agent ? [ "${p}view/agent.cgi?", 'agentnum' ] : '';