cmc-sales/vendors/xtcpdf.php

141 lines
5.4 KiB
PHP
Raw Normal View History

<?php
App::import('Vendor','tcpdf/tcpdf');
class XTCPDF extends TCPDF
{
var $xheadertext = 'PDF created using CakePHP and TCPDF';
var $xheadercolor = array(0,0,200);
var $xfootertext = 'Copyright © %d XXXXXXXXXXX. All rights reserved.';
var $xfooterfont = PDF_FONT_NAME_MAIN ;
var $xfooterfontsize = 8 ;
/**
* Overwrites the default header
* set the text in the view using
* $fpdf->xheadertext = 'YOUR ORGANIZATION';
* set the fill color in the view using
* $fpdf->xheadercolor = array(0,0,100); (r, g, b)
* set the font in the view using
* $fpdf->setHeaderFont(array('YourFont','',fontsize));
*/
function Header()
{
2009-10-08 22:07:50 -07:00
list($r, $b, $g) = $this->xheadercolor;
2009-10-08 22:07:50 -07:00
//$this->setY(10); // shouldn't be needed due to page margin, but helas, otherwise it's at the page top
2009-10-08 22:07:50 -07:00
$this->SetFillColor(255, 255, 255);
2009-10-08 22:07:50 -07:00
$this->SetTextColor(0 , 0, 152); //Set the Text Color to Blue
2009-10-08 22:07:50 -07:00
$this->Image(K_PATH_IMAGES.'cmclogosmall.jpg', 2, 0, 30, 0, null, 'http://www.cmctechnologies.com.au', null, false, null, 'L');
$this->Cell(30);
$this->SetFont('times', 'B');
$this->Cell(0,0, $this->xheadertext, 0,1,'C', 1);
2009-10-08 22:07:50 -07:00
$this->SetFontSize(10);
$this->Cell(30);
$this->Cell(0,0, "PTY LIMITED ACN: 47 085 991 224 ABN: 47 085 991 224", 0, 1, 'C', 1);
2009-10-08 22:07:50 -07:00
$this->Rect($this->GetX()+20, $this->GetY(), 180, 2, 'DF', array('width'=>0), array(0, 0, 152));
2009-10-08 22:07:50 -07:00
/* Start the contact details */
$this->SetTextColor(0); //Set the Text Color to Black
$this->MultiCell(18, 0, "Phone:\nFax:\nEmail:\nWeb Site:\n", 0, 'L', 0, 0, 45, 25);
2009-10-08 22:07:50 -07:00
$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\nAlexandria\nNSW 2015\nAUSTRALIA\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 &\nIndustrial\nInstrumentation", 0, 'L', 0, 1, 2,28);
}
/**
* Overwrites the default footer
* set the text in the view using
* $fpdf->xfootertext = 'Copyright © %d YOUR ORGANIZATION. All rights reserved.';
*/
function Footer()
{
$year = date('Y');
$footertext = sprintf($this->xfootertext, $year);
$this->SetY(-20);
$this->SetTextColor(0, 0, 0);
$this->SetFont($this->xfooterfont,'',$this->xfooterfontsize);
$this->Cell(0,8, $footertext,'T',1,'C');
2009-10-08 22:07:50 -07:00
}
/**
* For Quotes and (hopefully) Invoices. Identifies who the document is for, date, reference number, etc.
*/
function DetailsBox($companyName, $emailTo, $attention, $fromName, $fromEmail, $enquiryNumber) {
$this->SetTextColor(0); //Black Text
$boxYstart = 45;
$boxXstart = 5;
$firstColWidth = 40;
$secondColWidth = 80;
$thirdColWidth = 30;
$fourthColWidth = 45;
$pageNo = $this->PageNoFormatted();
//$pageOf = $this->getAliasNbPages();
/* Debugging Vars */
$companyName = "SomeBigCompanyCorp";
$emailTo = "theman@theman.com";
$attention = "Joe Bloggs";
$fromName = "Mr Sales Man";
$fromEmail = "SalesMan@cmctechnologies.com.au";
$enquiryNumber = "CMC1234NE22656-41";
2009-10-08 22:07:50 -07:00
$this->SetXY($boxXstart, 45);
$this->Cell($firstColWidth, 0, "QUOTATION TO:", 'LTRB', 0, 'L', 0, null, 0, false);
$this->Cell($secondColWidth, 0, $companyName, 'LTRB', 0, 'L', 0, null, 0, false);
$this->Cell($thirdColWidth, 0, "FROM:", 'LTB', 0, 'L', 0, null, 0, false);
$this->Cell($fourthColWidth, 0, $fromName, 'TBR', 1, 'L', 0, null, 0, false); //Start a new line after this.
$this->SetX($boxXstart);
$this->Cell($firstColWidth, 0, "EMAIL TO:", 'LTRB', 0, 'L', 0, null, 0, false);
$this->Cell($secondColWidth, 0, $emailTo, 'LTRB', 0, 'L', 0, "mailto:$emailTo", 0, false);
$this->Cell($thirdColWidth, 0, "CMC REF#:", 'LTB', 0, 'L', 0, null, 0, false);
$this->Cell($fourthColWidth, 0, $enquiryNumber, 'TBR', 1, 'L', 0, null, 0, false); //Start a new line after thi
$this->SetX($boxXstart);
$this->Cell($firstColWidth, 0, "ATTENTION:", 'LTRB', 0, 'L', 0, null, 0, false);
$this->Cell($secondColWidth, 0, $attention, 'LTRB', 0, 'L', 0, "mailto:$emailTo", 0, false);
$this->Cell($thirdColWidth, 0, "PAGE: ", 'LTB', 0, 'L', 0, null, 0, false);
$this->Cell($fourthColWidth, 0, "$pageNo of {nb}", 'TBR', 1, 'L', 0, null, 0, false); //Start a new line after thi
$this->lastPage();
//$this->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link, $stretch, $ignore_min_height)
// $this->MultiCell($firstColWidth, 0, "QUOTATION TO:", 'LTRB', 'L', 0, 0, $boxXstart, $boxYstart, false, false, true, false, 0);
//Next Cell to the right.
//$this->MultiCell(50, 0, "COMPANY NAME", 'LTRB', 'L', 0, 0, $boxXstart, $boxYstart+$firstColWidth, true, false, true, true, 0);
//$this->MultiCell($w, $h, $txt, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml, $autopadding, $maxh)
}
}
?>