Little changes

This commit is contained in:
Karl Cordes 2009-10-30 17:29:20 +11:00
parent 8195307083
commit 0cee1fc8c3
6 changed files with 62 additions and 66 deletions

View file

@ -310,8 +310,10 @@ class EnquiriesController extends AppController {
//Setup the SMTP Options
$this->Email->smtpOptions = array(
'port' => '25',
'timeout' => '15',
'host' => '192.168.0.8');
'timeout' => '30',
'host' => '192.168.0.8',
'username' => 'sales',
'password' => '2seng33+02');
$this->Email->delivery = 'smtp';
$enquiry = $this->Enquiry->read(null, $id);
@ -331,9 +333,10 @@ class EnquiriesController extends AppController {
$this->redirect(array('action'=>'view/'.$id), null, false);
}
else {
$this->set('smtp_errors', $this->Email->smtpError);
$this->Session->setFlash(__('The Enquiry has been added but email to the contact has NOT been sent. Something went wrong.', true));
$this->redirect(array('action'=>'view/'.$id), null, false);
$this->set('smtp-errors', $this->Email->smtpError);
}
}

View file

@ -30,7 +30,7 @@ class QuoteProductsController extends AppController {
$product = $this->QuoteProduct->Product->findById($this->data['QuoteProduct']['product_id']);
$this->data['QuoteProduct']['description'] = $product['Product']['description'];
debug($this->data);
if ($this->QuoteProduct->save($this->data)) {
$quoteid = $this->data['QuoteProduct']['quote_id'];
@ -48,6 +48,7 @@ class QuoteProductsController extends AppController {
$currencies = $this->QuoteProduct->Currency->find('list');
$quote = $this->QuoteProduct->Quote->read(null, $quoteid);
$this->set(compact('principles', 'currencies', 'quote', 'products'));
}

BIN
vendors/tcpdf/images/cmcfooter.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

15
vendors/xtcpdf.php vendored
View file

@ -75,7 +75,7 @@ class XTCPDF extends TCPDF
function Page1Footer()
{
$this->SetY(-20);
$this->Image(K_PATH_IMAGES.'cmcfooter.png', null, 255, 200, 0, null, 'http://www.cmctechnologies.com.au', null, false, null, 'C');
$this->Image(K_PATH_IMAGES.'cmcfooter.jpg', null, 255, 200, 0, null, 'http://www.cmctechnologies.com.au', null, false, null, 'C');
}
/**
@ -88,7 +88,7 @@ class XTCPDF extends TCPDF
$boxYstart = 45;
$boxXstart = 10;
$firstColWidth = 40;
$secondColWidth = 80;
$secondColWidth = 70;
$thirdColWidth = 30;
$fourthColWidth = -10;
@ -166,9 +166,14 @@ class XTCPDF extends TCPDF
}
function continuedHeader() {
$this->Image(K_PATH_IMAGES.'cmclogosmall.jpg', 10, 10, 15, 0, null, 'http://www.cmctechnologies.com.au', null, false, null, 'L');
$this->MultiCell(0,0, 'CMC Technologies Quote Continued');
function continuedHeader($cmcRef) {
$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();
$this->MultiCell(0,13.6, "$cmcRef PAGE $pageNo OF {nb}", '', 'R');
//$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)
}

View file

@ -137,4 +137,7 @@ $boxdata['enquirynumber'] = $enquiry['Enquiry']['title'];
<?php echo $this->element('quote_table', $quotes); ?>
</div>
<?
debug($smtp_errors);
?>

View file

@ -1,16 +1,13 @@
<?php
App::import('Vendor','xtcpdf');
//App::import('Vendor', 'tcpdf/tcpdf');
//
//
print_r($quote);
print_r($enquiry);
//print_r($quote);
//print_r($enquiry);
$tcpdf = new XTCPDF();
//$tcpdf = new TCPDF();
$textfont = 'times'; // looks better, finer, and more condensed than 'dejavusans'
@ -32,15 +29,6 @@ $tcpdf->setPrintFooter(false);
//
// Now you position and print your page content
// example:
/*$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($textfont,'B',20);
$tcpdf->Cell(0,14, "Hello World", 0,1,'L');
*/
$page1done = false; //Have we already made the first page? If so, don't show the CMC header/footer
foreach ($quote['QuotePage'] as $page) {
@ -58,51 +46,49 @@ foreach ($quote['QuotePage'] as $page) {
$enquiry['Enquiry']['customer_reference'] = "Enquiry on $enquiry_date";
}
if ($quote['Quote']['revision'] > 0) {
$cmcRef = $enquiry['Enquiry']['title'].' rev '.$quote['Quote']['revision'];
}
else {
$cmcRef = $enquiry['Enquiry']['title'];
}
$tcpdf->DetailsBox($enquiry['Customer']['name'], $enquiry['Contact']['email'], $enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'],
$enquiry['User']['first_name'].' '.$enquiry['User']['last_name'], $enquiry['User']['email'], $quote['Enquiry']['title'],
$enquiry['User']['first_name'].' '.$enquiry['User']['last_name'], $enquiry['User']['email'], $cmcRef,
$enquiry['Enquiry']['customer_reference']);
}
else {
$tcpdf->continuedHeader();
$tcpdf->continuedHeader($enquiry['Enquiry']['title']);
}
$currentX = $tcpdf->GetX();
$currentY = $tcpdf->GetY();
$currentX = $tcpdf->GetX();
$currentY = $tcpdf->GetY();
$tcpdf->SetTextColor(0);
$tcpdf->SetFont('times', '', 12);
$tcpdf->SetTextColor(0);
$tcpdf->SetFont('times', '', 12);
$tcpdf->writeHTMLCell(0, 0, $currentX, $currentY+5, $page['content'], 'LTRB', 1, 0, true, 'L', true);
$tcpdf->writeHTMLCell(0, 0, $currentX, $currentY+5, $page['content'], 'LTRB', 1, 0, true, 'L', true);
/* Only show the footer if it's the first page */
if($page1done == false) {
/* Only show the footer if it's the first page */
if($page1done == false) {
$tcpdf->Page1Footer();
$page1done = true;
}
}
}
//DetailsBox($companyName, $emailTo, $attention, $fromName, $fromEmail, $enquiryNumber)
$tcpdf->AliasNbPages();
$tcpdf->lastPage();
@ -110,7 +96,7 @@ $tcpdf->lastPage();
$output_dir = '/var/www/cake/app/webroot/pdf/';
if($quote['Quote']['revision'] > 0) {
$filename = $enqury['Enquiry']['title'].'Rev'.$quote['Quote']['revision'].'.pdf';
$filename = $enquiry['Enquiry']['title'].'rev'.$quote['Quote']['revision'].'.pdf';
}
else {
$filename = $enquiry['Enquiry']['title'].'.pdf';
@ -122,6 +108,4 @@ $tcpdf->Output($output_dir.$filename, 'F');
//$tcpdf->Output('cmcquote.pdf', 'D');
?>