additional by-otaker searches fixed for the brave new world of usernum, RT#9555
[freeside.git] / httemplate / search / report_cust_credit.html
1 <% include('/elements/header.html', 'Credit report' ) %>
2
3 <FORM ACTION="cust_credit.html" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
5
6 <TABLE>
7
8   <% include( '/elements/tr-select-user.html',
9                 'label'       => 'Credits by employee: ',
10                 'access_user' => \%access_user,
11             )
12   %>
13
14   <% include( '/elements/tr-select-agent.html',
15                  'curr_value'    => scalar( $cgi->param('agentnum') ),
16                  'label'         => 'for agent: ',
17                  'disable_empty' => 0,
18              )
19   %>
20
21   <% include( '/elements/tr-input-beginning_ending.html' ) %>
22
23   <% include( '/elements/tr-input-lessthan_greaterthan.html',
24                 'label' => 'Amount',
25                 'field' => 'amount',
26             )
27   %>
28
29 </TABLE>
30
31 <BR>
32 <INPUT TYPE="submit" VALUE="Get Report">
33
34 </FORM>
35
36 <% include('/elements/footer.html') %>
37
38 <%init>
39
40 die "access denied"
41   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
42
43 my $sth = dbh->prepare("SELECT DISTINCT usernum FROM cust_credit")
44   or die dbh->errstr;
45 $sth->execute or die $sth->errstr;
46 my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
47 my %access_user =
48   map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
49       @usernum;
50
51
52 </%init>