1 <& email-customers.html,
2 'form_action' => 'email-customer-statement.html',
3 'title' => 'Send statement to customer',
4 'no_search_fields' => [ 'start_date', 'end_date' ],
5 'alternate_form' => $alternate_form,
6 'post_search_hook' => $post_search_hook,
8 'process_url' => 'process/email-customer-statement.html',
12 my $acl = 'Resend invoices';
15 unless $FS::CurrentUser::CurrentUser->access_right($acl);
17 my $alternate_form = sub {
18 # this could maaaybe be a separate element, for cleanliness
19 # but it's really only for use by this page, and it's not overly complicated
25 my $label = ucfirst($_);
27 include('/elements/tr-input-date-field.html',{
29 'value' => $cgi->param($_) || '',
34 qw( start_date end_date )
37 '<INPUT TYPE="hidden" NAME="preview" VALUE="1">',
38 '<INPUT TYPE="submit" VALUE="Preview notice">',
42 my $post_search_hook = sub {
44 return unless $cgi->param('preview');
45 my $cust_main = qsearchs('cust_main',$opt{'search'})
46 or die "Could not find customer";
48 # so that the statement indicates the latest date
49 my $date_format = $opt{'conf'}->config('date_format') || '%m/%d/%Y';
50 $cgi->param('end_date', time2str($date_format, time))
51 unless $cgi->param('end_date');
53 # set from/subject/html_body based on date range
56 $opt{'conf'}->config('invoice_from')
59 # shortcut for common text
60 my $summary_text = $cust_main->name_short .
61 ($cgi->param('start_date') ? ' from ' : '') .
62 $cgi->param('start_date') .
63 ($cgi->param('end_date') ? ' through ' : '') .
64 $cgi->param('end_date');
66 $cgi->param('subject',
67 $opt{'conf'}->config('company_name') .
74 $opt{'conf'}->config('company_name') .
75 ' statement of charges and payments for ' .
78 include('/elements/customer-statement.html',
80 $cust_main->payment_history(
82 $_ => parse_datetime(scalar($cgi->param($_)))
84 qw( start_date end_date ),