$items_mmo[] = $oiid;
             $item_do = $class_do->transferFromRealOrder(SEGMENT_ID_HAMBURG, $order_type, $oiid);
             if ($oi['status'] != $new_status) {
                 //PRODUCT IS NOT YET MOVED TO IN HH TAB
                 //CREATE A DEPOT ORDER TRANSFER FROM NORMAL ORDER AS THE MMO
                 $add_to_prod_target = false;
                 //DONT ADD TO GRAPH STATISTIC BECAUSE SOURCE ORDER HAS ALREADY TRIGGERED IT
                 //if($item_do['status']!=$oi['status']) $class_do->updateStatus($item_do['depot_orders_id'], $oi['status'], 'auto-set', $add_to_prod_target);
                 //HANDLE ALSO SUB STATUS IN CASE THERE ORDER IN PROD SUB STATUS WHICH TAKEN OVER HH
                 $do_status = $item_do['status'] . "-" . $item_do['prod_status'];
                 $oi_status = $oi['status'] . "-" . $oi['prod_status'];
                 if ($do_status != $oi_status) {
                     $class_do->updateStatus($item_do['depot_orders_id'], $oi_status, 'auto-set', $add_to_prod_target);
                 }
                 if ($oi['print_count'] > 0) {
                     $class_do->printCountAdd($item_do['depot_orders_id']);
                 }
                 if ($oi['print_confirmed'] > 0) {
                     $class_do->printConfirmAdd($item_do['depot_orders_id']);
                 }
                 if ($order_type == 'SP') {
                     $class_jo->updateItemStockStatus($oiid, '0');
                     $class_jo->updateItemStatus($oiid, $new_status, 'auto-set');
                 } else {
                     $class_o->updateProductStockStatus($oiid, '0');
                     $class_o->updateProductStatus($oiid, $new_status, 'auto-set');
                 }
             }
         }
     }
 } else {
 function printProductionInstruction()
 {
     global $ENGRAVED_PRODUCTS;
     //HEADER
     $header = array();
     $header[] = '<html>';
     $header[] = '<head>';
     $header[] = '<title>JULIE &amp; GRACE Production Instruction</title>';
     $header[] = '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />';
     $header[] = '<link rel="stylesheet" type="text/css" href="production.css">';
     $header[] = '</head>';
     $header[] = '<body>';
     $header[] = '<div id="production">';
     //CONTENT:
     $pi_printed_jng = array();
     $pi_printed_sp = array();
     $pi_printed_dp = array();
     $content = array();
     foreach ($this->orders_products as $orders_id => $products) {
         foreach ($products as $p) {
             $order = $this->orders[$orders_id];
             ${'pi_printed_' . strtolower($order['type'])}[] = $p['item_id'];
             //CHECK CHANGE LENGTH
             $change_length_notice = '';
             if ($p['change_length'] != 0) {
                 $change_length_text = 'Change Length: <strong>' . $p['change_length'] . '</strong> / New Length: <strong>' . $p['final_length'] . 'cm</strong>';
                 $change_length_notice .= '<div class="table highlight-red red" style="font-size:14px;">' . $change_length_text . '</div>';
                 $change_length_notice .= '<div>&nbsp;</div>';
             }
             $content[] = '<div class="page">';
             if ($p['print_count'] > 0) {
                 $content[] = '<h3 style="margin-bottom:10px;">Print Copy #' . ($p['print_count'] + 1) . '</h3>';
             }
             $content[] = $this->printPageAdmin($p, $orders_id);
             if ($p['stock_status'] == 'P') {
                 $mat_list = $this->printMaterialList($p['id'], $p['detail_length'], $p['elements']['materials'], $p['qty'], $p['change_length']);
                 $ins_list = $this->printFGpickingList($p, $orders_id);
                 $rowcount_mat_list = 0;
                 $rowcount_ins_list = 5;
             } else {
                 $mat_list = $this->printMaterialList($p['id'], $p['detail_length'], $p['elements']['materials'], $p['qty'], $p['change_length']);
                 $rowcount_mat_list = count($p['elements']['materials']);
                 /*
                 if($p['type']=='CP') {
                     $ins_list = $this->printInstructionList($p['elements']['instruction']);
                     $rowcount_ins_list = $this->temp_rowcount_instruction_list;
                 } elseif($p['type']=='SP' || $p['type']=='NEP') {
                     $ins_list = $this->printManualInstructionList($p, $orders_id);
                     //['type'], $p['image'], $p['id'], $p['final_length'], $p['man_instruction'], $p['code']);
                     $rowcount_ins_list = 5;
                 } else {
                     $ins_list = '';
                     $rowcount_ins_list = 0;
                 }
                 */
                 $ins_list = $this->printManualInstructionList($p, $orders_id);
             }
             $content[] = $mat_list;
             $content[] = '</div>';
             $pagecount_ins_list = $this->temp_instruction_pages;
             $qcontrol = $p['type'] == 'NEP' ? '' : $this->printQualityControl($p);
             $list = array();
             $list[] = '<div class="page">';
             if ($mat_list != '' || $ins_list != '') {
                 //$list[] = '<div class="page-head">Production</div>';
                 $list[] = $change_length_notice;
                 if (is_array($ins_list)) {
                     $list[] = implode("\n", $ins_list);
                     $list[] = '<div style="clear:both;">&nbsp;</div>';
                 }
             }
             $list[] = $qcontrol;
             $list[] = '</div>';
             if (in_array($p['id'], $ENGRAVED_PRODUCTS) && isset($this->orders[$orders_id])) {
                 $list[] = $this->printEngravingInstruction($orders_id, $p);
             }
             $content[] = implode("\n", $list);
         }
     }
     //PI Print Counter
     if (count($pi_printed_sp) > 0) {
         use_class('jng_sp_orders');
         $class_jo = new jng_sp_orders();
         $class_jo->printCountAdd($pi_printed_sp);
     }
     if (count($pi_printed_jng) > 0) {
         //if(count($pi_printed_jg)>0) {   /*DEWA replaced 19112010 since 'type' above using JNG*/
         use_class('orders');
         $class_o = new orders();
         $class_o->printCountAdd($pi_printed_jng);
         //$class_o->printCountAdd($pi_printed_jg);
     }
     if (count($pi_printed_dp) > 0) {
         use_class('depot_orders');
         $class_do = new depot_orders();
         $class_do->printCountAdd($pi_printed_dp);
     }
     //PRINT SCRIPT
     $script = array();
     if ($this->printStatus) {
         $script[] = '<script type="text/javascript"><!--';
         $script[] = 'window.print();';
         $script[] = 'window.close();';
         $script[] = '--></script>';
     }
     //FOOTER
     $footer = array();
     $footer[] = '</div>';
     $footer[] = '</body>';
     $footer[] = '</html>';
     $pi = array();
     $pi[] = implode("\n", $header);
     foreach ($content as $c) {
         $pi[] = $c;
     }
     $pi[] = implode("\n", $script);
     $pi[] = implode("\n", $footer);
     $result = implode("\n", $pi);
     return $result;
 }