summaryrefslogtreecommitdiff
path: root/httemplate/view/quotation-pdf.cgi
blob: 7f62ce173594b9f6bb29ba664e89eaffb02e2060 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<% $content %>\
<%init>

#false laziness w/elements/cust_bill-typeset

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Generate quotation'); #View quotations ?

my $quotationnum = $cgi->param('quotationnum');

my $conf = new FS::Conf;

my $quotation = qsearchs({
  'select'    => 'quotation.*',
  'table'     => 'quotation',
  #'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
  'hashref'   => { 'quotationnum' => $quotationnum },
  #'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
});
die "Quotation #$quotationnum not found!" unless $quotation;

my $content = $quotation->print_pdf(); #\%opt);

http_header('Content-Type' => 'application/pdf');
http_header('Content-Disposition' => "filename=$quotationnum.pdf" );
http_header('Content-Length' => length($content) );
http_header('Cache-control' => 'max-age=60' );

</%init>