docpdf class now extends FPDFI. Page counts now include merged T&Cs
This commit is contained in:
parent
5637c08958
commit
234ecbbac9
23
vendors/pdfdoc.php
vendored
23
vendors/pdfdoc.php
vendored
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
App::import('Vendor','tcpdf/tcpdf');
|
||||
App::import('Vendor', 'fpdi/fpdi');
|
||||
|
||||
|
||||
class PDFDOC extends TCPDF {
|
||||
class PDFDOC extends FPDI {
|
||||
|
||||
var $xheadertext = 'CMC TECHNOLOGIES';
|
||||
var $xheadercolor = array(0,0,200);
|
||||
|
|
@ -184,6 +184,25 @@ ENDTABLE;
|
|||
}
|
||||
|
||||
|
||||
|
||||
var $files = array();
|
||||
|
||||
function setFiles($files) {
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
function concat() {
|
||||
foreach($this->files AS $file) {
|
||||
$pagecount = $this->setSourceFile($file);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplidx = $this->ImportPage($i);
|
||||
|
||||
$this->AddPage();
|
||||
$this->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -28,40 +28,7 @@ $pdfdoc->SetPrintHeader(true);
|
|||
|
||||
$pdfdoc->pageContent($LineItemTable);
|
||||
|
||||
|
||||
$pdfdoc->lastPage();
|
||||
|
||||
|
||||
$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);
|
||||
$this->element('pdf_output', array('pdfdoc'=>$pdfdoc));
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,40 +29,7 @@ $pdfdoc->SetPrintHeader(true);
|
|||
|
||||
$pdfdoc->pageContent($LineItemTable);
|
||||
|
||||
|
||||
$pdfdoc->lastPage();
|
||||
|
||||
|
||||
$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);
|
||||
$this->element('pdf_output', array('pdfdoc'=>$pdfdoc));
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -76,40 +76,8 @@ if($docType == 'quote') {
|
|||
}
|
||||
|
||||
|
||||
$output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/';
|
||||
$this->element('pdf_output', array('pdfdoc'=>$pdfdoc));
|
||||
|
||||
$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;
|
||||
//echo "Wrote:"
|
||||
|
||||
|
||||
//$tcpdf->Output('cmcquote.pdf', 'D');
|
||||
|
||||
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);
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
<? if($li['discount_percent']):?>
|
||||
<br>less<br><?=$li['discount_percent']?>%<br>
|
||||
discount*<br>
|
||||
(<?=$number->currency($li['discount_amount_total'], $currencyCode);?>)<br>
|
||||
(-<?=$number->currency($li['discount_amount_total'], $currencyCode);?>)<br>
|
||||
=<br>
|
||||
<?=$number->currency($li['net_price'], $currencyCode);?>
|
||||
<?endif;?>
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
<tr nobr="true">
|
||||
<td colspan="3" bgcolor="#f2f2f2" nobr="true">SHIPPING DETAILS:
|
||||
</td>
|
||||
<td width="<?=$colWidths['unit'];?>" bgcolor="#f2f2f2"><?=$totalsDescText['subtotal']?></td>
|
||||
<td width="<?=$colWidths['unit'];?>" bgcolor="#f2f2f2" align="left"><?=$totalsDescText['subtotal']?></td>
|
||||
<td width="<?=$colWidths['total'];?>" align="center">
|
||||
<?
|
||||
if(!$hasOptions) {
|
||||
|
|
@ -70,8 +70,8 @@
|
|||
?></td>
|
||||
</tr>
|
||||
<tr nobr="true">
|
||||
<td colspan="3" rowspan="2" nobr="true"><?=$document['Document']['shipping_details'];?></td>
|
||||
<td width="<?=$colWidths['unit'];?>" bgcolor="#f2f2f2"><?=$totalsDescText['gst'];?></td>
|
||||
<td colspan="3" rowspan="2" nobr="true" align="left"><?=$document['Document']['shipping_details'];?></td>
|
||||
<td width="<?=$colWidths['unit'];?>" bgcolor="#f2f2f2" align="left"><?=$totalsDescText['gst'];?></td>
|
||||
<td width="<?=$colWidths['total'];?>" align="center">
|
||||
<?
|
||||
if(!$hasOptions) {
|
||||
|
|
@ -86,7 +86,9 @@
|
|||
</tr>
|
||||
<tr nobr="true">
|
||||
|
||||
<td width="<?=$colWidths['unit'];?>" align="center" bgcolor="#f2f2f2"><?=$totalsDescText['total'];?><br><?=$currencyCode?></td>
|
||||
<td width="<?=$colWidths['unit'];?>" align="left" bgcolor="#f2f2f2">
|
||||
<?=$totalsDescText['total'];?>
|
||||
</td>
|
||||
<td width="<?=$colWidths['total'];?>" align="center">
|
||||
<?
|
||||
if(!$hasOptions) {
|
||||
|
|
@ -95,7 +97,10 @@
|
|||
else {
|
||||
echo $currencySymbol.'TBA';
|
||||
}
|
||||
?></td>
|
||||
?>
|
||||
<br>
|
||||
<?=$currencyCode?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
|
|||
20
views/elements/pdf_output.ctp
Normal file
20
views/elements/pdf_output.ctp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?
|
||||
$debuglevel = Configure::read('debug');
|
||||
if($debuglevel == 0) {
|
||||
$output_dir = '/var/www/cakephp/app/webroot/pdf/';
|
||||
}
|
||||
else {
|
||||
$output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/';
|
||||
|
||||
}
|
||||
|
||||
$pagecount = $pdfdoc->setSourceFile($output_dir.'CMC_terms_and_conditions2006_A4.pdf');
|
||||
for ($i = 1; $i <= $pagecount; $i++) { //Not really necessary for a 1 page T&C PDF, but handles future longer ones.
|
||||
$tplidx = $pdfdoc->ImportPage($i);
|
||||
$pdfdoc->AddPage();
|
||||
$pdfdoc->useTemplate($tplidx);
|
||||
}
|
||||
|
||||
$pdfdoc->lastPage();
|
||||
$pdfdoc->Output($output_dir.$filename, "F");
|
||||
?>
|
||||
Loading…
Reference in a new issue