RT#34078: Payment History Report / Statement
[freeside.git] / httemplate / misc / email-customers-history.html
1
2  <% include('email-customers.html',
3       'form_action'       => 'email-customers-history.html',
4       'sub_param_process' => $sub_param_process,
5       'alternate_form'    => $alternate_form,
6       'title'             => 'Send payment history',
7     )
8  %>
9
10 <%init>
11
12 my $sub_param_process = sub {
13   my $conf = shift;
14   my %sub_param;
15   foreach my $field ( qw( start_date end_date ) ) {
16     $sub_param{'payment_history'}->{$field} = parse_datetime($cgi->param($field));
17     $cgi->delete($field);
18   }
19   $cgi->param('msgnum',$conf->config('payment_history_msgnum'));
20   return %sub_param;
21 };
22
23 my $alternate_form = sub {
24   my %sub_param = @_;
25   # this could maaaybe be a separate element, for cleanliness
26   # but it's really only for use by this page, and it's not overly complicated
27   my $noinit = 0;
28   return join("\n",
29     '<TABLE BORDER="0">',
30     (
31       map {
32         my $label = ucfirst($_);
33         $label =~ s/_/ /;
34         include('/elements/tr-input-date-field.html',{
35           'name' => $_,
36           'value' => $sub_param{'payment_history'}->{$_} || '',
37           'label' => $label,
38           'noinit' => $noinit++
39         });
40       }
41       qw( start_date end_date )
42     ),
43     '</TABLE>',
44     '<INPUT TYPE="hidden" NAME="msgnum" VALUE="' . $cgi->param('msgnum') . '">',
45     '<INPUT TYPE="hidden" NAME="action" VALUE="preview">',
46     '<INPUT TYPE="submit" VALUE="Preview notice">',
47   );
48 };
49
50 </%init>
51