summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-07-17 14:34:54 -0700
committerMark Wells <mark@freeside.biz>2012-07-17 14:34:54 -0700
commit493be9f0635db1e24783e5c3945b8bef39624674 (patch)
tree4cee4be7877f804084fe54f2b52bbb52a8773ae9 /httemplate
parent55393622d8e4b87dca04e037d591074bbfabb2f6 (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' );