if (!isset($default_cur)) {
        $default_cur = $row['price_default'];
        $default_cur_low = strtolower($default_cur);
    }
    $price = $row['price_' . $default_cur_low];
    $price_total = $row['quantity'] * $price;
    $po_price_total += $price_total;
    $row_counter++;
    $oi = array();
    $oi['no'] = $row_counter;
    $oi['qty'] = $row['quantity'];
    $oi['code'] = $row['products_model'];
    $oi['ean'] = $row['products_ean'];
    $oi['order_id'] = $row['depot_orders_id'];
    $oi['brand'] = $product->brand_name;
    $oi['desc'] = $class_pm->displayProductName($row['products_id']);
    $oi['price'] = $price;
    $oi['total'] = $price_total;
    $orders_items[] = $oi;
}
//Create new excel object
$objPHPExcel = new PHPExcel();
//First let's set width of needed columns
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(40);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(15);
 $col3w = 20;
 $ystart = 75;
 $def_lineheight = 6;
 $pdf->setFont('Arial', 'B', $fontsize_med);
 $pdf->SetXY($margin, $ystart);
 $pdf->Cell($col1w, $def_lineheight * 2, 'Artikelnummer', 1, 0);
 $pdf->Cell($col2w, $def_lineheight * 2, 'Artikelbezeichnung', 1, 0);
 $pdf->Cell($col3w, $def_lineheight * 2, 'Menge', 1, 1, 'C');
 $pdf->setFont('Arial', '', $fontsize_med);
 $item_counter = 0;
 foreach ($items as $item) {
     $item_counter++;
     $pdf->SetX($margin);
     $pdf->Cell($col1w, $def_lineheight, $item['article_number'], 1, 0);
     //                $pdf->Cell($col2w, $def_lineheight, $item['billing_text'], 1, 0);
     $pdf->Cell($col2w, $def_lineheight, $class_pm->displayProductName($item['products_id'], 65), 1, 0);
     $pdf->Cell($col3w, $def_lineheight, intval($item['order_quantity']), 1, 1, 'C');
 }
 if ($item_counter < $total_items) {
     $item_counter++;
     for ($ic = $item_counter; $ic <= $total_items; $ic++) {
         $pdf->SetX($margin);
         $pdf->Cell($col1w, $def_lineheight, '', 1, 0);
         $pdf->Cell($col2w, $def_lineheight, '', 1, 0);
         $pdf->Cell($col3w, $def_lineheight, '', 1, 1, 'C');
     }
 }
 //Items return Info
 $xpos = $margin + $col1w + $col2w + $col3w + 20;
 $col1w = 15;
 $col2w = 15;
 $ypos += 2;
 //list
 $untax_price_subtotal = 0;
 $tax_subtotal = 0;
 $vat_text = VAT * 100 . '%';
 $pdf->setFont('Arial', '', '8');
 foreach ($items as $item) {
     $ypos += 4;
     $pdf->SetXY($margin, $ypos);
     $pdf->Cell($col1w, 4, $item['products_quantity'], 0, 0, 'C');
     $pdf->Cell($col2w, 4, $item['products_model']);
     $category = $class_o->getCategories($item['orders_products_id']);
     use_class('products_brand');
     $class_pb = new products_brand();
     $product_brand = $class_pb->retrieveDetail($item['products_brand_id']);
     $product_name = $class_pm->displayProductName($item['products_id'], 47);
     //			$pdf->Cell($col3w,4,$product_name);
     $pdf->Cell($col3w, 4, html_entity_decode($product_name));
     if (!$print_delivery_note) {
         $untax_price_piece = $item['final_price'] / (1 + VAT);
         $untax_price = $item['products_quantity'] * $untax_price_piece;
         $taxed_price = $item['products_quantity'] * $item['final_price'];
         $tax = $taxed_price - $untax_price;
         $untax_price_subtotal += $untax_price;
         $tax_subtotal += $tax;
         $pdf->Cell($col4w, 4, displayCurrency($order['currency'], $untax_price_piece), 0, 0, 'R');
         $pdf->Cell($col5w, 4, displayCurrency($order['currency'], $untax_price), 0, 0, 'R');
         $pdf->Cell($col6w, 4, $vat_text, 0, 0, 'C');
         $pdf->Cell($col7w, 4, displayCurrency($order['currency'], $taxed_price), 0, 0, 'R');
     }
 }
     $materials_stone = array_search($stones_bq, $stones_mats);
 }
 if (count($stones_sizes) > 0) {
     $stones_bq = max($stones_sizes);
     $materials_stone_size = array_search($stones_bq, $stones_sizes);
 }
 $cost_price = $obj_product->isPriceSellingUsingDiscount($jng_sp_id) ? $obj_product->getPriceSelling($jng_sp_id) : $obj_product->getPriceSellingOld($jng_sp_id);
 $row = array();
 $row[] = 'X';
 $row[] = $ean;
 $row[] = '';
 //EAN rule checker
 $row[] = $pdata['p']['products_brand_name'];
 $row[] = $pdata['p']['products_model'] . ($length > 0 ? '_' . textLength($length, false) : '');
 $row[] = $pdata['categories_name'];
 $row[] = $class_pm->displayProductName($pid);
 $row[] = '';
 //Serie
 $row[] = '';
 //Color Numbers
 $row[] = implode(', ', $colors);
 $row[] = implode(',', $materials);
 $row[] = $length > 0 ? textLength($length) : '';
 $row[] = '';
 //Special Size
 $row[] = 'DAMEN';
 //Gender
 $row[] = displayCurrency('EUR', $cost_price, false);
 //Cost Price
 $row[] = displayCurrency('EUR', $obj_product->getPriceUVP(), false);
 //UVP