kvadre Posted April 5, 2011 Share Posted April 5, 2011 Hi I have a problem printing from the admin module, I can print one invoice and then the second just comes up blank page, if I log out restart the browser I can print one more, I tested this on safari and firefox. Any idea why this happens? /Jesper Quote Link to comment Share on other sites More sharing options...
slowmove Posted April 15, 2011 Share Posted April 15, 2011 Hey guysm great contrib.. But I have a strange problem when the invoice is pulled. It shows for example Sub-Total: R4,900.00 Speed Services Couriers (Overnight Delivery to <b>Post office Counter</b> R70.00 Total: <strong> R4970.00</strong> Instead of: Sub-Total: R4,900.00 Speed Services Couriers (Overnight Delivery to Post office Counter R70.00 Total: R4970.00 I have changed the following: $pdf->Text(130,113, tep_html_entity_decode(ENTRY_PAYMENT_METHOD) . ' ' . tep_html_entity_decode($temp)); TO $pdf->Text(130,113, tep_html_entity_decode(ENTRY_PAYMENT_METHOD) . ' ' . tep_html_entity_decode(strip_tags($temp))); But no luck.. please help Hi, If you don't already found it... Here is how I did mine at line #676 in pdfinvoice.php. Warped around $order->totals[$i]['text'] with strip_tags() Old : $pdf->MultiCell(94,6,$order->totals[$i]['title'] . ' ' . $order->totals[$i]['text'],0,'R'); New : $pdf->MultiCell(94,6,$order->totals[$i]['title'] . ' ' . strip_tags($order->totals[$i]['text']),0,'R'); Hope it helps phoenix90 1 Quote Link to comment Share on other sites More sharing options...
phoenix90 Posted April 17, 2011 Share Posted April 17, 2011 Hi, If you don't already found it... Here is how I did mine at line #676 in pdfinvoice.php. Warped around $order->totals[$i]['text'] with strip_tags() Old : $pdf->MultiCell(94,6,$order->totals[$i]['title'] . ' ' . $order->totals[$i]['text'],0,'R'); New : $pdf->MultiCell(94,6,$order->totals[$i]['title'] . ' ' . strip_tags($order->totals[$i]['text']),0,'R'); Hope it helps THUMBS UP! Thanks so much for your help, worked perfectly:) Quote Link to comment Share on other sites More sharing options...
willtor Posted June 20, 2011 Share Posted June 20, 2011 Hi, This is a great add-on I've been using for a while on 2.2 rc2. I've recently recreated my site based on 2.3.1 and I'm getting "FPDF error: Some data has already been output, can't send PDF file" after investigation and banging my head against the walls, I've found (thanks to the KissER debugger) the following errors: Error: Undefined variable: order_id File: pdfinvoice.php Line: 102 Error: Undefined property: PDF::$angle File: fpdf/fpdf.php Line: 1091 Error: Undefined variable: item_count File: pdfinvoice.php Line: 659 Error: Use of undefined constant THANK_YOU_NOTE - assumed 'THANK_YOU_NOTE' File: pdfinvoice.php Line: 257 Did anyone experience something similar? I don't know if this contribution is really compatible with osc 2.3.1 or if I'm missing something. Any input on this would really help. Thank you. William Quote Link to comment Share on other sites More sharing options...
♥DAVID3733 Posted June 22, 2011 Share Posted June 22, 2011 Hi there I have been using this conrib (1.2)on a version of 2.2 RCa for probaly 2 years with no problems at all, i have now installed the update 1.2 email attachment but the pdf invoice just does not seem to get attached, no errors as far as i am aware, its not encoded just is missing, i also have edit order contib (5.5.9b)from which you can send also send pdf invoice attachment and duplicate new order confirmation (no text in that email at all and no pdf), again no errors, I have switched on in admin PDF Invoices>attach pdf invoice to customers order conf email, messed with the mime html toggle etc. The invoice is fine in the customer account section but no attachment email, feels like it is something silly but i have run out of ideas, anybody point me in the right direction? Thank you David Quote David Link to comment Share on other sites More sharing options...
Guest Posted July 25, 2011 Share Posted July 25, 2011 Hi all i have this line out problem can someone tell me how to enter a few emty lines? thx already Quote Link to comment Share on other sites More sharing options...
Guest Posted July 25, 2011 Share Posted July 25, 2011 (edited) hi all, When i click orders i get a white screen..(admin add on ) the phrases are cut and paste.. The customors pdf is going okay annyone have a clue? Edited July 25, 2011 by edensan Quote Link to comment Share on other sites More sharing options...
MiniGadget Posted September 12, 2011 Share Posted September 12, 2011 Hi - I have installed the pdf invoice and it works great! The only provblem is that instead of showing £ it shows £. I know that the SQL database stores £ as £ but osc must convert it back when reading from the SQL database, but the pdf reads it as £. Is there any way this can be remedied? I have tried different character sets on the SQL database but it still happens. If I change £ to £ on the database the pdf works fine; but osc shows a square box instead of £! Thanks Pete Martin Anyone figured how to get rid of this 'Â' character issue? Quote Link to comment Share on other sites More sharing options...
MiniGadget Posted September 16, 2011 Share Posted September 16, 2011 I have looked over and over this £ issue but cannot find the cause. I am on version 2.3.1 with PDF customer invoice 1.1. I have checked my charset in languages/english.php: define('CHARSET', 'UTF-8'); I have checked my database on phpMyAdmin: MySQL charset: UTF-8 Unicode (utf8) I have checked currencies in Admin: Pounds Sterling (default) Symbol Left:£ I have been over it and over it and it's starting to drive me nuts! The addon is great, looks really professional and I love the way it allows a customer to print off the invoices themselves, which is why I don't want to give up.... Any help would be very much appreciated. Quote Link to comment Share on other sites More sharing options...
OSC-Sevilla Posted December 2, 2011 Share Posted December 2, 2011 I have looked over and over this £ issue but cannot find the cause. I am on version 2.3.1 with PDF customer invoice 1.1. I have checked my charset in languages/english.php: define('CHARSET', 'UTF-8'); I have checked my database on phpMyAdmin: MySQL charset: UTF-8 Unicode (utf8) I have checked currencies in Admin: Pounds Sterling (default) Symbol Left:£ I have been over it and over it and it's starting to drive me nuts! The addon is great, looks really professional and I love the way it allows a customer to print off the invoices themselves, which is why I don't want to give up.... Any help would be very much appreciated. I too am suffering the same issue with the € sign. also i ahve notices that: Qty Model Products Price (ex) Price (inc) Total (ex) Total (inc) 1 GMF TEST - Finish: Standard - Size: 22*40*20 - Weight: Heavy .. 72.00€ 72.00€ 72.00€ 72.00€ Price (inc) is not showing the price with tax applied. anyone else had and solved this issue? Quote Link to comment Share on other sites More sharing options...
OSC-Sevilla Posted December 7, 2011 Share Posted December 7, 2011 problem solved: FPDF.php: find 2 instances of $s=str_replace("\r",'',$txt); and replace with: $s=str_replace("€", chr(128), $txt); if you have a few more characters that dont display correclty as i do (ñ and some other spanish charecters then play with this): $s=str_replace("\r",'',str_replace("€",chr(128),str_replace("ñ",chr(241), $txt))); hope this helps anyone Quote Link to comment Share on other sites More sharing options...
OSC-Sevilla Posted December 7, 2011 Share Posted December 7, 2011 simply no leaves the issue of tax on products, see attached image. Qty Model Products Price (ex) Price (inc) Total (ex) Total (inc) 1 GMF TEST - Finish: Standard - Size: 22*40*20 - Weight: Heavy .. 72.00€ 72.00€ 72.00€ 72.00€ Price (inc) is not showing the price with tax applied. is this happening to anyone else? - note: looks fine in orders.php just not on the pdf?? Quote Link to comment Share on other sites More sharing options...
OSC-Sevilla Posted December 15, 2011 Share Posted December 15, 2011 simply no leaves the issue of tax on products, see attached image. Qty Model Products Price (ex) Price (inc) Total (ex) Total (inc) 1 GMF TEST - Finish: Standard - Size: 22*40*20 - Weight: Heavy .. 72.00€ 72.00€ 72.00€ 72.00€ Price (inc) is not showing the price with tax applied. is this happening to anyone else? - note: looks fine in orders.php just not on the pdf?? carnt see the error, but the tax is not showing up...BUMP BUMP ANYONE? $pdf->MultiCell(20,6,$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']),1,'C'); $pdf->SetY($Y_Table_Position); $pdf->SetX(158); $pdf->MultiCell(20,6,$currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']),1,'C'); $pdf->SetY($Y_Table_Position); $pdf->SetX(178); $pdf->MultiCell(20,6,$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']),1,'C'); $Y_Table_Position += 6; Quote Link to comment Share on other sites More sharing options...
velja Posted January 4, 2012 Share Posted January 4, 2012 Just a (maybe stupid) question. May I try this addon on OSC v2.3.1 or there is no chance it will work without porting the code from OSC v2.2 form to v2.3.1? Thanks. Quote Link to comment Share on other sites More sharing options...
offie Posted January 5, 2012 Share Posted January 5, 2012 (edited) I have looked over and over this £ issue but cannot find the cause. I am on version 2.3.1 with PDF customer invoice 1.1. I have checked my charset in languages/english.php: Hi Dan, just a quick question. I see you are using version 2.3.1of Osc so how do you get around the code problem in catalog/admin/orders.php? As you will know, the code we are asked to look for in catalog/admin/orders.php is different in Osc 2.3.1 and several people have asked the question about this code without reply so far, so to find someone who is using this great add-on in 2.3.1 gives us all hope. ps,if you did not find your answer about the strange A character with the pound sign look at this post by me a number of months ago. http://www.oscommerce.com/forums/topic/375854-strange-letter-a-before-prices/page__view__findpost__p__1592892 Thanks, Michael Edited January 5, 2012 by offie Quote Link to comment Share on other sites More sharing options...
pete636ua Posted February 18, 2012 Share Posted February 18, 2012 Hello!!! Thanks for everyones work on this contrib! I have a problem - when the invoice is generated and the state sales tax is listed on the invoice it is blurry. Only the numbers for the actual sales tax amount are blurry the rest seems ok. any ideas on how to fix this? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Guest Posted October 16, 2012 Share Posted October 16, 2012 (edited) Apologies in advance if this is covered already but I can't find it. I have installed the addon to OS2.2 and it works fine...except the currency symbols come out wrong in the pdf ( yet fine on screen in HTML) For GB Pounds (£) I get £57.45 whereas for Euros (€) I get €57.45 For USD ($) I get $57.45 which is correct! I tried changing the currency symbol in the admin/localization Symbol Left field, I tried £ and got £57.45 I tried £ and got £57.45 I tried £ and got £57.45 Any ideas? It seems a basic error so I was surprised it isn't easy to find a solution. I have seen similar problems for other pdf applications so perhaps its something server side like a locale problem? I am yet to try it on a second machine. Txs in advance, Steve Edited October 16, 2012 by steveinjava Quote Link to comment Share on other sites More sharing options...
spacebiscuit Posted January 25, 2013 Share Posted January 25, 2013 (edited) For those who are having problems with currency symbols being output as ANSI. You're most likely using version 2.3 of OS Commerce. Here is how to fix it: 1. Download tfpdf: http://fpdf.org/en/script/script92.php 2. Unzip the file and put the tfpdf.php into your fpdf folder, eg. http://www.mystore.com/admin/fpdf/ 3. Put the 'font' folder in the same location, eg. http://www.mystore.com/admin/fpdf/ 4. Open up the original pdf_invoice.php file. find: require('fpdf/fpdf.php'); replace with: require('fpdf/tfpdf.php'); 5. Then... find: class PDF extends FPDF replace with: class PDF extends tFPDF 6. Then.... find: $pdf->AddPage(); Directly below paste: $pdf->AddFont('Arial', '', 'arial.ttf', true); $pdf->SetFont('Arial',''); That should be it, now open an invoice and you should see the currency symbols as they should be! Took me about 24 hours to figure this out so hopefully it will save others some time. Edited January 25, 2013 by spacebiscuit Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted January 28, 2013 Share Posted January 28, 2013 For anyone getting the error "FPDF error: Some data has already been output, can't send PDF file" none of the fixes in this thread worked for me and eventually I found this fix which worked! http://www.oscommerce.com/forums/topic/379324-fpdf-error-some-data-has-already-been-output-cant-send-pdf-file/ Hope that helps someone! Quote Link to comment Share on other sites More sharing options...
kvadre Posted January 29, 2013 Share Posted January 29, 2013 Hi I'm having a similar problem. I can make one pdf but when I try to make a second I get a blank screen. If I shut down the browser and try again I can make one more. I'm running Security Pro and osc_sec and have tried disabling them to no effect. Does anyone have an idea? /Jesper Quote Link to comment Share on other sites More sharing options...
67825 Posted February 23, 2013 Share Posted February 23, 2013 Hi, I have installed the add-ons: PDF_Customer_Invoice_Admin but when I when i click a customers invoice from the admin I just get an empty pdf invoice. Its like the invoice info (price etc.) is not "printet" to the invoice from the database. Some one know why? Quote Link to comment Share on other sites More sharing options...
bekatron Posted May 26, 2013 Share Posted May 26, 2013 (edited) Hi, I have installed the add-ons: PDF_Customer_Invoice_Admin but when I when i click a customers invoice from the admin I just get an empty pdf invoice. Its like the invoice info (price etc.) is not "printet" to the invoice from the database. Some one know why? Same problem here, no text but the packingslip is working well. Is there any sollution? Edited May 26, 2013 by bekatron Quote Link to comment Share on other sites More sharing options...
jan64 Posted September 17, 2013 Share Posted September 17, 2013 Hi, the last pdf customer works perfectly. i have now version 2.3.3 and i get a strange result on the invoice: I have tried amd read lots of post lot but i can't find it. anybody who knows how to solve this? thanks for your help. Jan Quote Dreams can come true, if you help them a littlebit Link to comment Share on other sites More sharing options...
bramvh Posted May 6, 2014 Share Posted May 6, 2014 Hi, I have installed this contribution in oscmax, works perfect. Just 1 question, how to add the customer TAX-number to the billing address. Company shows up, but no tax-number. Before this, i printed each invoice in the admin and there i added this code to show up the tax-number: $tax_id_query = tep_db_query("select distinct entry_company_tax_id from " . TABLE_ADDRESS_BOOK . " where entry_company = '" . $order->customer['company'] . "'"); if (tep_db_num_rows($tax_id_query)>0) { $company_tax_id=tep_db_fetch_array($tax_id_query); $tax_id=$company_tax_id[entry_company_tax_id]; } Any idea how this should be for this invoice? Quote Link to comment Share on other sites More sharing options...
dennish Posted January 30, 2015 Share Posted January 30, 2015 Hello,I have implemented PDF Customer Invoice v1.2 (3/8/2008). My OsC version is 2.3.4 (and the server uses PHP 5.3.27). The hyperlink on account_history_info.php (to pdfinvoice.php in the main catalog/ folder) generates a PDF invoice as expected. No issues there.In addition, I want to sent a PDF invoice with the order confirmation email. To accomplish this, I've put a copy of the pdfinvoice.php file in the payment modules folder: catalog/includes/modules/payment/ (See below for a test version, with paths adjusted to reflect the new location), as described in the instructions by Chris23 (readme.txt in the _add ons and bufixes/pdf_invoice_email_attachment folder of the contribution package). All seems to work well, except for the extension of the FPDF class. Any call to a function defined in the PDF class (PDF extends FPDF) fails, which prevents a successful generation of the PDF file. If I exclude the functions depending the PDF class, the PDF gets generated (of course without the subparts relying on the PDF class). A simple example to explain: if I use $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm', 'A4' ); I get nothing. If instead I use the following $pdf = new FPDF('P', 'pt', array(500,233)); I get a (incomplete) PDF attachment with my confirmation mail. The full test version of pdfinvoice.php is <?php /* $Id: pdfinvoice.php FE invoice (customer) osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ // Contributions added: // - E.U. VAT Intracom Number (090218) // - Independent invoice number (071031) define('FPDF_FONTPATH', DIR_FS_CATALOG . 'fpdf/font/'); require(DIR_FS_CATALOG . 'fpdf/fpdf.php'); // Add PDF security require(DIR_FS_CATALOG . 'fpdf/fpdf_protection.php'); // prevents reinclusion if called from checkout_process.php // require('includes/application_top.php'); require_once(DIR_FS_CATALOG . 'includes/application_top.php'); require(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/' . FILENAME_ORDERS_INVOICE ); require(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_HISTORY_INFO); // perform security check to prevent "get" tampering to view other customer's invoices /* if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "'"); $customer_info = tep_db_fetch_array($customer_info_query); if ($customer_info['customers_id'] != $customer_id) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } */ $oID = tep_db_prepare_input($HTTP_GET_VARS['order_id']); $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); // prevents reinclusion if called from checkout_process.php // require(DIR_WS_CLASSES . 'order.php'); require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'order.php'); // search order number $order = new order($oID); // Independent invoice number - Start $order->create_invoice((int)$oID); // Independent invoice number - End // function to return rgb value for fpdf from supplied hex (#abcdef) function html2rgb($color){ if ($color[0] == '#') $color = substr($color, 1); if (strlen($color) == 6) list($r, $g, $b) = array($color[0].$color[1], $color[2].$color[3], $color[4].$color[5]); elseif (strlen($color) == 3) list($r, $g, $b) = array($color[0], $color[1], $color[2]); else return false; $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); return array($r,$g,$b); } // function to decode html entities function tep_html_entity_decode($text, $quote_style = ENT_QUOTES){ return html_entity_decode($text, $quote_style); } // find image type function findextension ($filename) { $filename = strtolower($filename); // PHP 5.3+ compliance - Start // $extension= split("\.", $filename); $extension= preg_split("[\.]", $filename); // PHP 5.3+ compliance - End $n = count($extension)-1; $extension = $extension[$n]; return $extension; } // $border_color = html2rgb(PDF_INV_BORDER_COLOR); // $cell_color = html2rgb(PDF_INV_CELL_COLOR); $invoice_line = html2rgb(PDF_INV_INVLINE_COLOR); $highlight_color = html2rgb(PDF_INV_HIGHLIGHT_COLOR); $standard_color = html2rgb(PDF_INV_STANDARD_COLOR); $watermark_color = html2rgb(PDF_INV_WATERMARK_COLOR); class PDF extends FPDF { // New code - Start function MultiCellLink($w,$h,$txt,$border=0,$align='J',$fill=0,$link='') // added #,$link=''# { //Output text with automatic or explicit line breaks $cw=&$this->CurrentFont['cw']; if($w==0) $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $s=str_replace("\r",'',$txt); $nb=strlen($s); if($nb>0 && $s[$nb-1]=="\n") $nb--; $b=0; if($border) { if($border==1) { $border='LTRB'; $b='LRT'; $b2='LR'; } else { $b2=''; if(strpos($border,'L')!==false) $b2.='L'; if(strpos($border,'R')!==false) $b2.='R'; $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; } } $sep=-1; $i=0; $j=0; $l=0; $ns=0; $nl=1; while($i<$nb) { //Get next character $c=$s{$i}; if($c=="\n") { //Explicit line break if($this->ws>0) { $this->ws=0; $this->_out('0 Tw'); } $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill,$link); // added #,$link# $i++; $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; continue; } if($c==' ') { $sep=$i; $ls=$l; $ns++; } $l+=$cw[$c]; if($l>$wmax) { //Automatic line break if($sep==-1) { if($i==$j) $i++; if($this->ws>0) { $this->ws=0; $this->_out('0 Tw'); } $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill,$link); // added #,$link# } else { if($align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); } $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill,$link); // added #,$link# $i=$sep+1; } $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; } else $i++; } //Last chunk if($this->ws>0) { $this->ws=0; $this->_out('0 Tw'); } if($border && strpos($border,'B')!==false) $b.='B'; $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill,$link); // added #,$link# $this->x=$this->lMargin; } // New code - End // New code - Start var $B; var $I; var $U; var $HREF; function PDF($orientation='P',$unit='mm',$format='A4') { //Call parent constructor $this->FPDF($orientation,$unit,$format); //Initialization $this->B=0; $this->I=0; $this->U=0; $this->HREF=''; } function WriteHTML($html) { //HTML parser $html=str_replace("\n",' ',$html); $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE); foreach($a as $i=>$e) { if($i%2==0) { //Text if($this->HREF) $this->PutLink($this->HREF,$e); else $this->Write(5,$e); } else { //Tag if($e[0]=='/') $this->CloseTag(strtoupper(substr($e,1))); else { //Extract attributes $a2=explode(' ',$e); $tag=strtoupper(array_shift($a2)); $attr=array(); foreach($a2 as $v) { if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3)) $attr[strtoupper($a3[1])]=$a3[2]; } $this->OpenTag($tag,$attr); } } } } function OpenTag($tag,$attr) { //Opening tag if($tag=='B' || $tag=='I' || $tag=='U') $this->SetStyle($tag,true); if($tag=='A') $this->HREF=$attr['HREF']; if($tag=='BR') $this->Ln(5); } function CloseTag($tag) { //Closing tag if($tag=='B' || $tag=='I' || $tag=='U') $this->SetStyle($tag,false); if($tag=='A') $this->HREF=''; } function SetStyle($tag,$enable) { //Modify style and select corresponding font $this->$tag+=($enable ? 1 : -1); $style=''; foreach(array('B','I','U') as $s) { if($this->$s>0) $style.=$s; } $this->SetFont('',$style); } function PutLink($URL,$txt) { //Put a hyperlink $this->SetTextColor(0,0,255); $this->SetStyle('U',true); $this->Write(5,$txt,$URL); $this->SetStyle('U',false); $this->SetTextColor(0); } // New code - End // New code - Start function ImprovedTable($header,$data) { function is_odd($num) { if ($num % 2 == 0) { return false; } else { return true; } } //Column widths $w=array(33,33,33,33,33,33); //Header $this->Cell($w[0],7,$header[0],LTB,0,'L'); for($i=1;$i<count($header)-1;$i++){ if (is_odd($i)) { $this->Cell($w[$i],7,$header[$i],RTB,0,'L'); } else { $this->Cell($w[$i],7,$header[$i],TB,0,'L'); } } $this->Cell($w[count($header)-1],7,$header[count($header)-1],RTB,0,'L'); $this->Ln(); //Data foreach($data as $row) { $this->Cell($w[0],6,$row[0],'L'); $this->Cell($w[1],6,$row[1],'R'); $this->Cell($w[2],6,$row[2],'L',0,'L'); $this->Cell($w[3],6,$row[3],'R',0,'L'); $this->Cell($w[4],6,$row[4],'L',0,'L'); $this->Cell($w[5],6,$row[5],'R',0,'L'); $this->Ln(); } //Closure line $this->Cell(array_sum($w),0,'','T'); } // New code - End // New code - Start //Colored table function FancyTable($header2,$data2,$data3,$attribute_line,$data4) { // Column width $w=array(15,60,48,25,25,25); // Header // Colors, font and line width $this->SetFont( PDF_INV_TABLEHEADING_TEXT_FONT, PDF_INV_TABLEHEADING_TEXT_EFFECT, PDF_INV_TABLEHEADING_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_TABLEHEADING_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_TABLEHEADING_FILL_COLOR); $this->SetFillColor($cell_color[0], $cell_color[1], $cell_color[2]); $border_color=html2rgb(PDF_INV_TABLEHEADING_LINE_COLOR); $this->SetDrawColor($border_color[0], $border_color[1], $border_color[2]); $this->SetLineWidth(.3); // Header content $this->Cell($w[0],7,$header2[0],B,0,'C',true); $this->Cell($w[1],7,$header2[1],B,0,'L',true); $this->Cell($w[2],7,$header2[2],B,0,'L',true); $this->Cell($w[3],7,$header2[3],B,0,'C',true); $this->Cell($w[4],7,$header2[4],B,0,'C',true); $this->Cell($w[5],7,$header2[5],B,0,'C',true); $this->Ln(); // Data // Colors, font and line width $this->SetFont( PDF_INV_PRODUCTS_TEXT_FONT, PDF_INV_PRODUCTS_TEXT_EFFECT, PDF_INV_PRODUCTS_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_PRODUCTS_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_PRODUCTS_FILL_COLOR ); $this->SetFillColor( $cell_color[0], $cell_color[1], $cell_color[2]); $border_color=html2rgb(PDF_INV_PRODUCTS_LINE_COLOR ); $this->SetDrawColor( $border_color[0], $border_color[1], $border_color[2]); // Data content $fill=false; ksort($data2); foreach($data2 as $key => $row) { $this->Cell($w[0],6,$row[0],'LR',0,'C',$fill); $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill); $this->Cell($w[2],6,$row[2],'LR',0,'L',$fill); $this->Cell($w[3],6,$row[3],'LR',0,'R',$fill); $this->Cell($w[4],6,$row[4],'LR',0,'R',$fill); $this->Cell($w[5],6,$row[5],'LR',0,'R',$fill); $this->Ln(); if (array_key_exists($key, $data3)) { $data3a = $data3[$key]; foreach($data3a as $row2) { $this->Cell($w[0],6,$row2[0],'LR',0,'C',$fill); $this->Cell($w[1],6,$row2[1],'LR',0,'L',$fill); $this->Cell($w[2],6,$row2[2],'LR',0,'L',$fill); $this->Cell($w[3],6,$row2[3],'LR',0,'C',$fill); $this->Cell($w[4],6,$row2[4],'LR',0,'C',$fill); $this->Cell($w[5],6,$row2[5],'LR',0,'C',$fill); $this->Ln(); } } $fill=!$fill; } // Closure line $this->Cell(array_sum($w),0,'','T'); // Totals // Colors, font and line width $this->SetFont( PDF_INV_ORDERTOTAL1_TEXT_FONT, PDF_INV_ORDERTOTAL1_TEXT_EFFECT, PDF_INV_ORDERTOTAL1_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_ORDERTOTAL1_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_ORDERTOTAL1_FILL_COLOR ); $this->SetFillColor( $cell_color[0], $cell_color[1], $cell_color[2] ); $border_color=html2rgb(PDF_INV_ORDERTOTAL1_LINE_COLOR ); $this->SetDrawColor( $border_color[0], $border_color[1], $border_color[2] ); // Totals content ksort($data4); end($data4); $last = key($data4); $this->Ln(); foreach($data4 as $key => $row3) { if ($key === $last) { $this->SetFont( PDF_INV_ORDERTOTAL2_TEXT_FONT, PDF_INV_ORDERTOTAL2_TEXT_EFFECT, PDF_INV_ORDERTOTAL2_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_ORDERTOTAL2_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_ORDERTOTAL2_FILL_COLOR ); $this->SetFillColor($cell_color[0], $cell_color[1], $cell_color[2]); $border_color=html2rgb(PDF_INV_ORDERTOTAL2_LINE_COLOR ); $this->SetDrawColor($border_color[0], $border_color[1], $border_color[2]); $this->Cell($w[0],6,$row3[0],'' ,0,'C'); $this->Cell($w[1],6,$row3[1],'' ,0,'L'); $this->Cell($w[2],6,$row3[2],'' ,0,'L'); $this->Cell($w[3],6,$row3[3],'' ,0,'L'); $this->Cell($w[4],6,$row3[4],'',0,'R'); $this->Cell($w[5],6,$row3[5],LRTB,0,'R'); $this->Ln(); } else { $this->Cell($w[0],6,$row3[0],'' ,0,'C'); $this->Cell($w[1],6,$row3[1],'' ,0,'L'); $this->Cell($w[2],6,$row3[2],'' ,0,'L'); $this->Cell($w[3],6,$row3[3],'' ,0,'L'); $this->Cell($w[4],6,$row3[4],'',0,'R'); $this->Cell($w[5],6,$row3[5],LRTB,0,'R'); $this->Ln(); } } } // New code - End //Page header function RoundedRect($x, $y, $w, $h,$r, $style = '') { $k = $this->k; $hp = $this->h; if($style=='F') $op='f'; elseif($style=='FD' or $style=='DF') $op='B'; else $op='S'; $MyArc = 4/3 * (sqrt(2) - 1); $this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k )); $xc = $x+$w-$r ; $yc = $y+$r; $this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k )); $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); $xc = $x+$w-$r ; $yc = $y+$h-$r; $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k)); $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); $xc = $x+$r ; $yc = $y+$h-$r; $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k)); $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); $xc = $x+$r ; $yc = $y+$r; $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k )); $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); $this->_out($op); } function _Arc($x1, $y1, $x2, $y2, $x3, $y3) { $h = $this->h; $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1*$this->k, ($h-$y1)*$this->k, $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k)); } function Header() { // FE - Start global $highlight_color, $image_function, $html; // FE - End $bg_color=html2rgb(PDF_INV_PAGE_FILL_COLOR ); $this->SetFillColor($bg_color[0], $bg_color[1], $bg_color[2]); $this->Rect($this->lMargin,0,$this->w-$this->rMargin,$this->h,'F'); //Logo if ( PDF_INV_SHOW_LOGO == 'true' ) { // $this->Image(DIR_FS_CATALOG . DIR_WS_IMAGES . STORE_LOGO , 10,10,30,10); $size =getimagesize(DIR_FS_CATALOG . DIR_WS_IMAGES . PDF_INVOICE_IMAGE); $this->$image_function(DIR_FS_CATALOG . DIR_WS_IMAGES . PDF_INVOICE_IMAGE,7,10,($size[0]*PDF_INV_IMG_CORRECTION),($size[1]*PDF_INV_IMG_CORRECTION),'', FILENAME_DEFAULT); } // Company name $this->SetX(0); $this->SetY(10); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $this->SetTextColor($highlight_color[0],$highlight_color[1],$highlight_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(30); $this->MultiCell(50, 3.5, tep_html_entity_decode(STORE_NAME),0,'L','1'); // Company Address $this->SetX(0); $this->SetY(13.5); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(30); if ( PDF_INV_SHOW_ADRESSSHOP == 'true' ) { $this->MultiCell(50, 3.5, tep_html_entity_decode(STORE_NAME_ADDRESS),0,'L','1'); } // Telephone $this->SetX(0); $this->SetY(10); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); $this->MultiCell(60, 3.5, tep_html_entity_decode(STORE_TELEPHONE),0,'L','1'); /* // Fax $this->SetX(0); $this->SetY(13.5); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); $this->MultiCell(60, 3.5, tep_html_entity_decode(STORE_FAX),0,'L','1'); */ // Email $this->SetX(0); // $this->SetY(13.5); $this->SetY(17); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR ); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR ); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); if ( PDF_INV_SHOW_MAILWEB == 'true' ) { // $this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_EMAIL) . STORE_OWNER_EMAIL_ADDRESS,0,'R'); // $this->MultiCell(60, 3.5, STORE_OWNER_EMAIL_ADDRESS,0,'L','1'); // $html='<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>'; // $link=$this->WriteHTML($html); // $this->MultiCell(60, 3.5, $link,0,'L','1'); $this->Cell(60, 3.5, STORE_OWNER_EMAIL_ADDRESS,0,1,'L','1','mailto:' . STORE_OWNER_EMAIL_ADDRESS); // $this->MultiCellLink(60, 3.5,STORE_OWNER_EMAIL_ADDRESS,0,'L','1','mailto:' . STORE_OWNER_EMAIL_ADDRESS); } //Website $this->SetX(0); // $this->SetY(17); $this->SetY(20.5); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR ); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR ); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); if ( PDF_INV_SHOW_MAILWEB == 'true' ) { // $this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_WEB) . HTTP_SERVER,0,'R'); // $this->MultiCell(60, 3.5, HTTP_SERVER,0,'L','1'); // $html='<a href="' . HTTP_SERVER . '">' . STORE_WEBSITE . '</a>'; // $link=$this->WriteHTML($html); // $this->MultiCell(60, 3.5, $link,0,'L','1'); $this->Cell(60, 3.5, STORE_WEBSITE,0,1,'L','1',HTTP_SERVER); // $this->MultiCellLink(60, 3.5, STORE_WEBSITE,0,'L','1',HTTP_SERVER); } //Draw the top line with invoice text $this->SetX(0); $this->SetY(10); $this->SetFont( PDF_INV_HEADINVOICE_TEXT_FONT, PDF_INV_HEADINVOICE_TEXT_EFFECT, PDF_INV_HEADINVOICE_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADINVOICE_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADINVOICE_FILL_COLOR ); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADINVOICE_LINE_COLOR ); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(150); $this->MultiCell(48, 16, PRINT_INVOICE,1,'C','0'); } // function taken and modified from $Id: pdf_datasheet_functions v1.40 2005/06/16 13:46:29 ip chilipepper.it Exp $ function RotatedText($x,$y,$txt,$angle) { //Text rotated around its origin $this->Rotate($angle,$x,$y); $this->Text($x,$y,$txt); $this->Rotate(0); } function Watermark() { global $watermark_color; $this->SetFont(PDF_INV_CORE_FONT,'B',60); $this->SetTextColor($watermark_color[0], $watermark_color[1], $watermark_color[2]); $ang=30; $cos=cos(deg2rad($ang)); // $wwm=($this->GetStringWidth(tep_html_entity_decode(PDF_INV_WATERMARK_TEXT))*$cos); $wwm=($this->GetStringWidth(tep_html_entity_decode(PRINT_INV_WATERMARK_TEXT))*$cos); // $this->RotatedText(($this->w-$wwm)/2,$this->w,PDF_INV_WATERMARK_TEXT,$ang); $this->RotatedText(($this->w-$wwm)/2,$this->w,PRINT_INV_WATERMARK_TEXT,$ang); } function Footer() { global $highlight_color, $invoice_line; // General terms (if enabled) if (DISPLAY_PDF_TERMS == 'true'){ $this->SetY(-27); $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // New code - Start $this->MultiCell(0, 6, PRINT_TERMS,0,'C','0'); // New code - End } // insert horiz line $this->SetY(-21); $this->SetDrawColor($invoice_line[0],$invoice_line[1],$invoice_line[2]); $this->Cell(198,.1,'',1,1,'L',1); //Position at 1.5 cm from bottom $this->SetY(-19); // VAT / Tax number (if enabled) if (DISPLAY_PDF_TAX_NUMBER == 'true'){ $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // BOF for VAT INTRACOM_v3.3 $this->MultiCell(0, 6, tep_html_entity_decode(ENTRY_TVA_INTRACOM) . " " . TVA_SHOP_INTRACOM,0,'C','0'); // EOF for TVA_INTRACOM_v3.3 } // Chambre of Commerce number (if enabled) if (DISPLAY_PDF_COC_NUMBER == 'true'){ $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // New code - Start $this->MultiCell(0, 6, tep_html_entity_decode(ENTRY_STORE_COC) . " " . STORE_COC,0,'C','0'); // New code - End } // Bank details (if enabled) if (DISPLAY_PDF_BANK_NUMBER == 'true'){ $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // New code - Start $this->MultiCell(0, 6, STORE_BANK_ACCOUNT . ', ' . STORE_BANK_IBAN . ' ' . STORE_BANK_BIC,0,'C','0'); // New code - End } $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); //$cell_color=html2rgb(PDF_INV_FOOTER_FILL_COLOR ); //$this->SetFillColor( $cell_color[0], $cell_color[1], $cell_color[2] ); } } /*************************** * Software: FPDF_EPS * Version: 1.3 * Date: 2006-07-28 * Author: Valentin Schmidt ****************************/ class PDF_EPS extends PDF{ function PDF_EPS($orientation='P',$unit='mm',$format='A4'){ parent::FPDF($orientation,$unit,$format); } function ImageEps ($file, $x, $y, $w=0, $h=0, $link='', $useBoundingBox=true){ $data = file_get_contents($file); if ($data===false) $this->Error('EPS file not found: '.$file); # strip binary bytes in front of PS-header $start = strpos($data, '%!PS-Adobe'); if ($start>0) $data = substr($data, $start); # find BoundingBox params ereg ("%%BoundingBox:([^\r\n]+)", $data, $regs); if (count($regs)>1){ list($x1,$y1,$x2,$y2) = explode(' ', trim($regs[1])); } else $this->Error('No BoundingBox found in EPS file: '.$file); $start = strpos($data, '%%EndSetup'); if ($start===false) $start = strpos($data, '%%EndProlog'); if ($start===false) $start = strpos($data, '%%BoundingBox'); $data = substr($data, $start); $end = strpos($data, '%%PageTrailer'); if ($end===false) $end = strpos($data, 'showpage'); if ($end) $data = substr($data, 0, $end); # save the current graphic state $this->_out('q'); $k = $this->k; if ($useBoundingBox){ $dx = $x*$k-$x1; $dy = $y*$k-$y1; }else{ $dx = $x*$k; $dy = $y*$k; } # translate $this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', 1,0,0,1,$dx,$dy+($this->hPt - 2*$y*$k - ($y2-$y1)))); if ($w>0){ $scale_x = $w/(($x2-$x1)/$k); if ($h>0){ $scale_y = $h/(($y2-$y1)/$k); }else{ $scale_y = $scale_x; $h = ($y2-$y1)/$k * $scale_y; } }else{ if ($h>0){ $scale_y = $h/(($y2-$y1)/$k); $scale_x = $scale_y; $w = ($x2-$x1)/$k * $scale_x; }else{ $w = ($x2-$x1)/$k; $h = ($y2-$y1)/$k; } } # scale if (isset($scale_x)) $this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', $scale_x,0,0,$scale_y, $x1*(1-$scale_x), $y2*(1-$scale_y))); # handle pc/unix/mac line endings $lines = split ("\r\n|[\r\n]", $data); $u=0; $cnt = count($lines); for ($i=0;$i<$cnt;$i++){ $line = $lines[$i]; if ($line=='' || $line{0}=='%') continue; $len = strlen($line); if ($len>2 && $line{$len-2}!=' ') continue; $cmd = $line{$len-1}; switch ($cmd){ case 'm': case 'l': case 'v': case 'y': case 'c': case 'k': case 'K': case 'g': case 'G': case 's': case 'S': case 'J': case 'j': case 'w': case 'M': case 'd' : case 'n' : case 'v' : $this->_out($line); break; case 'x': # custom colors list($c,$m,$y,$k) = explode(' ', $line); $this->_out("$c $m $y $k k"); break; case 'Y': $line{$len-1}='y'; $this->_out($line); break; case 'N': $line{$len-1}='n'; $this->_out($line); break; case 'V': $line{$len-1}='v'; $this->_out($line); break; case 'L': $line{$len-1}='l'; $this->_out($line); break; case 'C': $line{$len-1}='c'; $this->_out($line); break; case 'b': case 'B': $this->_out($cmd . '*'); break; case 'f': case 'F': if ($u>0){ $isU = false; $max = min($i+5,$cnt); for ($j=$i+1;$j<$max;$j++) $isU = ($isU || ($lines[$j]=='U' || $lines[$j]=='*U')); if ($isU) $this->_out("f*"); }else $this->_out("f*"); break; case 'u': if ($line{0}=='*') $u++; break; case 'U': if ($line{0}=='*') $u--; break; #default: echo "$cmd<br>"; #just for debugging } } # restore previous graphic state $this->_out('Q'); if ($link) $this->Link($x,$y,$w,$h,$link); } }# END CLASS # for backward compatibility if (!function_exists('file_get_contents')){ function file_get_contents($filename, $use_include_path = 0){ $file = @fopen($filename, 'rb', $use_include_path); if ($file){ if ($fsize = @filesize($filename)) $data = fread($file, $fsize); else { $data = ''; while (!feof($file)) $data .= fread($file, 1024); } fclose($file); return $data; }else return false; } } /* // Add PDF security $pdf=new FPDF_Protection(); $pdf->SetProtection(array('copy', 'print', 'annot-forms')); */ // Instanciation of inherited class - choose according to logo supplied, vector or raster if(findextension(PDF_INVOICE_IMAGE) == 'ai' || findextension(PDF_INVOICE_IMAGE) == 'eps'){ $pdf=new PDF_EPS(); $image_function = "ImageEps"; } else{ // $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm',array(PDF_INV_PAPER_WIDTH, PDF_INV_PAPER_HEIGHT ) ) ; $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm', 'A4' ); $image_function = "Image"; } $pdf = new FPDF('P', 'pt', array(500,233)); // $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm', 'A4' ); // Define an alias for the total number of pages. It will be substituted as the document is closed. $pdf->AliasNbPages(); // Set the Page Margins $pdf->SetMargins(6,2,6); // Add the first page $pdf->AddPage(); // Check if customer resides in store home country (also a EU member!) or another EU country (relevant for VAT) $home_country_query_raw = "SELECT c.countries_id FROM " . TABLE_COUNTRIES . " c WHERE c.countries_name = '" . htmlspecialchars_decode($order->billing['country']['title']) . "' AND countries_id = '" . STORE_COUNTRY . "'"; $home_country_query = tep_db_query($home_country_query_raw); $eu_country_query_raw = "SELECT c.countries_id FROM " . TABLE_COUNTRIES . " c RIGHT JOIN " . TABLE_ZONES_TO_GEO_ZONES . " a ON c.countries_id = a.zone_country_id WHERE c.countries_name = '" . htmlspecialchars_decode($order->billing['country']['title']) . "' AND a.geo_zone_id = '2'"; $eu_country_query = tep_db_query($eu_country_query_raw); if (tep_db_num_rows($home_country_query) < 1 && tep_db_num_rows($eu_country_query) < 1) { $customer_country = 'non eu country'; // $pdf->Cell(50,10, 'buiten EU', 0,0,'L'); } elseif (tep_db_num_rows($home_country_query) < 1 && tep_db_num_rows($eu_country_query) >= 1) { $customer_country = 'eu country'; // $pdf->Cell(50,10, 'in EU', 0,0,'L'); } else { $customer_country = 'home country'; // $pdf->Cell(50,10, 'in NL', 0,0,'L'); } /* // Add watermark if required if(PDF_SHOW_WATERMARK_FE == 'true'){ $pdf->Watermark(); } */ // Set standard font $pdf->SetFont( PDF_INV_CORE_FONT, '', 10); //Draw Box for Invoice Address if ( PDF_INV_SHOW_SOLDTO == 'true' ) { // $text_color=html2rgb(PDF_INV_SOLDTO_LINE_COLOR ); // $pdf->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); // $pdf->SetLineWidth(0.2); // $cell_color=html2rgb(PDF_INV_SOLDTO_FILL_COLOR ); // $pdf->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); // $pdf->RoundedRect(6, 67, 90, 35, 2, 'DF'); // Draw the invoice address text $text_color=html2rgb(PDF_INV_SOLDTO_TEXT_COLOR ); $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $pdf->Text(7,40, tep_html_entity_decode(ENTRY_SOLD_TO)); $pdf->SetX(0); $pdf->SetY(45); // Inspringen // $pdf->Cell(10); $pdf->SetFont( PDF_INV_SOLDTO_TEXT_FONT, PDF_INV_SOLDTO_TEXT_EFFECT, PDF_INV_SOLDTO_TEXT_HEIGHT ); // Ancien code pour TVA_INTRACOM_v3.0 // $pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], $order->customer, '', '', "\n")),0,'L'); // Fin ancien code pour TVA_INTRACOM_v3.0 // BOF for VAT INTRACOM_v3.3 $pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->billing['format_id'], $order->billing, '', '', "\n")),0,'L'); // EOF for TVA_INTRACOM_v3.3 } // Return to standard font $pdf->SetFont( PDF_INV_CORE_FONT, '', 10); // Draw Box for Delivery Address // Geen afleveradres bij download if (($order_type_check == 'physical or mixed')) { if ( PDF_INV_SHOW_SENDTO == 'true' ) { // $text_color=html2rgb(PDF_INV_SENDTO_LINE_COLOR ); // $pdf->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); // $pdf->SetLineWidth(0.2); // $cell_color=html2rgb(PDF_INV_SENDTO_FILL_COLOR ); // $pdf->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); // $pdf->RoundedRect(108, 67, 90, 35, 2, 'DF'); //Draw the invoice delivery address text $text_color=html2rgb(PDF_INV_SENDTO_TEXT_COLOR ); $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $pdf->Text(100,40,tep_html_entity_decode(ENTRY_SHIP_TO)); $pdf->SetX(100); $pdf->SetY(45); // Inspringen // $pdf->Cell(111); $pdf->SetFont( PDF_INV_SENDTO_TEXT_FONT, PDF_INV_SENDTO_TEXT_EFFECT, PDF_INV_SENDTO_TEXT_HEIGHT ); $pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->delivery['format_id'], $order->delivery, '', '', "\n")),0,'L'); } } // Return to standard font $pdf->SetFont( PDF_INV_CORE_FONT, '', 9); // Thank you message to the customer $pdf->SetX(0); $pdf->SetY(80); $pdf->Cell(100,10, tep_html_entity_decode(PRINT_INVOICE_TEXT), 0,0,'L'); // In case of more than one page: pagenumber if ($pdf->PageNo() > 1) { // $pdf->Cell(100); //Page number $pdf->Cell(100,10,PRINT_INVOICE_PAGE_NUMBER . ' ' . $this->PageNo().' / {nb}',0,0,'R' ); } // Table containing invoice number, date and customer reference $pdf->SetX(0); $pdf->SetY(90); //Draw Payment Method Text $temp = substr ($order->info['payment_method'] , 0, 23); // Independent invoice number - Start // $header=array(PRINT_INVOICE_TITLE,(int)$HTTP_GET_VARS['order_id'],PRINT_ORDER_NUMBER,(int)$HTTP_GET_VARS['order_id'],'Betaling:',STORE_PAY_WITHIN); $header=array(PRINT_INVOICE_TITLE,$order->billing['invoice_serial'].$order->billing['invoice_number'],PRINT_ORDER_NUMBER, (int)$oID ,ENTRY_PAYMENT_METHOD, tep_html_entity_decode($temp)); $invoice_date_query = tep_db_query("select invoice_date as invoice_date from " . TABLE_ORDERS . " where orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "'"); $invoice_date = tep_db_fetch_array($invoice_date_query); // Independent invoice number - End function tep_unix_date($raw_date) { if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false; $year = substr($raw_date, 0, 4); $month = (int)substr($raw_date, 5, 2); $day = (int)substr($raw_date, 8, 2); $hour = (int)substr($raw_date, 11, 2); $minute = (int)substr($raw_date, 14, 2); $second = (int)substr($raw_date, 17, 2); if (@[member=date]('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) { return mktime($hour, $minute, $second, $month, $day, $year); } else { return ereg_replace('2037' . '$', $year, mktime($hour, $minute, $second, $month, $day, 2037)); } } $interval = '+' . STORE_PAY_WITHIN . ' days'; $d = tep_unix_date($invoice_date['invoice_date']); $end_date = date(DATE_FORMAT,strtotime($interval,$d)); $data=array(); $data[0][0] = PRINT_INVOICE_DATE ; $data[0][1] = tep_date_short($invoice_date['invoice_date']); $data[0][2] = PRINT_ORDER_DATE ; $data[0][3] = tep_date_short($order->info['date_purchased']); $data[0][4] = PRINT_STATUS_PAYMENT ; if ($order->info['orders_status_id'] >= VAT_REPORT_ORDER_STATUS_PAYMENT) { $data[0][5] = PRINT_STATUS_ORDER_PAID ; } else { $data[0][5] = PRINT_STATUS_ORDER_UNPAID ; } $data[1][0] = PRINT_PAY_WITHIN_DATE ; $data[1][1] = $end_date; $data[1][2] = PRINT_CUSTOMER_NUMBER ; $data[1][3] = $order->customer['id']; $data[1][4] = PRINT_PAY_WITHIN ; if ($order->info['orders_status_id'] >= VAT_REPORT_ORDER_STATUS_PAYMENT) { $data[1][5] = PRINT_PAY_WITHIN_NA ; } else { $data[1][5] = STORE_PAY_WITHIN . PRINT_PAY_WITHIN_DAYS ; } /* $pdf->ImprovedTable($header,$data); */ // Table containing order details $pdf->SetFont( PDF_INV_ORDERDETAILS_TEXT_FONT, PDF_INV_ORDERDETAILS_TEXT_EFFECT, PDF_INV_ORDERDETAILS_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_ORDERDETAILS_TEXT_COLOR ); $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); // Draw Order Number Text // $pdf->Text(10,113, tep_html_entity_decode(PRINT_INVOICE_ORDER) . (int)$HTTP_GET_VARS['order_id']); // $pdf->Cell(15,6,TABLE_HEADING_TAX,1,0,'C',1); // $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_PRICE_INCLUDING_TAX),1,0,'C',1); // $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_TOTAL_INCLUDING_TAX),1,0,'C',1); $header2=array(TABLE_HEADING_QUANTITY, TABLE_HEADING_PRODUCTS, TABLE_HEADING_PRODUCTS_MODEL, TABLE_HEADING_PRICE_EXCLUDING_TAX, TABLE_HEADING_TAX, TABLE_HEADING_TOTAL_EXCLUDING_TAX); // Add to $header2 if needed: // TABLE_HEADING_TAX // TABLE_HEADING_PRICE_INCLUDING_TAX // TABLE_HEADING_TOTAL_INCLUDING_TAX $data2=array(); //Show the products information line by line $item_count = 0 ; for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { $data2[$i][0] = $order->products[$i]['qty'] ; // New code - Start if (strlen($order->products[$i]['name']) > 40 && strlen($order->products[$i]['name']) < 50){ $data2[$i][1] = $order->products[$i]['name']; } else if (strlen($order->products[$i]['name']) > 50){ $data2[$i][1] = substr($order->products[$i]['name'],0,50); } else{ $data2[$i][1] = $order->products[$i]['name']; } $data2[$i][2] = $order->products[$i]['model']; $data2[$i][3] = str_replace(' ', ' ',$currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value'])); // Add to $data2 if needed (adjust/renumber subsequent array keys!): // For VAT purposes: // Check if product is an 'electronic service'. If so, determine the customer's country. if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) { for ($j = 0; $j < $k; $j++) { $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $order->products[$i]['id'] . "' and pov.products_options_values_name = '" . $order->products[$i]['attributes'][$j]['value'] . "' and pa.products_attributes_id = pad.products_attributes_id"); $virtual_check = tep_db_fetch_array($virtual_check_query); if ($virtual_check['total'] > 0) { $product_type_check = 'virtual'; $order_type_check = 'virtual or mixed'; break; } } } if ($product_type_check == 'virtual') { if ($customer_country == 'home country') { $data2[$i][4] = str_replace(' ', ' ',tep_display_tax_value($order->products[$i]['tax']) . '%'); } elseif ($customer_country == 'eu country') { $data2[$i][4] = '***'; } else { $data2[$i][4] = str_replace(' ', ' ',tep_display_tax_value($order->products[$i]['tax']) . '%'); } } else { $data2[$i][4] = str_replace(' ', ' ',tep_display_tax_value($order->products[$i]['tax']) . '%'); } unset($product_type_check); // New code - End // $data2[$i][3] = str_replace(' ', ' ',$currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value'])); // Add to $data2 if needed (adjust/renumber subsequent array keys!): // $data2[$i][5] = str_replace(' ', ' ',$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value'])); $data2[$i][5] = str_replace(' ', ' ',$currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value'])) ; // Add to $data2 if needed (adjust/renumber subsequent array keys!): // $data2[$i][5] = str_replace(' ', ' ',$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value'])); // Show the products attributes $data3 = array(); //get attribs if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) { $attribute_line = 'true'; for ($j = 0; $j < $k; $j++) { // New code - Start // Display product option only if option is not part of excluded list $dps = explode(',' , DISPLAY_PRODUCT_OPTIONS); if (!in_array($order->products[$i]['attributes'][$j]['option'], $dps)) { // New code - End if ($order->products[$i]['attributes'][$j]['price'] != '0') { $data3[$i][$j][1] = '- ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')' ; } else { $data3[$i][$j][1] = '- ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value']; } // New code - Start } // New code - End } //Check for product line overflow $item_count++; if ( $item_count > 20 ) { $pdf->AddPage(); //Fields Name position // $Y_Fields_Name_position = 125; //Table position, under Fields Name // $Y_Table_Position = 70; output_table_heading($Y_Table_Position-6); $item_count = 1; } } // New code - End //Check for product line overflow $item_count++; // if ((is_long($item_count / 32) && $i >= 20) || ($i == 20)){ if ( $item_count > 20 ) { $pdf->AddPage(); //Fields Name position // $Y_Fields_Name_position = 125; //Table position, under Fields Name // $Y_Table_Position = 70; output_table_heading($Y_Table_Position-6); //if ($i == 20) $item_count = 1; } } // Add totals to product table $data4=array(); $data4[0][4] = ENTRY_SUB_TOTAL; // $data4[1][4] = ENTRY_TAX; $data4[2][4] = ENTRY_TOTAL; for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { $temp = substr ($order->totals[$i]['text'],0 ,3); if ($temp == '<b>') { $temp2 = substr($order->totals[$i]['text'], 3); $order->totals[$i]['text'] = substr($temp2, 0, strlen($temp2)-4); } $data4[$i][0] = ''; $data4[$i][1] = ''; $data4[$i][2] = ''; $data4[$i][3] = ''; $data4[$i][4] = str_replace(' ', ' ',$order->totals[$i]['title']); $data4[$i][5] = str_replace(' ', ' ',$order->totals[$i]['text']); //Check for product line overflow $item_count++; if ( $item_count > 20 ) { $pdf->AddPage(); //Fields Name position // $Y_Fields_Name_position = 125; //Table position, under Fields Name // $Y_Table_Position = 70; // output_table_heading($Y_Table_Position-6); $item_count = 1; } } $pdf->Ln(); $pdf->SetY(120); /* $pdf->FancyTable($header2,$data2,$data3,$attribute_line,$data4); */ // For VAT purposes: // Check if one of the products is an 'electronic service'. If so, determine the customer's country. // $pdf->Cell(50,10, '* ' . $order->billing['country'], 0,0,'L'); // $pdf->Cell(50,10, '* ' . $order->delivery['country'], 0,0,'L'); if (($order_type_check == 'virtual or mixed') and ($order->billing['company'] != '' && $order->billing['tva_intracom'] != '' && $customer_country == 'eu country')) { $pdf->SetFont( PDF_INV_CORE_FONT, '', 10); // $highlight_color = html2rgb(PDF_INV_HIGHLIGHT_COLOR); $pdf->SetTextColor($highlight_color[0],$highlight_color[1],$highlight_color[2]); // $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR ); // $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $pdf->SetX(0); $pdf->SetY(180); $pdf->Cell(100,10, '*** ' . tep_html_entity_decode(VAT_SHIFTED_TEXT), 0,0,'L'); } // Set PDF metadata // Independent invoice number - Start // $pdf->SetTitle(PDF_META_TITLE); $pdf->SetTitle(TEXT_INVOICE.' '.$order->billing['invoice_serial'].$order->billing['invoice_number']); // $pdf->SetSubject(PDF_META_SUBJECT . $HTTP_GET_VARS['order_id']); $pdf->SetSubject(TEXT_INVOICE . ' ' . $order->billing['invoice_serial'] . $order->billing['invoice_number']); // Independent invoice number - End $pdf->SetAuthor(STORE_OWNER); // PDF created function safe_filename ($filename) { $search = array( '/ß/', '/ä/','/Ä/', '/ö/','/Ö/', '/ü/','/Ü/', '([^[:alnum:]._])' ); $replace = array( 'ss', 'ae','Ae', 'oe','Oe', 'ue','Ue', '_' ); // return a safe filename, lowercased and suffixed with invoice number. return strtolower(preg_replace($search,$replace,$filename)); } // $file_name = safe_filename(STORE_NAME); // Independent invoice number - Start // $file_name .= "_invoice_" . $HTTP_GET_VARS['order_id'] . ".pdf"; // $file_name .= "_" . TEXT_INVOICE . "_" . $order->billing['invoice_serial'].$order->billing['invoice_number']; $file_name = $order->billing['invoice_serial'].$order->billing['invoice_number']; // Independent invoice number - End // Save the pdf to a folder with setting `F` // $pdf->Output(DIR_FS_CATALOG . 'invoices/' . $file_name . '.pdf', 'F'); // PDF is created, now output the file // are we streaming for email attachment or outputting to browser? if($stream){ // return $pdf->Output( "", "S" ); $pdf_data = $pdf->Output('' , 'S'); } else { $mode = (FORCE_PDF_INVOICE_DOWNLOAD == 'true') ? 'D' : 'I'; // what do we do? display inline or force download $pdf->Output($file_name , $mode); } ?> Can anyone explain to me why the extended class PDF fails in my payment folder, but works perfectly in the setting of the main catalog/ folder (and how to fix it)?Kind regards,Dennis Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.