Merge branch 'patch-18' of https://github.com/gjones2/Freeside
[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 <& /elements/header.html, mt($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"><% mt('Search options') |h %></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" SIZE=10 MULTIPLE>
34 %#        <OPTION VALUE=""><% mt('all') |h %></OPTION>
35 %#        <OPTION VALUE="CARD"><% mt('credit card (all)') |h %></OPTION>
36         <OPTION VALUE="CARD-VisaMC" SELECTED><% mt('credit card (Visa/MasterCard)') |h %></OPTION>
37         <OPTION VALUE="CARD-Amex" SELECTED><% mt('credit card (American Express)') |h %></OPTION>
38         <OPTION VALUE="CARD-Discover" SELECTED><% mt('credit card (Discover)') |h %></OPTION>
39         <OPTION VALUE="CARD-Maestro" SELECTED><% mt('credit card (Maestro/Switch/Solo)') |h %></OPTION>
40         <OPTION VALUE="CHEK" SELECTED><% mt('electronic check / ACH') |h %></OPTION>
41         <OPTION VALUE="BILL" SELECTED><% mt('check') |h %></OPTION>
42         <OPTION VALUE="PREP" SELECTED><% mt('prepaid card') |h %></OPTION>
43         <OPTION VALUE="CASH" SELECTED><% mt('cash') |h %></OPTION>
44         <OPTION VALUE="WEST" SELECTED><% mt('Western Union') |h %></OPTION>
45         <OPTION VALUE="MCRD" SELECTED><% mt('manual credit card') |h %></OPTION>
46       </SELECT>
47     </TD>
48   </TR>
49
50   <TR>
51     <TD ALIGN="right"><% mt('Check #:') |h %> </TD>
52     <TD>
53       <INPUT TYPE="text" ID="payinfo" NAME="payinfo">
54     </TD>
55   </TR>
56   <TR>
57     <TD ALIGN="right"><% mt('Transaction #:') |h %> </TD>
58     <TD>
59       <INPUT TYPE="text" ID="ccpay" NAME="ccpay">
60     </TD>
61   </TR>
62
63   <& /elements/tr-select-agent.html,
64                  'curr_value'    => scalar($cgi->param('agentnum')),
65                  'label'         => emt('for agent: '),
66                  'disable_empty' => 0,
67   &>
68
69   <& /elements/tr-select-user.html &>
70
71   <TR>
72     <TD ALIGN="right" VALIGN="center"><% mt('Payment') |h %></TD>
73     <TD>
74       <TABLE>
75         <& /elements/tr-input-beginning_ending.html,
76                       layout     => 'horiz',
77                       input_time => $conf->exists('report-cust_pay-select_time'),
78         &>
79       </TABLE>
80     </TD>
81   </TR>
82
83 % if ( $void ) {
84     <TR>
85       <TD ALIGN="right" VALIGN="center"><% mt('Voided') |h %></TD>
86       <TD>
87         <TABLE>
88           <& /elements/tr-input-beginning_ending.html,
89                         prefix => 'void',
90                         layout => 'horiz',
91           &>
92         </TABLE>
93       </TD>
94     </TR>
95 % }
96
97   <& /elements/tr-input-lessthan_greaterthan.html,
98                 'label' => emt('Amount'),
99                 'field' => 'paid',
100   &>
101
102 % if ( $table eq 'cust_pay' ) { 
103   <& /elements/tr-checkbox.html,
104                 'label' => emt('Include tax names'),
105                 'field' => 'tax_names',
106                 'value' => 1,
107   &>
108 % }
109
110 </TABLE>
111
112 <BR>
113 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
114
115 </FORM>
116
117 <& /elements/footer.html &>
118 <%init>
119
120 my %opt = @_;
121 my $table = 'cust_'.$opt{'thing'};
122 my $name_singular = $opt{'name_singular'};
123
124 die "access denied"
125   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
126
127 my $conf = new FS::Conf;
128
129 my $void = $cgi->param('void') ? 1 : 0;
130 my $unapplied = $cgi->param('unapplied') ? 1 : 0;
131
132 my $title = $void ? "Voided $name_singular report" :
133             $unapplied ? "Unapplied $name_singular report" :
134             "\u$name_singular report" ;
135 $table .= '_void' if $void;
136
137 </%init>