<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.1.0
  @date  19/12/10, 19:49
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
/**
* @package batch_print for oscomm
* @author du module
*/
function change_color($color) {
  global $pdf;
  list($r,$g,$b) = explode(',', $color);
  $pdf->setColor($r,$g,$b);
}



/**
* @package batch_print for oscomm
* @author du module
*/
function print_address($x, $y, $nums){
  global $pdf, $num, $billing,$orders_query, $order,$orders,$languages_id;
  $pos = $y;
  if ($order){
    if ($billing == true)
      $addressparts = explode("\n", tep_address_format($order->billing['format_id'], $order->billing, 1, '', " \n"));
    else
      $addressparts = explode("\n", tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', " \n"));
    foreach($addressparts as $addresspart){
      $fontsize = GENERAL_FONT_SIZE;
      while ($pdf->getTextWidth($fontsize, $addresspart) > LABEL_WIDTH){
        $fontsize--;
      }
    $pdf->addText($x,$pos -=GENERAL_LINE_SPACING,$fontsize,$addresspart);
    }
    $pdf->addText($x + LABEL_WIDTH - ORDERIDXOFFSET - 22,$y + ORDERIDYOFFSET,ORDERIDFONTSIZE,$orders['orders_id']);
    if(($nums % NUM_LABELS_PER_PAGE) == (NUM_LABELS_PER_PAGE-1)){
      $order = false;
      return false;
    }
    else {
      if($orders = tep_db_fetch_array($orders_query)){
        $order = new order($orders['orders_id']);
        return true;
      }
      else {
        $order = false;
        return false;
      }
    }
  } else {
    return false;
  }

}
?>