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 $cust_statement = qsearchs({
59 'select' => 'cust_statement.*',
60 'table' => 'cust_statement',
61 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
62 'hashref' => { 'statementnum' => $statementnum },
63 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
65 die "Statement #$statementnum not found!" unless $cust_statement;
67 my $custnum = $cust_statement->custnum;
68 my $display_custnum = $cust_statement->cust_main->display_custnum;
70 my $link = "statementnum=$statementnum";
71 $link .= ';template='. uri_escape($templatename) if $templatename;