}
         $priodate = date($priority_date_format, $order_timestamp);
         $order_key = $orders_priority[$priority] . $priodate . $oi['type'] . 'O' . $oi['orders_id'];
         if (!isset($orders[$order_key])) {
             $orders[$order_key] = array();
         }
         $orders[$order_key][$oiid] = $oi;
         $orders_type[$order_key] = $oi['type'];
         $orders_total[$order_key] = $oi['order_item_total'];
         $orders_id_col[$order_key] = $oi['orders_id'];
         $orders_allowed_to_override_booking[$order_key] = $priority == 'TP';
         $temp_order_date[$oi['type'] . '-' . $oiid] = $priodate;
     }
 }
 //DEPOT ORDERS
 $oi_depot = $class_do->retrieveOpenOrdersItems();
 $orders_set_to_hh = array();
 $orders_set_to_ok = array();
 $items_set_to_fg = array();
 $items_set_to_ok = array();
 $items_set_to_ns = array();
 $items_auto_canceled = array();
 if (count($orders) > 0 || count($oi_depot) > 0) {
     /*
     //DEBUGGING CODES
     foreach($orders as $order_key=>$items) {
         foreach($items as $oiid=>$oi) {
             if($oi['status']!=1) {
                 unset($orders[$oiid]);
                 break;
             }