Little changes
This commit is contained in:
parent
8195307083
commit
0cee1fc8c3
|
|
@ -310,8 +310,10 @@ class EnquiriesController extends AppController {
|
||||||
//Setup the SMTP Options
|
//Setup the SMTP Options
|
||||||
$this->Email->smtpOptions = array(
|
$this->Email->smtpOptions = array(
|
||||||
'port' => '25',
|
'port' => '25',
|
||||||
'timeout' => '15',
|
'timeout' => '30',
|
||||||
'host' => '192.168.0.8');
|
'host' => '192.168.0.8',
|
||||||
|
'username' => 'sales',
|
||||||
|
'password' => '2seng33+02');
|
||||||
$this->Email->delivery = 'smtp';
|
$this->Email->delivery = 'smtp';
|
||||||
|
|
||||||
$enquiry = $this->Enquiry->read(null, $id);
|
$enquiry = $this->Enquiry->read(null, $id);
|
||||||
|
|
@ -331,9 +333,10 @@ class EnquiriesController extends AppController {
|
||||||
$this->redirect(array('action'=>'view/'.$id), null, false);
|
$this->redirect(array('action'=>'view/'.$id), null, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->Session->setFlash(__('The Enquiry has been added but email to the contact has NOT been sent. Something went wrong.', true));
|
$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->redirect(array('action'=>'view/'.$id), null, false);
|
||||||
$this->set('smtp-errors', $this->Email->smtpError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class QuoteProductsController extends AppController {
|
||||||
$product = $this->QuoteProduct->Product->findById($this->data['QuoteProduct']['product_id']);
|
$product = $this->QuoteProduct->Product->findById($this->data['QuoteProduct']['product_id']);
|
||||||
$this->data['QuoteProduct']['description'] = $product['Product']['description'];
|
$this->data['QuoteProduct']['description'] = $product['Product']['description'];
|
||||||
|
|
||||||
debug($this->data);
|
|
||||||
if ($this->QuoteProduct->save($this->data)) {
|
if ($this->QuoteProduct->save($this->data)) {
|
||||||
$quoteid = $this->data['QuoteProduct']['quote_id'];
|
$quoteid = $this->data['QuoteProduct']['quote_id'];
|
||||||
|
|
||||||
|
|
@ -48,6 +48,7 @@ class QuoteProductsController extends AppController {
|
||||||
$currencies = $this->QuoteProduct->Currency->find('list');
|
$currencies = $this->QuoteProduct->Currency->find('list');
|
||||||
$quote = $this->QuoteProduct->Quote->read(null, $quoteid);
|
$quote = $this->QuoteProduct->Quote->read(null, $quoteid);
|
||||||
$this->set(compact('principles', 'currencies', 'quote', 'products'));
|
$this->set(compact('principles', 'currencies', 'quote', 'products'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
BIN
vendors/tcpdf/images/cmcfooter.jpg
vendored
Normal file
BIN
vendors/tcpdf/images/cmcfooter.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
15
vendors/xtcpdf.php
vendored
15
vendors/xtcpdf.php
vendored
|
|
@ -75,7 +75,7 @@ class XTCPDF extends TCPDF
|
||||||
function Page1Footer()
|
function Page1Footer()
|
||||||
{
|
{
|
||||||
$this->SetY(-20);
|
$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;
|
$boxYstart = 45;
|
||||||
$boxXstart = 10;
|
$boxXstart = 10;
|
||||||
$firstColWidth = 40;
|
$firstColWidth = 40;
|
||||||
$secondColWidth = 80;
|
$secondColWidth = 70;
|
||||||
$thirdColWidth = 30;
|
$thirdColWidth = 30;
|
||||||
$fourthColWidth = -10;
|
$fourthColWidth = -10;
|
||||||
|
|
||||||
|
|
@ -166,9 +166,14 @@ class XTCPDF extends TCPDF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function continuedHeader() {
|
function continuedHeader($cmcRef) {
|
||||||
$this->Image(K_PATH_IMAGES.'cmclogosmall.jpg', 10, 10, 15, 0, null, 'http://www.cmctechnologies.com.au', null, false, null, 'L');
|
$this->Image(K_PATH_IMAGES.'cmclogosmall.jpg', 10, 10, 15, 13.6, null, 'http://www.cmctechnologies.com.au', null, false, null, 'L');
|
||||||
$this->MultiCell(0,0, 'CMC Technologies Quote Continued');
|
$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)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,4 +137,7 @@ $boxdata['enquirynumber'] = $enquiry['Enquiry']['title'];
|
||||||
<?php echo $this->element('quote_table', $quotes); ?>
|
<?php echo $this->element('quote_table', $quotes); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?
|
||||||
|
|
||||||
|
debug($smtp_errors);
|
||||||
|
?>
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
App::import('Vendor','xtcpdf');
|
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 XTCPDF();
|
||||||
|
|
||||||
//$tcpdf = new TCPDF();
|
|
||||||
|
|
||||||
$textfont = 'times'; // looks better, finer, and more condensed than 'dejavusans'
|
$textfont = 'times'; // looks better, finer, and more condensed than 'dejavusans'
|
||||||
|
|
||||||
|
|
@ -32,77 +29,66 @@ $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
|
$page1done = false; //Have we already made the first page? If so, don't show the CMC header/footer
|
||||||
|
|
||||||
foreach ($quote['QuotePage'] as $page) {
|
foreach ($quote['QuotePage'] as $page) {
|
||||||
|
|
||||||
$tcpdf->AddPage();
|
$tcpdf->AddPage();
|
||||||
|
|
||||||
if($page1done == false) {
|
if($page1done == false) {
|
||||||
$tcpdf->Page1Header();
|
$tcpdf->Page1Header();
|
||||||
|
|
||||||
if( (!$enqury['Enquiry']['customer_reference']) || ($enquiry['Enquiry']['customer_refernece'] == '') ) {
|
if( (!$enqury['Enquiry']['customer_reference']) || ($enquiry['Enquiry']['customer_refernece'] == '') ) {
|
||||||
|
|
||||||
$enquiry_date = date('d/m/Y',$time->toUnix($enquiry['Enquiry']['created']));
|
$enquiry_date = date('d/m/Y',$time->toUnix($enquiry['Enquiry']['created']));
|
||||||
|
|
||||||
|
|
||||||
$enquiry['Enquiry']['customer_reference'] = "Enquiry on $enquiry_date";
|
$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'], $cmcRef,
|
||||||
|
$enquiry['Enquiry']['customer_reference']);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tcpdf->continuedHeader($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'],
|
$currentX = $tcpdf->GetX();
|
||||||
$enquiry['Enquiry']['customer_reference']);
|
$currentY = $tcpdf->GetY();
|
||||||
|
|
||||||
|
$tcpdf->SetTextColor(0);
|
||||||
|
$tcpdf->SetFont('times', '', 12);
|
||||||
|
|
||||||
|
|
||||||
|
$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 */
|
||||||
else {
|
if($page1done == false) {
|
||||||
$tcpdf->continuedHeader();
|
$tcpdf->Page1Footer();
|
||||||
|
$page1done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$currentX = $tcpdf->GetX();
|
|
||||||
$currentY = $tcpdf->GetY();
|
|
||||||
|
|
||||||
$tcpdf->SetTextColor(0);
|
|
||||||
$tcpdf->SetFont('times', '', 12);
|
|
||||||
|
|
||||||
|
|
||||||
$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) {
|
|
||||||
$tcpdf->Page1Footer();
|
|
||||||
$page1done = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//DetailsBox($companyName, $emailTo, $attention, $fromName, $fromEmail, $enquiryNumber)
|
//DetailsBox($companyName, $emailTo, $attention, $fromName, $fromEmail, $enquiryNumber)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$tcpdf->AliasNbPages();
|
$tcpdf->AliasNbPages();
|
||||||
$tcpdf->lastPage();
|
$tcpdf->lastPage();
|
||||||
|
|
||||||
|
|
@ -110,7 +96,7 @@ $tcpdf->lastPage();
|
||||||
$output_dir = '/var/www/cake/app/webroot/pdf/';
|
$output_dir = '/var/www/cake/app/webroot/pdf/';
|
||||||
|
|
||||||
if($quote['Quote']['revision'] > 0) {
|
if($quote['Quote']['revision'] > 0) {
|
||||||
$filename = $enqury['Enquiry']['title'].'Rev'.$quote['Quote']['revision'].'.pdf';
|
$filename = $enquiry['Enquiry']['title'].'rev'.$quote['Quote']['revision'].'.pdf';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$filename = $enquiry['Enquiry']['title'].'.pdf';
|
$filename = $enquiry['Enquiry']['title'].'.pdf';
|
||||||
|
|
@ -122,6 +108,4 @@ $tcpdf->Output($output_dir.$filename, 'F');
|
||||||
//$tcpdf->Output('cmcquote.pdf', 'D');
|
//$tcpdf->Output('cmcquote.pdf', 'D');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in a new issue