}
                       }
                   }
               }
               */
        }
    }
    //MAKE ORDER LABEL CACHE ON SERVER PER PI SCANNED FINISH
    if ($status_current == '4' && $status_new == '5' && $order_type != 'DP') {
        use_class('barcode_label');
        $class_bl = new barcode_label();
        $scanned_pi = "{$order_type}-{$item_id}";
        $path_finished_orders = DIR_FS_MINIERP . DIR_WS_GATEWAY . "finished_orders";
        if (!is_dir($path_finished_orders)) {
            mkdir($path_finished_orders);
        }
        //CREATE 300dpi's LABEL
        $r = $class_bl->generateBarcode('code39', $scanned_pi);
        $label = $r['label'];
        if ($label != '') {
            file_put_contents("{$path_finished_orders}/{$scanned_pi}.data", $label);
        }
        //CREATE 203dpi's LABEL
        $r = $class_bl->generateBarcode('code39', $scanned_pi, '', '203');
        $label = $r['label'];
        if ($label != '') {
            file_put_contents("{$path_finished_orders}/{$scanned_pi}.data203", $label);
        }
    }
}
//ajaxReturn($result);
         if ($product_id != '' && $article_id != '') {
             $products_and_articles_id = "{$product_id};{$article_id}";
         }
     }
     $result['label'] = $class_bl->generateLabelProductTag($ean, $pi_barcode, $products_and_articles_id);
 } elseif ($label_type == 'jewelboxlabel') {
     $result_data = $class_bl->generateBoxLabel($product_id, $article_id, $productean);
 } elseif ($label_type == 'label_product_ottob2b') {
     $result_data = $class_bl->generateLabelOttoB2B($product_id, $article_id, $productean);
 } elseif ($label_type == 'label_product_hse') {
     $result_data = $class_bl->generateLabelHSE($product_id, $article_id, $productean);
 } elseif ($label_type == 'elementorderlabel') {
     $result = $class_bl->generateElementOrderLabel($barcode_id);
 } else {
     if ($barcode_id != '') {
         $result_data = $class_bl->generateBarcode($barcode_type, $barcode_id, '', $printer_resolution);
     } else {
         if ($productean != '' && ($product_id == 0 || $article_id == 0)) {
             $product = $class_pean->getProductArticle($productean);
             $product_id = $product['products_id'];
             $article_id = $product['products_articles_id'];
         }
         $products_data['products_id'] = $product_id;
         $products_data['products_articles_id'] = $article_id;
         if ($sp_id == '') {
             $sp_id = '0';
         }
         $ean_data = $class_bl->getEANReturnResult('', $products_data, $sp_id);
         $result_data = $class_bl->generateBarcode($barcode_type, '', $ean_data);
         //qty is handled no by MC (printLooping),
         //so above code is only for getting the label constructor