event refactor, landing on HEAD!
[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   <TR>
8     <TD ALIGN="right">Credits by employee: </TD>
9
10     <TD>
11       <SELECT NAME="otaker">
12         <OPTION VALUE="">all</OPTION>
13 %       foreach my $otaker ( @otakers ) { 
14           <OPTION VALUE="<% $otaker %>"><% $otaker %></OPTION>
15 %       } 
16       </SELECT>
17     </TD>
18   </TR>
19
20   <% include( '/elements/tr-select-agent.html',
21                  'curr_value' => scalar( $cgi->param('agentnum') ),
22                  'label'      => 'for agent: ',
23              )
24   %>
25
26   <% include( '/elements/tr-input-beginning_ending.html' ) %>
27
28   <% include( '/elements/tr-input-lessthan_greaterthan.html',
29                 'label' => 'Amount',
30                 'field' => 'amount',
31             )
32   %>
33
34 </TABLE>
35
36 <BR>
37 <INPUT TYPE="submit" VALUE="Get Report">
38
39 </FORM>
40
41 <% include('/elements/footer.html') %>
42
43 <%init>
44
45 die "access denied"
46   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
47
48 my $sth = dbh->prepare("SELECT DISTINCT otaker FROM cust_credit")
49   or die dbh->errstr;
50 $sth->execute or die $sth->errstr;
51 my @otakers = map { $_->[0] } @{$sth->fetchall_arrayref};
52
53 </%init>