From 79496865e97084a5acce3a618c8ef8dba3854ad2 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Wed, 23 Jun 2010 12:35:02 +1000 Subject: [PATCH] Changed first pass --- controllers/quotes_controller.php | 2 +- vendors/shells/firstpass.php | 14 +++++++++----- vendors/shells/vault.php | 9 ++++----- vendors/xtcpdf.php | 27 ++++----------------------- views/quotes/ajaxpdf.ctp | 2 +- 5 files changed, 19 insertions(+), 35 deletions(-) diff --git a/controllers/quotes_controller.php b/controllers/quotes_controller.php index 66adca60..0769ca84 100755 --- a/controllers/quotes_controller.php +++ b/controllers/quotes_controller.php @@ -2,7 +2,7 @@ class QuotesController extends AppController { var $name = 'Quotes'; - var $helpers = array('Html', 'Form','Ajax', 'Time', 'Number'); + var $helpers = array('Html', 'Form', 'Time', 'Number'); var $components = array('RequestHandler'); diff --git a/vendors/shells/firstpass.php b/vendors/shells/firstpass.php index e987968a..da60fd75 100644 --- a/vendors/shells/firstpass.php +++ b/vendors/shells/firstpass.php @@ -57,11 +57,11 @@ class FirstpassShell extends Shell { - + while($number_of_messages > 0) { // for($i=1; $i <= $number_of_messages; $i++) { - for($i=1; $i <= 500; $i++) { + for($i=1; $i <= 100; $i++) { $this_header = imap_headerinfo($mbox, $i); $message = $this->getMessage($mbox, $i, $this_header); @@ -113,13 +113,17 @@ class FirstpassShell extends Shell { imap_expunge($mbox); - /* echo "Messages before delete: ".$number_of_messages."\n"; + echo "Messages before delete: ".$number_of_messages."\n"; $check = imap_check($mbox); - echo "Messages after delete: ".$check->Nmsgs."\n"; - */ + echo "Messages after delete: ".$number_of_messages."\n"; + + $number_of_messages = $check->Nmsgs; + + + } diff --git a/vendors/shells/vault.php b/vendors/shells/vault.php index be38547f..fa45023b 100755 --- a/vendors/shells/vault.php +++ b/vendors/shells/vault.php @@ -32,8 +32,6 @@ class VaultShell extends Shell { } else { $mbox = imap_open("{192.168.0.8:143/novalidate-cert}INBOX", $username, $password) or die("can't connect: " . imap_last_error()); - - } @@ -66,7 +64,8 @@ class VaultShell extends Shell { /* Loop through the messages and sort them into ones to be processed or discarded */ - for($i=1; $i <= $number_of_messages; $i++) { + for($i=1; $i<100;$i++) { +//for($i=1; $i <= $number_of_messages; $i++) { $this_header = imap_headerinfo($mbox, $i); $message = $this->getMessage($mbox, $i, $this_header); @@ -81,7 +80,7 @@ class VaultShell extends Shell { //Process it and store the message and its attachments. //Generate a Uniqid for this email. - $uniqid = $this->getUniqId($email_dir); + // $uniqid = $this->getUniqId($email_dir); $this->Email->create(); $this->data['Email']['enquiry_id'] = $enqID; @@ -237,7 +236,7 @@ class VaultShell extends Shell { * */ - function fetchBodyAttachments($mailbox, $msg_number, $email_dir, $uniqid, $ripmime_path) { + function fetchBodyAttachments($mailbox, $msg_number, $email_dir, $ripmime_path) { diff --git a/vendors/xtcpdf.php b/vendors/xtcpdf.php index 810ca1ab..8e3326e4 100755 --- a/vendors/xtcpdf.php +++ b/vendors/xtcpdf.php @@ -11,26 +11,7 @@ class XTCPDF extends TCPDF { var $xfooterfont = PDF_FONT_NAME_MAIN ; var $xfooterfontsize = 8 ; - /* function header() { - $this->SetHeaderMargin(4); - $this->ln(); - $pageNo = $this->PageNoFormatted(); - $this->MultiCell(0, 0, "PAGE $pageNo OF {nb}", 0, "R", 0, 1); - - // $this->MultiCell($w, $h, $txt, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml) - //$this->MultiCell(0, 0, "PRICING AND SPECIFICATIONS", 0, 'C', 0, 1, null, null, true, 0, true); - $this->writeHTMLCell(0, 0, null, null, "PRICING AND SPECIFICATIONS", 0, 1, 0, true, 'C'); - } */ - - /** - * 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 Page1Header() { @@ -387,15 +368,15 @@ class XTCPDF extends TCPDF { if($product[$docType]['discount_percent'] != 0) { - + $percentage = number_format($product[$docType]['discount_percent'], 2); $unitPriceString = $this->formatCurrency($currency['symbol'], $product[$docType]['unit_price']); - $unitPriceString .= "
less ".$product[$docType]['discount_percent']."% discount
(-" + $unitPriceString .= "
less ".$percentage."% discount
(-" .$this->formatCurrency($currency['symbol'], $product[$docType]['discount_amount_each']).")
=
"; $unitPriceString .= $this->formatCurrency($currency['symbol'], $product[$docType]['net_price_each']); $totalPriceString = $this->formatCurrency($currency['symbol'], $product[$docType]['gross_price']); - $totalPriceString .= "
less ".$product[$docType]['discount_percent']."% discount
(-" + $totalPriceString .= "
less ".$percentage."% discount
(-" .$this->formatCurrency($currency['symbol'], $product[$docType]['total_discount_amount']).")
=
"; $totalPriceString .= $this->formatCurrency($currency['symbol'], $product[$docType]['net_price']); diff --git a/views/quotes/ajaxpdf.ctp b/views/quotes/ajaxpdf.ctp index 763218d9..bfdb3b3e 100644 --- a/views/quotes/ajaxpdf.ctp +++ b/views/quotes/ajaxpdf.ctp @@ -111,7 +111,7 @@ $output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/'; $debuglevel = Configure::read('debug'); if($debuglevel == 0) { - $output_dir = '/var/www/cakephp/app/webroot/pdf/'; + //$output_dir = '/var/www/cakephp/app/webroot/pdf/'; }