diff --git a/vendors/xtcpdf.php b/vendors/xtcpdf.php index 4b0e9a45..5cbbc3a8 100644 --- a/vendors/xtcpdf.php +++ b/vendors/xtcpdf.php @@ -38,11 +38,13 @@ class XTCPDF extends TCPDF $this->Cell(0,0, $this->xheadertext, 0,1,'C', 1); $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); + $this->Cell(0,0, "PTY LIMITED ACN: 47 085 991 224 ABN: 47 085 991 224", 0, 1, 'C', 1); + + $this->Rect($this->GetX()+20, $this->GetY(), 180, 2, 'DF', array('width'=>0), array(0, 0, 152)); /* 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, 23); + $this->MultiCell(18, 0, "Phone:\nFax:\nEmail:\nWeb Site:\n", 0, 'L', 0, 0, 45, 25); @@ -82,8 +84,57 @@ class XTCPDF extends TCPDF */ 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"; + + $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) } } ?> diff --git a/views/quotes/pdf.ctp b/views/quotes/pdf.ctp index 518e83ae..30c85ba8 100644 --- a/views/quotes/pdf.ctp +++ b/views/quotes/pdf.ctp @@ -1,7 +1,7 @@ SetTopMargin(0); @@ -15,6 +15,7 @@ $tcpdf->xfootertext = 'Copyright © %d CMC Technologies. All rights reserved.'; $tcpdf->Header(); + // Now you position and print your page content // example: /*$tcpdf->SetTextColor(0, 0, 0); @@ -24,6 +25,8 @@ $tcpdf->Cell(0,14, "Hello World", 0,1,'L'); $tcpdf->AddPage(); + +$tcpdf->DetailsBox(); $content = << @@ -32,27 +35,21 @@ $content = << RE: Awesome Products

- Thank you for your enquiry regarding our Products. Please see the following quotation for:

+ Thank you for your enquiry regarding our Awesome Products. Please see the following quotation for:

- - + + - - + + - - + +
- Item - ProductItemProduct
-   -  1.0A Product (TM)
-   -  2.0Another Product
@@ -80,14 +77,18 @@ $content = <<

 

-

- SOMEONE

+ ENDCONTENT; +$currentX = $tcpdf->GetX(); +$currentY = $tcpdf->GetY(); $tcpdf->SetTextColor(0); -$tcpdf->writeHTMLCell(0, 0, $currentX, 50, $content, 'LTRB', 1, 0, true, 'L', true); +$tcpdf->SetFont('times', '', 12); + + +$tcpdf->writeHTMLCell(0, 0, $currentX, $currentY+5, $content, 'LTRB', 1, 0, true, 'L', true); $tcpdf->lastPage(); @@ -95,7 +96,7 @@ $tcpdf->AddPage(); //$tcpdf->writeHTML($content, true, 0, true, 0); $tcpdf->lastPage(); - +$tcpdf->AliasNbPages(); $tcpdf->Output('/var/www/cake/app/webroot/pdf/filename1.pdf', 'F'); ?> \ No newline at end of file diff --git a/webroot/pdf/filename1.pdf b/webroot/pdf/filename1.pdf index 6a40c418..1c06fb47 100755 Binary files a/webroot/pdf/filename1.pdf and b/webroot/pdf/filename1.pdf differ