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/send-statement.cgi?method=print;<% $link %>">Re-print this statement</A>
9 % if ( grep { $_ ne 'POST' } $cust_statement->cust_main->invoicing_list ) {
11 <A HREF="<% $p %>misc/send-statement.cgi?method=email;<% $link %>">Re-email this statement</A>
15 % #if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) {
16 | <A HREF="<% $p %>misc/send-statement.cgi?method=fax;<% $link %>">Re-fax this statement</A>
24 % #if ( $conf->exists('invoice_latex') ) {
25 % if ( 0 ) { #broken???
27 <A HREF="<% $p %>view/cust_statement-pdf.cgi?<% $link %>">View typeset statement</A>
31 % #if ( $cust_statement->num_cust_event ) {
33 <A HREF="<%$p%>search/cust_event.html?statementnum=<% $cust_statement->statementnum %>">( View statement events )</A><BR><BR>
36 % if ( $conf->exists('invoice_html') ) {
38 <% join('', $cust_statement->print_html('template' => $templatename) ) %>
41 <PRE><% join('', $cust_statement->print_text('template' => $templatename) ) %></PRE>
44 <% include('/elements/footer.html') %>
48 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
51 my($query) = $cgi->keywords;
52 $query =~ /^((.+)-)?(\d+)$/;
53 my $templatename = $2 || 'statement'; #XXX configure... via event?? eh..
54 my $statementnum = $3;
56 my $conf = new FS::Conf;
58 my @payby = grep /\w/, $conf->config('payby');
59 #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
60 @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
62 my %payby = map { $_=>1 } @payby;
64 my $cust_statement = qsearchs({
65 'select' => 'cust_statement.*',
66 'table' => 'cust_statement',
67 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
68 'hashref' => { 'statementnum' => $statementnum },
69 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
71 die "Statement #$statementnum not found!" unless $cust_statement;
73 my $custnum = $cust_statement->custnum;
74 my $display_custnum = $cust_statement->cust_main->display_custnum;
76 my $link = "statementnum=$statementnum";
77 $link .= ';template='. uri_escape($templatename) if $templatename;