summaryrefslogtreecommitdiff
path: root/httemplate/search/prepay_credit.html
blob: dff8a3d9a8d3050105c038c91a685c33b20c0d9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
%
%my $agent = '';
%my $hashref = {};
%if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
%  $hashref->{agentnum} = $1;
%  $agent = qsearchs('agent', { 'agentnum' => $1 } );
%}
%
%my $count_query = 'SELECT COUNT(*) FROM prepay_credit';
%$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent;
%
%
<% include( 'elements/search.html',
                 'title'       => 'Unused Prepaid Cards'.
                                  ($agent ? ' for '. $agent->agent : ''),
                 'menubar'     => [
                   'Main menu'      => $p,
                   'Generate cards' => $p.'edit/prepay_credit.cgi',
                 ],
                 'name'        => 'prepaid cards',
                 'query'       => {  'table'   => 'prepay_credit',
                                     'hashref' => $hashref,
                                  },
                 'count_query' => $count_query,
                 #'redirect'    => $link,
                 'header'      => [ '#', qw(Amount Time Agent) ],
                 'fields'      => [
                   'identifier',
                   sub { sprintf('$%.2f', shift->amount ) },
                   sub { my $c = shift; $c ? duration_exact($c->seconds) : '' },
                   sub { my $agent = shift->agent;
                         $agent ? $agent->agent : '';
                       },
                 ],
                 'links' => [
                   '',
                   '',
                   '',
                   sub { my $agent = shift->agent;
                         $agent ? [ "${p}view/agent.cgi?", 'agentnum' ] : '';
                       },
                 ],
      )
%>