cmc-sales/views/documents/pdf_invoice.ctp

73 lines
1.7 KiB
Plaintext
Raw Normal View History

2011-08-15 17:36:48 -07:00
<?php
App::import('Vendor','pdfdoc');
$pdfdoc = new PDFDOC();
$pdfdoc->SetPrintHeader(false);
$pdfdoc->SetPrintFooter(false);
$pdfdoc->AddPage();
$pdfdoc->Page1Header();
$pageTitle = "<h1>TAX INVOICE</h1>";
$pdfdoc->writeHTML($pageTitle, true, false, false, false, 'C');
$pdfdoc->SetTextColor(0);
$shippingBillingBox = $this->element('pdf_shipping_billing_box');
$pdfdoc->writeHTML($shippingBillingBox, false);
$LineItemTable = $this->element('line_items_table');
$pdfdoc->SetPrintHeader(true);
$pdfdoc->pageContent($LineItemTable);
$pdfdoc->lastPage();
if($docType == 'quote') {
$commercialComments = '<div nobr="true">'.$document['Quote']['commercial_comments'].'</div>';
$pdfdoc->pageContent($commercialComments);
}
$output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/';
$debuglevel = Configure::read('debug');
if($debuglevel == 0) {
$output_dir = '/var/www/cakephp/app/webroot/pdf/';
}
$pdfdoc->Output($output_dir.$filename, 'F');
echo "<br> Wrote: ".$output_dir.$filename;
App::import('Vendor', 'xfpdi');
//$newpdf = new concat_pdf();
$newpdf = new XFPDI();
$newpdf->SetMargins(2, 2);
$newpdf->setPrintHeader(false);
$newpdf->setPrintFooter(false);
$newpdf->setFiles(array($output_dir.$filename, $output_dir.'CMC_terms_and_conditions2006_A4.pdf'));
$newpdf->concat();
$newpdf->Output($output_dir.$filename, "F");
//$pdfdoc->Output($output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/'.'example_060.pdf', 'F');
//echo $html->link($filename, '/pdf/'.$filename);
?>
<script type="text/javascript">
//window.location.replace("/documents/view/<?=$document['Document']['id']?>");
</script>
<? debug($job); ?>
<? //debug($enquiry); ?>