function getcomboAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $InventarioBO = new InventarioBO();
         $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginClienteVendedor();
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         //var_dump($json); exit;
         $texto_primer_elemento = $json['texto_primer_elemento'];
         $inventario_id = $json['inventario_id'];
         $cliente_id = $SesionUsuarioPlugin->getUserClienteId();
         $opciones = $InventarioBO->getCombo($inventario_id, $texto_primer_elemento);
         $response = new \stdClass();
         $response->opciones = $opciones;
         $response->respuesta_code = 'OK';
         $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;
     }
 }
 public function consultarusuarionormaldataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $UsuarioBO = new UsuarioBO();
         $PerfilBO = new PerfilBO();
         $GrupoDispoCabBO = new GrupoDispoCabBO();
         $GrupoPrecioCabBO = new GrupoPrecioCabBO();
         $InventarioBO = new InventarioBO();
         $CalidadBO = new CalidadBO();
         $UsuarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $GrupoDispoCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $id = $json['id'];
         $row = $UsuarioBO->consultar($id, \Application\Constants\ResultType::MATRIZ);
         $response = new \stdClass();
         $response->row = $row;
         $response->cbo_perfil_id = $PerfilBO->getComboPerfilRestringido($row['perfil_id'], "");
         $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
         //			$response->opciones_dispo		= $GrupoDispoCabBO->getComboGrupoDispo($row['grupo_dispo_cab_id'], "<Seleccione>");
         //			$response->opciones_precio		= $GrupoPrecioCabBO->getComboGrupoPrecio($row['grupo_precio_cab_id'], "<Seleccione>");
         $response->opciones_dispo = $GrupoDispoCabBO->getComboPorInventario($row['grupo_dispo_cab_id'], $row['inventario_id'], $row['calidad_id']);
         $response->opciones_precio = $GrupoPrecioCabBO->getComboPorInventario($row['grupo_precio_cab_id'], $row['inventario_id'], $row['calidad_id']);
         $response->cbo_inventario_id = $InventarioBO->getCombo($row['inventario_id'], "<Seleccione>");
         $response->cbo_calidad = $CalidadBO->getComboCalidad($row['calidad_id'], "<Seleccione>");
         $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;
     }
 }
 function grabardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $GrupoDispoCabBO = new GrupoDispoCabBO();
         $InventarioBO = new InventarioBO();
         $CalidadBO = new CalidadBO();
         $GrupoDispoCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $usuario_id = $SesionUsuarioPlugin->getUsuarioId();
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $accion = $json['accion'];
         $id = $json['id'];
         $GrupoDispoCabData = new GrupoDispoCabData();
         $GrupoDispoCabData->setId($id);
         $GrupoDispoCabData->setNombre($json['nombre']);
         $GrupoDispoCabData->setInventarioId($json['inventario_id']);
         $GrupoDispoCabData->setCalidadId($json['calidad_id']);
         $GrupoDispoCabData->setUsuarioIngId($usuario_id);
         $GrupoDispoCabData->setUsuarioModId($usuario_id);
         switch ($accion) {
             case 'I':
                 //Ingreso
                 $result = $GrupoDispoCabBO->registrarPorAccion('I', $GrupoDispoCabData);
                 $id = $result['id'];
                 break;
             case 'M':
                 //Modificar
                 $result = $GrupoDispoCabBO->registrarPorAccion('M', $GrupoDispoCabData);
                 $id = $result['id'];
                 break;
         }
         //end switch
         $row = $GrupoDispoCabBO->consultarCabecera($id, \Application\Constants\ResultType::MATRIZ);
         //Retorna la informacion resultante por JSON
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->row = $row;
         $response->inventario_opciones = $InventarioBO->getCombo($row['inventario_id'], "<Seleccione>");
         $response->calidad_opciones = $CalidadBO->getComboCalidad($row['calidad_id'], "<Seleccione>");
         $response->grupo_opciones = $GrupoDispoCabBO->getComboGrupoDispo($id);
         $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 'panel-control-disponibilidad':
                 $InventarioBO = new InventarioBO();
                 $CalidadBO = new CalidadBO();
                 $ProveedorBO = new ProveedorBO();
                 $ColorVentasBO = new ColorVentasBO();
                 $CalidadVariedadBO = new CalidadVariedadBO();
                 $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $ProveedorBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $CalidadVariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $inventario_1er_elemento = $json['inventario_1er_elemento'];
                 $calidad_1er_elemento = $json['calidad_1er_elemento'];
                 $proveedor_1er_elemento = $json['proveedor_1er_elemento'];
                 $color_ventas_1er_elemento = $json['color_ventas_1er_elemento'];
                 $inventario_id = $json['inventario_id'];
                 $calidad_variedad_1er_elemento = $json['calidad_variedad_1er_elemento'];
                 $nro_tallos_1er_elemento = $json['nro_tallos_1er_elemento'];
                 $buscar_proveedor_id = null;
                 if (array_key_exists('buscar_proveedor_id', $json)) {
                     $buscar_proveedor_id = $json['buscar_proveedor_id'];
                 }
                 //end if
                 $clasifica_fox = null;
                 $proveedor_id = null;
                 $color_ventas_id = null;
                 $calidad_variedad_id = null;
                 $nro_tallos = null;
                 $inventario_opciones = $InventarioBO->getCombo($inventario_id, $inventario_1er_elemento);
                 $calidad_opciones = $CalidadBO->getComboCalidadFox($clasifica_fox, $calidad_1er_elemento);
                 $proveedor_opciones = $ProveedorBO->getCombo($proveedor_id, $proveedor_1er_elemento, null, $buscar_proveedor_id);
                 $color_ventas_opciones = $ColorVentasBO->getCombo($color_ventas_id, $color_ventas_1er_elemento);
                 $calidad_variedad_opciones = $CalidadVariedadBO->getComboCalidadVariedad($calidad_variedad_id, $calidad_variedad_1er_elemento);
                 $nro_tallos_opciones = \Application\Classes\ComboGeneral::getComboNroTallos($nro_tallos, $nro_tallos_1er_elemento);
                 $response = new \stdClass();
                 $response->inventario_opciones = $inventario_opciones;
                 $response->calidad_opciones = $calidad_opciones;
                 $response->proveedor_opciones = $proveedor_opciones;
                 $response->color_ventas_opciones = $color_ventas_opciones;
                 $response->calidad_variedad_opciones = $calidad_variedad_opciones;
                 $response->nro_tallos_opciones = $nro_tallos_opciones;
                 $response->respuesta_code = 'OK';
                 break;
         }
         //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;
     }
 }
 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;
     }
 }
 public function consultarregistrodataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $GrupoPrecioCabBO = new GrupoPrecioCabBO();
         $InventarioBO = new InventarioBO();
         $CalidadBO = new CalidadBO();
         $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $grupo_precio_cab_id = $json['grupo_precio_cab_id'];
         $row = $GrupoPrecioCabBO->consultarCabecera($grupo_precio_cab_id, \Application\Constants\ResultType::MATRIZ);
         $response = new \stdClass();
         $response->row = $row;
         $response->inventario_opciones = $InventarioBO->getCombo($row['inventario_id'], "<Seleccione>");
         $response->calidad_opciones = $CalidadBO->getComboCalidad($row['calidad_id'], "<Seleccione>");
         $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;
     }
 }