[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/modules/batch_print/templates/ -> Packing-Slip-and-Invoice.php (source)

   1  <?php
   2  // set paper type and size

   3  if ($pageloop == "0") {
   4  $pdf = new Cezpdf(A4,portrait);
   5  } else {
   6  
   7  define('LEFT_MARGIN','30');
   8  // The small indents in the Sold to: Ship to: Text blocks

   9  define('TEXT_BLOCK_INDENT', '5');
  10  define('SHIP_TO_COLUMN_START','300');
  11  // This changes the 'Total', 'Sub-Total', 'Tax', and 'Shipping Method' text block

  12  // position, for example if you choose to make the text a bigger font size you need to 

  13  // tweak this value in order to prevent the text from clashing together

  14  define('PRODUCT_TOTAL_TITLE_COLUMN_START','400');
  15  define('RIGHT_MARGIN','30');
  16  
  17  
  18  define('LINE_LENGTH', '552');
  19  // If you have attributes for certain products, you can have the text wrap

  20  // or just be written completely on one line, with the text wrap disabled

  21  // it makes the tables smaller appear much better, of course that is only my opinion

  22  // so I made this variable if anyone would like it to wrap.

  23  define('PRODUCT_ATTRIBUTES_TEXT_WRAP', false);
  24  // This sets the space size between sections

  25  define('SECTION_DIVIDER', '15');
  26  // Product table Settings

  27  define('TABLE_HEADER_FONT_SIZE', '9');
  28  define('TABLE_HEADER_BKGD_COLOR', DARK_GREY);
  29  define('PRODUCT_TABLE_HEADER_WIDTH', '540');
  30  // This is more like cell padding, it moves the text the number

  31  // of points specified to make the rectangle appear padded

  32  define('PRODUCT_TABLE_BOTTOM_MARGIN', '2');
  33  // Tiny indent right before the product name, again more like

  34  // the cell padding effect

  35  define('PRODUCT_TABLE_LEFT_MARGIN', '2');
  36  // Height of the product listing rectangles

  37  define('PRODUCT_TABLE_ROW_HEIGHT', '11');
  38  // The column sizes are where the product listing columns start on the

  39  // PDF page, if you make the TABLE HEADER FONT SIZE any larger you will

  40  // need to tweak these values to prevent text from clashing together

  41  define('PRODUCTS_COLUMN_SIZE', '165');
  42  define('PRODUCT_LISTING_BKGD_COLOR',GREY);
  43  define('MODEL_COLUMN_SIZE', '37');
  44  define('PRICING_COLUMN_SIZES', '67');
  45  
  46  $vilains = array("&#224;", "&#225;",  "&#226;", "&#227;", "&#228;", "&#229;", "&#230;", "&#231;", "&#232;", "&#233;", "&#234;", "&#235;", "&#236;", "&#237;", "&#238;", "&#239;", "&#240;", "&#241;", "&#242;", "&#243;", "&#244;", "&#245;", "&#246;", "&#247;", "&#248;", "&#249;", "&#250;", "&#251;", "&#252;", "&#253;", "&#254;", "&#255;", "&#223;","&#39;", "&nbsp;", "&agrave;", "&aacute;", "&atilde;","&auml;", "&Arond;", "&egrave;", "&aelig;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&Iacute;", "&icirc;", "&iuml;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&ntilde;", "&ccedil;", "&yacute;", "&lt;","&gt;", "&amp;");
  47  $cools = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','\'', ' ','','','','','','','','','','','','','','','','','','','','','','','','','','','','<','>','&');
  48  
  49  $currencies = new currencies();
  50  //$pdf->setPreferences(array("HideToolbar" => 'false', "HideWindowUI" => 'false'));

  51  $pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
  52  $pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
  53  
  54  // company name and details pulled from the my store address and phone number

  55  // in admin configuration mystore 

  56  $y = $pdf->ezText(STORE_NAME_ADDRESS,COMPANY_HEADER_FONT_SIZE);
  57  $y -= 10; 
  58  
  59  // logo image  set to right of the above .. change first number to move sideways    

  60  //$pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85); 

  61  
  62  // extra info boxs to be used by staff

  63  $pdf->setStrokeColor(0,0,0);
  64  $pdf->setLineStyle(1);
  65  $pdf->roundedRectangle(300,730,255,85,10,$f=0);
  66  //$pdf->rectangle(535,748,10,10);

  67  //$pdf->rectangle(535,769,10,10);

  68  //$pdf->rectangle(535,790,10,10);

  69  //$pdf->addText(310,790,GENERAL_FONT_SIZE,'In Stock');

  70  $pdf->addText(310,769,GENERAL_FONT_SIZE,TEXT_PACKED_BY);
  71  $pdf->addText(310,748,GENERAL_FONT_SIZE,TEXT_VERIFIED_BY);
  72  
  73  
  74  // line between header order number and order date

  75  $pdf->setLineStyle(1);
  76  $pdf->line(LEFT_MARGIN,$y,LINE_LENGTH,$y);
  77  $pdf->ezSetY($y);
  78  $dup_y = $y;
  79  
  80  // order number

  81  $y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] ."\n\n",SUB_HEADING_FONT_SIZE);
  82  
  83  // order date

  84  if ($HTTP_POST_VARS['show_order_date']) { 
  85      $pdf->ezSetY($dup_y);
  86      $pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) ."\n\n",SUB_HEADING_FONT_SIZE,array('justification'=>'right'));
  87      }
  88  
  89  
  90  
  91  
  92  //left rounded rectangle around sold to info

  93  $pdf->setStrokeColor(0,0,0);
  94  $pdf->setLineStyle(1);
  95  $pdf->roundedRectangle(28,580,260,120,10,$f=0);
  96  
  97  
  98  // sold to info in left rectangle    

  99  $pdf->addText(LEFT_MARGIN,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SOLD_TO . "</b>");
 100  
 101  $pos = $y;
 102  $indent = LEFT_MARGIN + TEXT_BLOCK_INDENT;
 103  
 104  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['name']);
 105  if ($order->billing['company'] && $order->billing['company'] != 'NULL') {
 106  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['company']);
 107  }
 108  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['street_address']);
 109  
 110  if ($order->billing['suburb'] && $order->billing['suburb'] != 'NULL') {
 111  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['suburb']);
 112  }
 113  
 114  $cty_st_zip = $order->billing['city'] . " " . $order->billing['state'] . ", " . $order->billing['postcode'];
 115  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$cty_st_zip);
 116  
 117  
 118  // right rounded rectangle around ship to info

 119  $pdf->setStrokeColor(0,0,0);
 120  $pdf->setLineStyle(1);
 121  $pdf->roundedRectangle(298,580,260,120,10,$f=0);
 122  
 123  
 124  // ship to info in right column

 125  $pdf->addText(SHIP_TO_COLUMN_START,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SHIP_TO . "</b>");
 126  
 127  $pos = $y;
 128  $indent = SHIP_TO_COLUMN_START + TEXT_BLOCK_INDENT;
 129  
 130  
 131  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['name']);
 132  if ($order->delivery['company'] && $order->delivery['company'] != 'NULL') {
 133  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['company']);
 134  }
 135  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['street_address']);
 136  
 137  if ($order->delivery['suburb'] && $order->delivery['suburb'] != 'NULL') {
 138  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['suburb']);
 139  }
 140  
 141  $cty_st_zip = $order->delivery['city'] . " " . $order->delivery['state'] . ", " . $order->delivery['postcode'];
 142  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$cty_st_zip);
 143  
 144  $country =  $order->delivery['country'];
 145  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$country);
 146  
 147  
 148  // phone and email statments .. 

 149  $pos -= SECTION_DIVIDER;
 150  $pdf->ezSetY($pos - 40 );
 151  $pos = $pdf->ezText("<b>" . ENTRY_PHONE . "</b> " . $order->customer['telephone'],GENERAL_FONT_SIZE);
 152  $pos = $pdf->ezText("<b>" . ENTRY_EMAIL . "</b> " .$order->customer['email_address'],GENERAL_FONT_SIZE);
 153  
 154  // divider between email and payment method 

 155   $pos -= SECTION_DIVIDER;
 156   $pdf->ezSetY($pos);
 157   
 158  // payment method  and type

 159  $pos = $pdf->ezText("<b>" . ENTRY_PAYMENT_METHOD . "</b> " . str_replace($vilains , $cools, $order->info['payment_method']),GENERAL_FONT_SIZE);
 160  // shipping method - I don't use this so this code is a guess for those that do

 161  //$pos = $pdf->ezText("<b>" . ENTRY_SHIPPING_METHOD . "</b> " . $order->info['shipping_method'],GENERAL_FONT_SIZE);

 162  
 163  $pos -= SECTION_DIVIDER;
 164   
 165  // products , model etc table layout 

 166  change_color(TABLE_HEADER_BKGD_COLOR);
 167  $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 168  
 169  $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 170  $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 171  
 172  change_color(GENERAL_FONT_COLOR);
 173  
 174  $pdf->addText($x,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS);
 175  $pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS_MODEL);
 176  $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TAX);
 177  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 178  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 179  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 180  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 181  
 182  $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 183  
 184  // Sort through the products

 185  
 186  for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
 187  
 188  $prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];
 189  
 190  change_color(PRODUCT_LISTING_BKGD_COLOR);
 191  $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 192  
 193  $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 194  $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 195  
 196  change_color(GENERAL_FONT_COLOR);
 197  $truncated_str = $pdf->addTextWrap($x,$pos,PRODUCTS_COLUMN_SIZE,TABLE_HEADER_FONT_SIZE,$prod_str);
 198  $pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['model']);
 199  $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,'');
 200  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 201  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 202  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 203  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,'');
 204  $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 205  if ($truncated_str) { 
 206      
 207      change_color(PRODUCT_LISTING_BKGD_COLOR);
 208      $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 209      $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 210      change_color(GENERAL_FONT_COLOR);
 211      $reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 212      $pdf->addText($reset_x,$pos,TABLE_HEADER_FONT_SIZE,$truncated_str);
 213      $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 214      
 215      }
 216      
 217      if ( ($k = sizeof($order->products[$i]['attributes'])) > 0) {
 218          for ($j = 0; $j < $k; $j++) {
 219          $attrib_string = '<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
 220          if ($order->products[$i]['attributes'][$j]['price'] != '0') { 
 221          $attrib_string .= ' (' . $order->products[$i]['attributes'][$j]['prefix'] . 
 222          $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; 
 223          
 224          }
 225          
 226          $attrib_string .= '</i>';
 227          change_color(PRODUCT_LISTING_BKGD_COLOR);
 228          $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 229          $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 230          change_color(GENERAL_FONT_COLOR);
 231          $reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 232          if (PRODUCT_ATTRIBUTES_TEXT_WRAP) {
 233          $wrapped_str = $pdf->addTextWrap($reset_x,$pos,PRODUCTS_COLUMN_SIZE,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
 234          } else { 
 235          $pdf->addText($reset_x,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
 236          }
 237          $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 238                    
 239                      if ($wrapped_str) { 
 240                      change_color(PRODUCT_LISTING_BKGD_COLOR);
 241                      $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 242                      $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 243                      change_color(GENERAL_FONT_COLOR);
 244                      $pdf->addText($reset_x,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$wrapped_str);
 245                      $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 246                      }
 247                  }
 248              }
 249    } //EOFOR

 250  
 251  $pos -= SECTION_DIVIDER;
 252  if ($orders['comments']) {
 253  $pdf->ezSetY($pos);
 254  $pdf->ezText("<b>Comments:</b>\n" . $orders['comments'],GENERAL_FONT_SIZE);
 255  }
 256  
 257  
 258  // start a new page for invoice

 259  $pdf->ezNewPage();
 260  
 261  // company name and details pulled from the my store address and phone number

 262  // in admin configuration mystore 

 263  $y = $pdf->ezText(STORE_NAME_ADDRESS,COMPANY_HEADER_FONT_SIZE);
 264  $y -= 10; 
 265  
 266  // logo image  set to right of the above .. change first number to move sideways    

 267  $pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85); 
 268  
 269  // extra info boxs to be used by staff

 270  $pdf->setStrokeColor(0,0,0);
 271  $pdf->setLineStyle(1);
 272  $pdf->roundedRectangle(470,730,85,85,10,$f=0);
 273  $pdf->rectangle(535,748,10,10);
 274  $pdf->rectangle(535,769,10,10);
 275  $pdf->rectangle(535,790,10,10);
 276  $pdf->addText(480,790,GENERAL_FONT_SIZE,TEXT_BANK);
 277  $pdf->addText(480,769,GENERAL_FONT_SIZE,TEXT_POST);
 278  $pdf->addText(480,748,GENERAL_FONT_SIZE,TEXT_SALES);
 279  
 280  
 281  // line between header order number and order date

 282  $pdf->setLineStyle(1);
 283  $pdf->line(LEFT_MARGIN,$y,LINE_LENGTH,$y);
 284  $pdf->ezSetY($y);
 285  $dup_y = $y;
 286  
 287  // order number

 288  $y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] ."\n\n",SUB_HEADING_FONT_SIZE);
 289  
 290  // order date

 291  if ($HTTP_POST_VARS['show_order_date']) { 
 292      $pdf->ezSetY($dup_y);
 293      $pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) ."\n\n",SUB_HEADING_FONT_SIZE,array('justification'=>'right'));
 294      }
 295  
 296  
 297  
 298  
 299  //left rounded rectangle around sold to info

 300  $pdf->setStrokeColor(0,0,0);
 301  $pdf->setLineStyle(1);
 302  $pdf->roundedRectangle(28,580,260,120,10,$f=0);
 303  
 304  
 305  // sold to info in left rectangle    

 306  $pdf->addText(LEFT_MARGIN,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SOLD_TO . "</b>");
 307  
 308  $pos = $y;
 309  $indent = LEFT_MARGIN + TEXT_BLOCK_INDENT;
 310  
 311  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['name']);
 312  if ($order->billing['company'] && $order->billing['company'] != 'NULL') {
 313  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['company']);
 314  }
 315  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['street_address']);
 316  
 317  if ($order->billing['suburb'] && $order->billing['suburb'] != 'NULL') {
 318  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->billing['suburb']);
 319  }
 320  
 321  $cty_st_zip = $order->billing['city'] . " " . $order->billing['state'] . ", " . $order->billing['postcode'];
 322  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$cty_st_zip);
 323  
 324  
 325  // right rounded rectangle around ship to info

 326  $pdf->setStrokeColor(0,0,0);
 327  $pdf->setLineStyle(1);
 328  $pdf->roundedRectangle(298,580,260,120,10,$f=0);
 329  
 330  
 331  
 332  // ship to info in right column

 333  $pdf->addText(SHIP_TO_COLUMN_START,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SHIP_TO . "</b>");
 334  
 335  $pos = $y;
 336  $indent = SHIP_TO_COLUMN_START + TEXT_BLOCK_INDENT;
 337  
 338  
 339  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['name']);
 340  if ($order->delivery['company'] && $order->delivery['company'] != 'NULL') {
 341  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['company']);
 342  }
 343  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['street_address']);
 344  
 345  if ($order->delivery['suburb'] && $order->delivery['suburb'] != 'NULL') {
 346  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$order->delivery['suburb']);
 347  }
 348  
 349  $cty_st_zip = $order->delivery['city'] . " " . $order->delivery['state'] . ", " . $order->delivery['postcode'];
 350  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$cty_st_zip);
 351  
 352  $country =  $order->delivery['country'];
 353  $pdf->addText($indent,$pos -= GENERAL_LEADING,GENERAL_FONT_SIZE,$country);
 354  
 355  
 356  // phone and email statments .. added blank lines if turned off so as to maintain layout

 357  if ($HTTP_POST_VARS['show_phone'] || $HTTP_POST_VARS['show_email'] ) {
 358  
 359  $pos -= SECTION_DIVIDER;
 360  $pdf->ezSetY($pos - 40 );
 361  
 362  if ($HTTP_POST_VARS['show_phone']) {
 363  $pos = $pdf->ezText("<b>" . ENTRY_PHONE . "</b> " . $order->customer['telephone'],GENERAL_FONT_SIZE);
 364  
 365  }  if ($HTTP_POST_VARS['show_email']) {
 366  $pos = $pdf->ezText("<b>" . ENTRY_EMAIL . "</b> " .$order->customer['email_address'],GENERAL_FONT_SIZE);
 367  }
 368  } else {
 369  
 370  $pos -= SECTION_DIVIDER;
 371  $pdf->ezSetY($pos - 40 );
 372  
 373  $pos = $pdf->ezText("");
 374  $pos = $pdf->ezText("");
 375  
 376  
 377  } 
 378  // divider between email and payment method 

 379   $pos -= SECTION_DIVIDER;
 380   $pdf->ezSetY($pos);
 381   
 382  // payment method  

 383  if ($HTTP_POST_VARS['show_pay_method']) {
 384  $pos = $pdf->ezText("<b>" . ENTRY_PAYMENT_METHOD . "</b> " . str_replace($vilains , $cools, $order->info['payment_method']),GENERAL_FONT_SIZE);
 385  
 386      if ($order->info['payment_method'] == PAYMENT_TYPE) {
 387  $pos = $pdf->ezText("<b>" . ENTRY_PAYMENT_TYPE . "</b> " . $order->info['cc_type'],GENERAL_FONT_SIZE);
 388  $pos = $pdf->ezText("<b>" . ENTRY_CC_OWNER . "</b> " . $order->info['cc_owner'],GENERAL_FONT_SIZE);
 389          if ($HTTP_POST_VARS['show_cc']) {
 390          $pos = $pdf->ezText("<b>" . ENTRY_CC_NUMBER . "</b> " . $order->info['cc_number'],GENERAL_FONT_SIZE);
 391          }
 392          
 393          $pos = $pdf->ezText("<b>" . ENTRY_CC_EXP . "</b> " . $order->info['cc_expires'],GENERAL_FONT_SIZE);
 394      }
 395  
 396  }
 397  $pos -= SECTION_DIVIDER;
 398   
 399  // products , model etc table layout 

 400  change_color(TABLE_HEADER_BKGD_COLOR);
 401  $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 402  
 403  $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 404  $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 405  
 406  change_color(GENERAL_FONT_COLOR);
 407  
 408  $pdf->addText($x,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS);
 409  $pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS_MODEL);
 410  $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TAX);
 411  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRICE_EXCLUDING_TAX);
 412  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRICE_INCLUDING_TAX);
 413  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TOTAL_EXCLUDING_TAX);
 414  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TOTAL_INCLUDING_TAX);
 415  
 416  $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 417  
 418  // Sort through the products

 419  
 420  for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
 421  
 422  $prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];
 423  
 424  change_color(PRODUCT_LISTING_BKGD_COLOR);
 425  $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 426  
 427  $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 428  $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 429  
 430  change_color(GENERAL_FONT_COLOR);
 431  $truncated_str = $pdf->addTextWrap($x,$pos,PRODUCTS_COLUMN_SIZE,TABLE_HEADER_FONT_SIZE,$prod_str);
 432  $pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['model']);
 433  $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['tax']);
 434  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']));
 435  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']));
 436  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']));
 437  $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$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']));
 438  $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 439  if ($truncated_str) { 
 440      
 441      change_color(PRODUCT_LISTING_BKGD_COLOR);
 442      $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 443      $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 444      change_color(GENERAL_FONT_COLOR);
 445      $reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 446      $pdf->addText($reset_x,$pos,TABLE_HEADER_FONT_SIZE,$truncated_str);
 447      $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 448      
 449      }
 450      
 451      if ( ($k = sizeof($order->products[$i]['attributes'])) > 0) {
 452          for ($j = 0; $j < $k; $j++) {
 453          $attrib_string = '<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
 454          if ($order->products[$i]['attributes'][$j]['price'] != '0') { 
 455          $attrib_string .= ' (' . $order->products[$i]['attributes'][$j]['prefix'] . 
 456          $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; 
 457          
 458          }
 459          
 460          $attrib_string .= '</i>';
 461          change_color(PRODUCT_LISTING_BKGD_COLOR);
 462          $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 463          $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 464          change_color(GENERAL_FONT_COLOR);
 465          $reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 466          if (PRODUCT_ATTRIBUTES_TEXT_WRAP) {
 467          $wrapped_str = $pdf->addTextWrap($reset_x,$pos,PRODUCTS_COLUMN_SIZE,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
 468          } else { 
 469          $pdf->addText($reset_x,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
 470          }
 471          $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 472                    
 473                      if ($wrapped_str) { 
 474                      change_color(PRODUCT_LISTING_BKGD_COLOR);
 475                      $pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
 476                      $pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
 477                      change_color(GENERAL_FONT_COLOR);
 478                      $pdf->addText($reset_x,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$wrapped_str);
 479                      $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 480                      }
 481                  }
 482              }
 483    } //EOFOR

 484  
 485  $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 486      
 487      for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
 488      
 489  $pdf->addText (LEFT_MARGIN ,$pos -= PRODUCT_TOTALS_LEADING,PRODUCT_TOTALS_FONT_SIZE,"<b>" . str_replace($vilains , $cools ,$order->totals[$i]['title']) . "</b>");
 490  $pdf->addText($x,$pos,PRODUCT_TOTALS_FONT_SIZE,$order->totals[$i]['text'], $order->info['currency_value']);
 491          
 492          } //EOFOR

 493  
 494  $pos -= SECTION_DIVIDER;
 495  if ($orders['comments']) {
 496  $pdf->ezSetY($pos);
 497  $pdf->ezText("<b>Comments:</b>\n" . $orders['comments'],GENERAL_FONT_SIZE);
 498  }
 499  
 500  
 501  }
 502  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7