public function consultardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $VariedadBO = new VariedadBO();
         $ObtentorBO = new ObtentorBO();
         $ColoresBO = new ColoresBO();
         $CalidadVariedadBO = new CalidadVariedadBO();
         $GrupoColorBO = new GrupoColorBO();
         $TamanoBunchBO = new TamanoBunchBO();
         $ColorVentasBO = new ColorVentasBO();
         $VariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ColoresBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadVariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ObtentorBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $GrupoColorBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $TamanoBunchBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $variedad_id = $json['variedad_id'];
         $row = $VariedadBO->consultar($variedad_id, \Application\Constants\ResultType::MATRIZ);
         $response = new \stdClass();
         $response->row = $row;
         $response->cbo_color_base = $ColoresBO->getCombo($row['colorbase'], "<Seleccione>");
         $response->cbo_color = $ColoresBO->getCombo($row['color'], "<Seleccione>");
         $response->cbo_color2 = $ColoresBO->getCombo($row['color2'], "<Seleccione>");
         $response->cbo_grupo_color_id = $GrupoColorBO->getComboId($row['grupo_color_id'], "<Seleccione>");
         $response->cbo_calidad_variedad_id = $CalidadVariedadBO->getComboCalidadVariedad($row['calidad_variedad_id'], "<Seleccione>");
         $response->cbo_solido = $VariedadBO->getComboSolido($row['solido'], "<Seleccione>");
         $response->cbo_es_real = $VariedadBO->getComboEsReal($row['es_real'], "<Seleccione>");
         $response->cbo_cultivada = $VariedadBO->getComboCultivada($row['cultivada'], "<Seleccione>");
         $response->cbo_obtentor_id = $ObtentorBO->getComboObtentor($row['obtentor_id'], "<Seleccione>");
         $response->cbo_color_ventas = $ColorVentasBO->getCombo($row['color_ventas_id'], "<Seleccione>");
         $response->cbo_tamano_bunch = $TamanoBunchBO->getCombo($row['tamano_bunch_id'], "<Seleccione>");
         $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado("", "");
         $response->respuesta_code = 'OK';
         $response->respuesta_mensaje = '';
         $json = new JsonModel(get_object_vars($response));
         return $json;
         //false
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
 public function initcontrolsAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginAdmin();
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $opcion = $json['opcion'];
         switch ($opcion) {
             case 'mantenimiento':
                 $InventarioBO = new InventarioBO();
                 $TipoCajaBO = new TipoCajaBO();
                 $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $inventario_1er_elemento = $json['inventario_1er_elemento'];
                 $inventario_id = null;
                 $tipo_caja_1er_elemento = $json['tipo_caja_1er_elemento'];
                 $tipo_caja_id = null;
                 $inventario_opciones = $InventarioBO->getCombo($inventario_id, $inventario_1er_elemento);
                 $tipocaja_opciones = $TipoCajaBO->getCombo($tipo_caja_id, $tipo_caja_1er_elemento);
                 $response = new \stdClass();
                 $response->inventario_opciones = $inventario_opciones;
                 $response->tipocaja_opciones = $tipocaja_opciones;
                 $response->respuesta_code = 'OK';
                 break;
             case 'actualizacion-masiva':
                 $TipoCajaMatrizBO = new TipoCajaMatrizBO();
                 $GradoBO = new GradoBO();
                 $TipoCajaMatrizBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $GradoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $variedad_1er_elemento = $json['variedad_1er_elemento'];
                 $variedad_id = null;
                 $grado_1er_elemento = $json['grado_1er_elemento'];
                 $grado_id = null;
                 $inventario_id = $json['inventario_id'];
                 $tipo_caja_id = $json['tipo_caja_id'];
                 //Se debe de obtener las variedades de acuerdo al tipo de inventario  $inventario_id, $variedad_id, $variedad_1er_elemento
                 $variedad_opciones = $TipoCajaMatrizBO->getComboVariedad($tipo_caja_id, $inventario_id, $variedad_id, $variedad_1er_elemento);
                 $grado_opciones = $GradoBO->getCombo($grado_id, $grado_1er_elemento);
                 $response = new \stdClass();
                 $response->variedad_opciones = $variedad_opciones;
                 $response->grado_opciones = $grado_opciones;
                 $response->respuesta_code = 'OK';
                 break;
             case 'caja-matriz':
                 $TipoCajaBO = new TipoCajaBO();
                 $InventarioBO = new InventarioBO();
                 $TamanoBunchBO = new TamanoBunchBO();
                 $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $TamanoBunchBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $tipo_caja_id = $json['tipo_caja_id'];
                 $inventario_id = $json['inventario_id'];
                 $tamano_bunch_id = $json['tamano_bunch_id'];
                 $inventario_opciones = $InventarioBO->getCombo($inventario_id);
                 $tipocaja_opciones = $TipoCajaBO->getCombo($tipo_caja_id);
                 $tamano_bunch_opciones = $TamanoBunchBO->getCombo($tamano_bunch_id);
                 $response = new \stdClass();
                 $response->tipocaja_opciones = $tipocaja_opciones;
                 $response->inventario_opciones = $inventario_opciones;
                 $response->tamano_bunch_opciones = $tamano_bunch_opciones;
                 $response->respuesta_code = 'OK';
         }
         //end switch
         $json = new JsonModel(get_object_vars($response));
         return $json;
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }