unapplied payment/refund/credit reports, RT#7503
[freeside.git] / httemplate / search / elements / report_cust_pay_or_refund.html
1 <%doc>
2
3 Examples:
4
5   include( 'elements/report_cust_pay_or_refund.html',
6                'thing'          => 'pay',
7                'name_singular'  => 'payment',
8          )
9
10   include( 'elements/report_cust_pay_or_refund.html',
11                'thing'          => 'refund',
12                'name_singular'  => 'refund',
13          )
14
15 </%doc>
16 <% include('/elements/header.html', $title ) %>
17
18 <FORM ACTION="<% $table %>.html" METHOD="GET">
19 <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
20 <INPUT TYPE="hidden" NAME="unapplied" VALUE="<% $unapplied %>">
21
22 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
23
24   <TR>
25     <TH CLASS="background" COLSPAN=2 ALIGN="left">
26       <FONT SIZE="+1">Search options</FONT>
27     </TH>
28   </TR>
29
30   <TR>
31     <TD ALIGN="right"><% ucfirst(PL($name_singular)) %> of type: </TD>
32     <TD>
33       <SELECT NAME="payby" onChange="payby_changed(this)">
34         <OPTION VALUE="">all</OPTION>
35         <OPTION VALUE="CARD">credit card (all)</OPTION>
36         <OPTION VALUE="CARD-VisaMC">credit card (Visa/MasterCard)</OPTION>
37         <OPTION VALUE="CARD-Amex">credit card (American Express)</OPTION>
38         <OPTION VALUE="CARD-Discover">credit card (Discover)</OPTION>
39         <OPTION VALUE="CARD-Maestro">credit card (Maestro/Switch/Solo)</OPTION>
40         <OPTION VALUE="CHEK">electronic check / ACH</OPTION>
41         <OPTION VALUE="BILL">check</OPTION>
42         <OPTION VALUE="PREP">prepaid card</OPTION>
43         <OPTION VALUE="CASH">cash</OPTION>
44         <OPTION VALUE="WEST">Western Union</OPTION>
45         <OPTION VALUE="MCRD">manual credit card</OPTION>
46       </SELECT>
47     </TD>
48   </TR>
49
50   <SCRIPT TYPE="text/javascript">
51   
52     function payby_changed(what) {
53       if ( what.options[what.selectedIndex].value == 'BILL' ) {
54         document.getElementById('checkno_caption').style.color = '#000000';
55         what.form.payinfo.disabled = false;
56         what.form.payinfo.style.backgroundColor = '#ffffff';
57       } else {
58         document.getElementById('checkno_caption').style.color = '#bbbbbb';
59         what.form.payinfo.disabled = true;
60         what.form.payinfo.style.backgroundColor = '#dddddd';
61       }
62     }
63
64   </SCRIPT>
65
66   <TR>
67     <TD ALIGN="right"><FONT ID="checkno_caption" COLOR="#bbbbbb">Check #: </FONT></TD>
68     <TD>
69       <INPUT TYPE="text" NAME="payinfo" DISABLED STYLE="background-color: #dddddd">
70     </TD>
71   </TR>
72
73   <% include( '/elements/tr-select-agent.html',
74                  'curr_value'    => scalar($cgi->param('agentnum')),
75                  'label'         => 'for agent: ',
76                  'disable_empty' => 0,
77              )
78   %>
79
80   <% include( '/elements/tr-select-user.html' ) %>
81
82   <TR>
83     <TD ALIGN="right" VALIGN="center">Payment</TD>
84     <TD>
85       <TABLE>
86         <% include( '/elements/tr-input-beginning_ending.html',
87                       layout   => 'horiz',
88                   )
89         %>
90       </TABLE>
91     </TD>
92   </TR>
93
94 % if ( $void ) {
95     <TR>
96       <TD ALIGN="right" VALIGN="center">Voided</TD>
97       <TD>
98         <TABLE>
99           <% include( '/elements/tr-input-beginning_ending.html',
100                         prefix => 'void',
101                         layout => 'horiz',
102                     )
103           %>
104         </TABLE>
105       </TD>
106     </TR>
107 % }
108
109   <% include( '/elements/tr-input-lessthan_greaterthan.html',
110                 'label' => 'Amount',
111                 'field' => 'paid',
112             )
113   %>
114
115 % if ( $table eq 'cust_pay' ) { 
116   <% include( '/elements/tr-checkbox.html',
117                 'label' => 'Include tax names',
118                 'field' => 'tax_names',
119                 'value' => 1,
120             )
121   %>
122 % }
123
124 </TABLE>
125
126 <BR>
127 <INPUT TYPE="submit" VALUE="Get Report">
128
129 </FORM>
130
131 <% include('/elements/footer.html') %>
132 <%init>
133
134 my %opt = @_;
135 my $table = 'cust_'.$opt{'thing'};
136 my $name_singular = $opt{'name_singular'};
137
138 die "access denied"
139   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
140
141 my $void = $cgi->param('void') ? 1 : 0;
142 my $unapplied = $cgi->param('unapplied') ? 1 : 0;
143
144 my $title = $void ? "Voided $name_singular report" :
145             $unapplied ? "Unapplied $name_singular report" :
146             "\u$name_singular report" ;
147 $table .= '_void' if $void;
148
149 </%init>