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 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; } }
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; } }