[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/modules/batch_print/templates/ -> Labelwriter.HTM (source)

   1  <?php
   2  // TWEAK THE SETTINGS TO SUIT YOUR LABELWRITER.

   3  // set paper type and size

   4  if ($pageloop == "0") {
   5  
   6  
   7  define('PAGE_WIDTH', '8.9');
   8  define('PAGE_HEIGHT', '3.6');
   9  $pdf = new Cezpdf(array(PAGE_WIDTH, PAGE_HEIGHT));
  10   } else {
  11  $currencies = new currencies();
  12  
  13  $pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
  14  $pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
  15  
  16  $pdf->selectFont(LABEL_PDF_DIR . 'Helvetica.afm');
  17  $pdf->setFontFamily(LABEL_PDF_DIR . 'Helvetica.afm');
  18  
  19  //These Determine the Locations of the Labels, I think dimensions are (72 * inches)

  20  // 2.54cm = 1 inch

  21  define('SHIP_FROM_COUNTRY',  '');   // eg. 'United Kingdom'

  22  define('BOX_WIDTH', '300');
  23  define('LABEL_WIDTH', '200'); //Controls the second column

  24  define('LABEL_HEIGHT', '90'); // controls the space between the labels

  25  define('LEFT_MARGIN','190');
  26  define('STARTX', '15'); //controls the first column

  27  define('STARTY', '5'); // controls the space at the top of the file

  28  
  29  //these control the little order_id text

  30  define('ORDERIDFONTSIZE', '6');
  31  define('ORDERIDXOFFSET', '20'); //position from the top right corner of label

  32  define('ORDERIDYOFFSET', '-2');
  33  define('SMALL_LEADING', '6');
  34  define('SENDER_SMALL_FONT_SIZE', '5');
  35  define('LABEL_FONT_SIZE', '9');
  36  define('LABEL_LINE_SPACING', '10');
  37  define('LABEL_FONT_COLOR', BLACK);
  38  
  39  if ($HTTP_POST_VARS['pull_status']){ $pull_w_status = " and o.orders_status = ". $HTTP_POST_VARS['pull_status']; }
  40  if ($HTTP_POST_VARS['startpos']){ $startpos = $HTTP_POST_VARS['startpos']; }
  41  else { $startpos = 0; }
  42  
  43  if ($HTTP_POST_VARS['endpos']){ $endpos = $HTTP_POST_VARS['endpos']; }
  44  else { $endpos = NUM_LABELS_PER_PAGE; }
  45  
  46  
  47  if (!tep_db_num_rows($orders_query) > 0) { message_handler('NO_ORDERS'); }
  48  
  49  change_color(LABEL_FONT_COLOR);
  50  //if ($num != 0)  $pdf->EzNewPage();

  51      $x=STARTX;
  52      $y=LABEL_HEIGHT;
  53  $pos = $y;
  54  //if ($orders = tep_db_fetch_array($orders_query)){

  55  //$order = new order($orders['orders_id']);

  56  
  57  $address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));
  58  
  59  //The first $key number is the number of lines in your store name and address excluding the telephone number at the bottom.

  60  //The second $key number is the number of lines in your store name and address excluding telephone number and country.

  61  foreach ($address_array as $key=>$value)  {
  62  if (((SHIP_FROM_COUNTRY != $order->delivery['country']) && ($key < 5)) || ($key < 4))
  63   {
  64        switch ($key)
  65     {
  66     case 0:
  67       $store_address_array[$key] = $value;
  68       break;
  69     case 1:
  70       $store_address_array[1] = $value;
  71       break;
  72          case 2:
  73       $store_address_array[2] = $value;
  74       break;
  75          case 3:
  76       $store_address_array[3] = $value;
  77       break;
  78          case 4:
  79       $store_address_array[4] = $value;
  80       break;
  81     default:
  82      $store_address_array[4] .= ', ';
  83      $store_address_array[4] .= $value;
  84      break;
  85     }
  86  
  87  }
  88  }
  89  $pdf->setStrokeColor(0,0,0);
  90  $pdf->setLineStyle(1);
  91  $pdf->roundedRectangle(10,5,170,90,10,$f=0);
  92     $pos=$y - (2*GENERAL_LEADING);
  93  
  94  //  $address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));

  95  foreach ($store_address_array as $key=>$value)  {
  96  // echo $value.'<br>' ;

  97   $pdf->addText(LEFT_MARGIN,$pos -= SMALL_LEADING,SENDER_SMALL_FONT_SIZE,$value);
  98  }
  99  $pdf->addText(LEFT_MARGIN,$pos -= LABEL_LINE_SPACING,ORDERIDFONTSIZE,'Order '.$orders['orders_id']);
 100  $pos =$y;
 101  
 102  if ($billing == true)
 103    $address_array=explode('<br>',tep_address_format($order->delivery['format_id'], $order->billing, 1, '', '<br>'));
 104  else
 105    $address_array=explode('<br>',tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'));
 106  
 107  if (SHIP_FROM_COUNTRY == $address_array[count($address_array)-1]) {
 108   $address_array[count($address_array)-1] = '';
 109   }
 110  $print_address_array = array();
 111  foreach ($address_array as $key => $value) {
 112    if ((!is_null($value))&& ($value !== "")) {
 113      $fontsize = LABEL_FONT_SIZE;
 114      while ($pdf->getTextWidth($fontsize, $value) > 160){
 115          $fontsize--;
 116      }
 117      $pdf->addText($x,$pos -= LABEL_LINE_SPACING,$fontsize,'<b>'.$value.'</b>');
 118    }
 119    }
 120  
 121  
 122  }
 123  ?>


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