reports with row grouping for payment/refund search, #25944
[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('Payment search options') |h %></FONT>
27     </TH>
28   </TR>
29
30   <& /elements/tr-select.html,
31     label     => ucfirst(PL($name_singular)) . ' of type:',
32     field     => 'payby',
33     options   => [ keys(\%payby) ],
34     labels    => \%payby,
35     multiple  => 1,
36     size      => 16
37   &>
38
39   <TR>
40     <TD ALIGN="right"><% mt('Check #:') |h %> </TD>
41     <TD>
42       <INPUT TYPE="text" ID="payinfo" NAME="payinfo">
43     </TD>
44   </TR>
45   <TR>
46     <TD ALIGN="right"><% mt('Transaction #:') |h %> </TD>
47     <TD>
48       <INPUT TYPE="text" ID="ccpay" NAME="ccpay">
49     </TD>
50   </TR>
51
52   <& /elements/tr-select-user.html &>
53
54   <TR>
55     <TD ALIGN="right" VALIGN="center"><% mt(ucfirst($name_singular). ' date') |h %></TD>
56     <TD>
57       <TABLE>
58         <& /elements/tr-input-beginning_ending.html,
59                       layout     => 'horiz',
60                       input_time => $conf->exists('report-cust_pay-select_time'),
61         &>
62       </TABLE>
63     </TD>
64   </TR>
65
66 % if ( $void ) {
67     <TR>
68       <TD ALIGN="right" VALIGN="center"><% mt('Voided') |h %></TD>
69       <TD>
70         <TABLE>
71           <& /elements/tr-input-beginning_ending.html,
72                         prefix => 'void',
73                         layout => 'horiz',
74           &>
75         </TABLE>
76       </TD>
77     </TR>
78 % }
79
80 % if ( $table eq 'cust_pay' ) {
81
82 % # payment batch
83 % #  <& /elements/tr-select-batchnum.html &>
84
85 % #payment "entry" batch (should probably just all become the same thing)
86   <& /elements/tr-select-paybatch.html &>
87
88 % }
89
90   <& /elements/tr-input-lessthan_greaterthan.html,
91                 'label' => emt('Amount'),
92                 'field' => 'paid',
93   &>
94
95
96 </TABLE>
97 <BR>
98
99
100 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
101
102   <TR>
103     <TH CLASS="background" COLSPAN=2 ALIGN="left">
104       <FONT SIZE="+1"><% mt('Customer search options') |h %></FONT>
105     </TH>
106   </TR>
107
108   <& /elements/tr-select-agent.html,
109                  'curr_value'    => scalar($cgi->param('agentnum')),
110                  'label'         => emt('Agent'),
111                  'disable_empty' => 0,
112   &>
113
114   <& /elements/tr-select-cust_class.html,
115        'label'        => emt('Customer class'),
116        'field'        => 'cust_classnum',
117        'multiple'     => 1,
118        'pre_options'  => [ 0 => emt('(none)') ],
119   &>
120
121 </TABLE>
122
123 % if ( $table eq 'cust_pay' ) { 
124
125   <BR>
126   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
127
128   <TR>
129     <TH CLASS="background" COLSPAN=2 ALIGN="left">
130       <FONT SIZE="+1"><% mt('Display options') |h %></FONT>
131     </TH>
132   </TR>
133
134   <& /elements/tr-checkbox.html,
135                 'label' => emt('Include tax names'),
136                 'field' => 'tax_names',
137                 'value' => 1,
138   &>
139
140 </TABLE>
141
142 % }
143
144 <BR>
145 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
146
147 </FORM>
148
149 <& /elements/footer.html &>
150 <%init>
151
152 my %opt = @_;
153 my $table = 'cust_'.$opt{'thing'};
154 my $name_singular = $opt{'name_singular'};
155
156 die "access denied"
157   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
158
159 my $conf = new FS::Conf;
160
161 my $void = $cgi->param('void') ? 1 : 0;
162 my $unapplied = $cgi->param('unapplied') ? 1 : 0;
163
164 my $title = $void ? "Voided $name_singular report" :
165             $unapplied ? "Unapplied $name_singular report" :
166             "\u$name_singular report" ;
167 $table .= '_void' if $void;
168
169 tie (my %payby, 'Tie::IxHash',
170   'CARD-VisaMC'    => 'credit card (Visa/MasterCard)',
171   'CARD-Amex'      => 'credit card (American Express)',
172   'CARD-Discover'  => 'credit card (Discover)',
173   'CARD-Maestro'   => 'credit card (Maestro/Switch/Solo)',
174   'CARD-Tokenized' => 'credit card (Tokenized)',
175
176   'CHEK'           => 'electronic check / ACH',
177   'BILL'           => 'check',
178   'CASH'           => 'cash',
179   'PPAL'           => 'Paypal',
180   'APPL'           => 'Apple Store',
181   'ANRD'           => 'Android Market',
182
183   'PREP'           => 'prepaid card',
184   'WIRE'           => 'wire transfer',
185   'WEST'           => 'Western Union',
186   'EDI'            => 'Electronic Debit (EDI)',
187   'MCRD'           => 'manual credit card',
188   'MCHK'           => 'manual electronic check',
189 );
190
191 </%init>