summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-07-17 15:06:09 -0700
committerMark Wells <mark@freeside.biz>2012-07-17 15:06:09 -0700
commit80e2cdb19a34194b9c5afa7a14829e5121eca8eb (patch)
tree123f42fe02521b993c0cc4b8b72da928cf12f951 /httemplate
parenta6c44406026e511d27ea492e83946071c96055a9 (diff)
Optionally show previous invoices on statements, #15864
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/view/cust_main_statement-pdf.cgi6
1 files changed, 5 insertions, 1 deletions
diff --git a/httemplate/view/cust_main_statement-pdf.cgi b/httemplate/view/cust_main_statement-pdf.cgi
index 7a0e19838..7c2c20799 100755
--- a/httemplate/view/cust_main_statement-pdf.cgi
+++ b/httemplate/view/cust_main_statement-pdf.cgi
@@ -23,13 +23,17 @@ my $cust_main = qsearchs({
'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
});
die "Customer #$custnum not found!" unless $cust_main;
+my $cust_bill = ($cust_main->cust_bill)[-1]
+ or die "Customer #$custnum has no invoices!";
my $cust_statement = FS::cust_statement->new({
'custnum' => $custnum,
- 'statementnum' => 'ALL', #magic
+# 'statementnum' => 'ALL', #magic
+ 'invnum' => $cust_bill->invnum,
'_date' => time,
});
+
my $pdf = $cust_statement->print_pdf( '', $templatename );
http_header('Content-Type' => 'application/pdf' );