1 <% include("/elements/header.html",'Statement View', menubar(
2 "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
5 % if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) {
7 <A HREF="<% $p %>misc/print-invoice.cgi?<% $link %>">Re-print this statement</A>
9 % if ( grep { $_ ne 'POST' } $cust_statement->cust_main->invoicing_list ) {
10 | <A HREF="<% $p %>misc/email-invoice.cgi?<% $link %>">Re-email this statement</A>
13 % if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) {
14 | <A HREF="<% $p %>misc/fax-invoice.cgi?<% $link %>">Re-fax this statement</A>
22 % if ( $conf->exists('invoice_latex') ) {
24 <A HREF="<% $p %>view/cust_statement-pdf.cgi?<% $link %>.pdf">View typeset statement</A>
28 % #if ( $cust_statement->num_cust_event ) {
30 <A HREF="<%$p%>search/cust_event.html?statementnum=<% $cust_statement->statementnum %>">( View statement events )</A><BR><BR>
33 % if ( $conf->exists('invoice_html') ) {
35 <% join('', $cust_statement->print_html('', $templatename) ) %>
38 <PRE><% join('', $cust_statement->print_text('', $templatename) ) %></PRE>
41 <% include('/elements/footer.html') %>
45 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
48 my($query) = $cgi->keywords;
49 $query =~ /^((.+)-)?(\d+)$/;
50 my $templatename = $2;
51 my $statementnum = $3;
53 my $conf = new FS::Conf;
55 my @payby = grep /\w/, $conf->config('payby');
56 #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
57 @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
59 my %payby = map { $_=>1 } @payby;
61 my $cust_statement = qsearchs({
62 'select' => 'cust_statement.*',
63 'table' => 'cust_statement',
64 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
65 'hashref' => { 'statementnum' => $statementnum },
66 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
68 die "Statement #$statementnum not found!" unless $cust_statement;
70 my $custnum = $cust_statement->custnum;
71 my $display_custnum = $cust_statement->cust_main->display_custnum;
73 my $link = $templatename ? "$templatename-$statementnum" : $statementnum;