2 Like view/cust_statement-pdf.cgi, but for viewing/printing the implicit
3 statement containing all of a customer's invoices. Slightly redundant.
4 I don't see the need to create an equivalent to view/cust_statement.html
5 for this case, but one can be added if necessary.
11 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
14 my($query) = $cgi->keywords;
15 $query =~ /^((.+)-)?(\d+)$/;
16 my $templatename = $2 || 'statement'; #XXX configure... via event?? eh..
19 my $cust_main = qsearchs({
20 'select' => 'cust_main.*',
21 'table' => 'cust_main',
22 'hashref' => { 'custnum' => $custnum },
23 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
25 die "Customer #$custnum not found!" unless $cust_main;
27 my $cust_statement = FS::cust_statement->new({
28 'custnum' => $custnum,
29 'statementnum' => 'ALL', #magic
33 my $pdf = $cust_statement->print_pdf( '', $templatename );
35 http_header('Content-Type' => 'application/pdf' );
36 http_header('Content-Length' => length($pdf) );
37 http_header('Cache-control' => 'max-age=60' );