2011-05-24 02:52:38 -07:00
< ? php
App :: import ( 'Vendor' , 'tcpdf/tcpdf' );
class PDFDOC extends TCPDF {
var $xheadertext = 'CMC TECHNOLOGIES' ;
var $xheadercolor = array ( 0 , 0 , 200 );
var $xfootertext = 'Copyright © %d XXXXXXXXXXX. All rights reserved.' ;
var $xfooterfont = PDF_FONT_NAME_MAIN ;
var $xfooterfontsize = 8 ;
var $docRef = '' ;
function pageContent ( $content ) {
$this -> SetTextColor ( 0 );
$this -> SetFontSize ( 12 );
$this -> SetFont ( 'times' , '' );
//$this->setY(50);
//$this->MultiCell($w, $h, $txt, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml)
//$this->MultiCell(0, 0, $content, 0, 'L', false, 1, null, null, true, 0, true);
//$this->writeHTML($content);
//$this->SetHeaderMargin(0);
$this -> writeHTML ( $content , true , false , false , false , '' );
}
function Page1Header () {
$this -> setY ( 10 ); // shouldn't be needed due to page margin, but helas, otherwise it's at the page top
$this -> SetFillColor ( 255 , 255 , 255 );
$this -> SetTextColor ( 0 , 0 , 152 ); //Set the Text Color to Blue
// $this->Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $ismask, $imgmask, $border, $fitbox, $hidden)
$this -> Image ( K_PATH_IMAGES . 'cmclogosmall.jpg' , 10 , 10 , 30 , 0 , null , 'http://www.cmctechnologies.com.au' , null , false , null , 'L' );
$this -> Cell ( 30 );
$this -> SetFont ( 'times' , 'B' );
$this -> SetFontSize ( 30 );
$this -> Cell ( 0 , 0 , $this -> xheadertext , 0 , 1 , 'C' , 1 );
$this -> SetFontSize ( 10 );
$this -> SetY ( 22 );
$this -> Cell ( 30 );
$this -> Cell ( 0 , 0 , " PTY LIMITED ACN: 47 085 991 224 ABN: 47 085 991 224 " , 0 , 1 , 'C' , 1 );
//$this->Rect($x, $y, $w, $h, $style, $border_style);
$this -> Rect ( $this -> GetX () + 33 , $this -> GetY () + 2 , 157 , 1 , 'DF' , array ( 'width' => 0 ), array ( 0 , 0 , 0 ));
/* Start the contact details */
$this -> SetTextColor ( 0 ); //Set the Text Color to Black
$this -> MultiCell ( 18 , 0 , " Phone: \n Fax: \n Email: \n Web Site: \n " , 0 , 'L' , 0 , 0 , 45 , 32 );
$this -> MultiCell ( 50 , 0 , " +61 2 9669 4000<br>+61 2 9669 4111<br><a href= \" mailto:sales@cmctechnologies.com.au \" >sales@cmctechnologies.com.au</a>
< br >< a href = \ " http://www.cmctechnologies.com.au \" >www.cmctechnologies.com.au</a><br> " , 0 , 'L' , 0 , 0 , 65 , null , true , 0 , true );
$this -> MultiCell ( 50 , 0 , " Unit 19, 77 Bourke Rd \n Alexandria \n NSW 2015 \n AUSTRALIA \n " , 0 , 'L' , 0 , 0 , 150 , null );
$this -> SetTextColor ( 0 , 0 , 152 ); //Set the Text Color to Blue
$this -> SetFont ( 'times' , 'B' );
$this -> MultiCell ( 30 , 20 , " Engineering & \n Industrial \n Instrumentation " , 0 , 'L' , 0 , 1 , 10 , 37 );
}
/**
* Footer for the 1 st ( and subsequent content ) pages .
*/
function Page1Footer () {
$this -> SetAutoPageBreak ( false );
$this -> SetY ( - 20 );
$this -> MultiCell ( 0 , 2 , " <hr> " , 0 , 'C' , null , 1 , null , null , true , 0 , true , false );
$html = <<< ENDHTML
< span style = " font-size:9pt " > CMC TECHNOLOGIES Provides Solutions in the Following Fields < span >< br >
< table cellspacing = " 2 " >< tr >< td >< span style = " color: #99000a; font-weight: bold " > EXPLOSION PREVENTION AND PROTECTION </ span >& mdash ; < span style = " color: #ff0019; font-weight: bold " > PRESSURE RELIEF </ span >& mdash ; < span style = " color: #00801e; font-weight: bold " > VISION IN THE PROCESS </ span ></ td ></ tr >
< tr >< td >< span style = " color: #2f4be0; " > FLOW MEASUREMENT </ span >& mdash ; < span style = " color: #ab31f8; " > PROCESS INSTRUMENTATION </ span ></ td ></ tr >
</ table >
ENDHTML ;
//$this->writeHTML($html, true, 0, true, 0);
$this -> writeHTMLCell ( 0 , 0 , null , null , $html , 0 , 1 , false , true , 'C' , true );
//$this->writeHTMLCell($w, $h, $x, $y, $html, $border, $ln, $fill, $reseth, $align, $autopadding)
$this -> SetAutoPageBreak ( true , 20 );
}
/**
* For Quotes and ( hopefully ) Invoices . Identifies who the document is for , date , reference number , etc .
*/
function DetailsBox ( $docTypeFullName , $companyName , $emailTo , $attention , $fromName , $fromEmail , $enquiryNumber , $your_reference , $issuedate ) {
$this -> SetTextColor ( 0 ); //Black Text
$boxYstart = 45 ;
$boxXstart = 10 ;
$firstColWidth = 40 ;
$secondColWidth = 70 ;
$thirdColWidth = 30 ;
$fourthColWidth = - 10 ;
$pageNo = $this -> PageNoFormatted ();
$this -> SetXY ( $boxXstart , 55 );
$heightNeeded = $this -> getNumLines ( $companyName , $secondColWidth );
$lineHeight = 6.40997 ; //Size of a single line of text. If the company name is more, multiply this by the number of lines it needs.
2011-06-15 22:05:34 -07:00
$this -> MultiCell ( $firstColWidth , 0 , " $docTypeFullName TO: " , 'LTR' , 'L' , 0 , 0 );
$this -> MultiCell ( $secondColWidth , 0 , $companyName , 'LTR' , 'L' , 0 , 0 );
2011-05-24 02:52:38 -07:00
2011-06-15 23:14:32 -07:00
$fromString = <<< ENDSTRING
< a href = " mailto: { $fromEmail } " > { $fromName } </ a >
ENDSTRING ;
2011-06-15 22:05:34 -07:00
$this -> MultiCell ( $thirdColWidth , 0 , " FROM: " , 'LT' , 'L' , 0 , 0 );
2011-06-15 23:14:32 -07:00
$this -> MultiCell ( $fourthColWidth , 0 , $fromString , 'TR' , 'L' , 0 , 1 , null , null , true , 0 , true ); //Start a new line after this.
2011-05-24 02:52:38 -07:00
$this -> MultiCell ( $firstColWidth , 0 , " EMAIL TO: " , 'LR' , 'L' , 0 , 0 );
$this -> MultiCell ( $secondColWidth , 0 , " <a href= \" mailto: $emailTo\ " > $emailTo </ a > " , 'LR','L', 0, 0, null, null, true, 0, true);
$this -> MultiCell ( $thirdColWidth , 0 , " CMC REF#: " , 'L' , 'L' , 0 , 0 );
$this -> MultiCell ( $fourthColWidth , 0 , $enquiryNumber , 'R' , 'L' , 0 , 1 ); //Start a new line after thi
$this -> MultiCell ( $firstColWidth , 0 , " ATTENTION: " , 'LRB' , 'L' , 0 , 0 );
$this -> MultiCell ( $secondColWidth , 0 , $attention , 'LRB' , 'L' , 0 , 0 );
$this -> MultiCell ( $thirdColWidth , 0 , " PAGE: " , 'LB' , 'L' , 0 , 0 );
2011-05-24 03:15:21 -07:00
$this -> MultiCell ( $fourthColWidth , 0 , " $pageNo of { nb} " , 'BR' , 'L' , 0 , 1 );
2011-05-24 02:52:38 -07:00
$todayPHPdate = strtotime ( $issuedate );
$todaysDateString = date ( 'l, j F Y' , $todayPHPdate );
$this -> MultiCell ( $firstColWidth + $secondColWidth , 0 , " DATE: $todaysDateString " , 'LRB' , 'L' , 0 , 0 );
$this -> MultiCell ( $thirdColWidth , 0 , " YOUR REF: " , 'LB' , 'L' , 0 , 0 );
$this -> MultiCell ( $fourthColWidth , 0 , $your_reference , 'BR' , 'L' , 0 , 1 );
$this -> SetFontSize ( 7 );
//Kinda lame that I cant seem to wrap this text nicer. But Whatever.
$this -> MultiCell ( 0 , 0 , 'The information in this document is confidential and may be privileged. If you are not the indended recipient then access, disclosure, copying or other dissemination of the contents of t his message is unauthorised and may be unlawful. Please inform the sender immediately if you are not the intended addressee.' ,
'' , 'L' , false , 1
);
$this -> writeHTMLCell ( 0 , 0 , null , null , '<br><hr>' , 0 , 1 , false , true , 'C' , false );
}
2011-06-15 20:27:33 -07:00
/**
* For Quotes and ( hopefully ) Invoices . Identifies who the document is for , date , reference number , etc .
*/
function DetailsBoxHTML ( $docTypeFullName , $companyName , $emailTo , $attention , $fromName , $fromEmail , $enquiryNumber , $your_reference , $issuedate ) {
$table = <<< ENDTABLE
2011-06-15 22:05:34 -07:00
< table border = " 1 " cellspacing = " 0 " cellpadding = " 2 " >
< tr >
< td rowspan = " 3 " > QUOTATION TO :< br /> EMAIL TO :< br /> ATTENTION :</ td >
< td rowspan = " 3 " > { $companyName } </ td >
2011-06-15 20:27:33 -07:00
< td > FROM :</ td >
< td >< a href = " mailto: { $fromEmail } " > { $fromName } </ a ></ td >
</ tr >
2011-06-15 22:05:34 -07:00
< tr >
< td > EMAIL </ td >
< td > WTF ? </ td >
< td > RAH </ td >
</ tr >
< tr >
< td > EMAIL </ td >
< td > WTF ? </ td >
< td > RAH </ td >
</ tr >
2011-06-15 20:27:33 -07:00
</ table >
ENDTABLE ;
$this -> SetTextColor ( 0 ); //Black Text
2011-06-15 22:05:34 -07:00
2011-06-15 20:27:33 -07:00
$this -> writeHTMLCell ( 0 , 0 , null , null , $table , null , 1 , null , true , 'L' , false );
2011-06-15 22:05:34 -07:00
$this -> SetFontSize ( 7 );
2011-06-15 20:27:33 -07:00
2011-06-15 22:05:34 -07:00
//Kinda lame that I cant seem to wrap this text nicer. But Whatever.
$this -> MultiCell ( 0 , 0 , 'The information in this document is confidential and may be privileged. If you are not the indended recipient then access, disclosure, copying or other dissemination of the contents of t his message is unauthorised and may be unlawful. Please inform the sender immediately if you are not the intended addressee.' ,
'' , 'L' , false , 1
);
$this -> writeHTMLCell ( 0 , 0 , null , null , '<br><hr>' , 0 , 1 , false , true , 'C' , false );
2011-06-15 20:27:33 -07:00
}
2011-05-24 02:52:38 -07:00
function header () {
//$this->Image(K_PATH_IMAGES.'cmclogosmall.jpg', 10, 10, 15, 13.6, null, 'http://www.cmctechnologies.com.au', null, false, null, 'L');
$this -> SetFontSize ( 10 );
$pageNo = $this -> PageNoFormatted ();
//$currentX = $this->GetX();
//$this->SetX($currentX + 40);
// $this->writeHTMLCell(0, 0, null, null, 'CONTINUES', -10, 1, false,true, 'C', false);
//$this->MultiCell(100, 13.6,"CONTINUES", 0,'C', false, 10, 60);
$this -> MultiCell ( 0 , 13.6 , " PAGE $pageNo OF { nb} " , '' , 'R' , false , 0 , 10 , 5 );
//$this->MultiCell($w, $h, $txt, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml)
//$this->Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi)
2011-06-15 20:27:33 -07:00
2011-05-24 02:52:38 -07:00
}
}
?>