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