public function nuevodataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $condiciones = null;
         $response = new \stdClass();
         $response->cbo_tipo = \Application\Classes\ComboGeneral::getComboTipo("", "");
         $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 grabardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $usuario_id = $SesionUsuarioPlugin->getUsuarioId();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $ClienteData = new ClienteData();
         $ClienteBO = new ClienteBO();
         $ClienteBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $accion = $json['accion'];
         //I, M
         $ClienteData->setId($json['cliente_id']);
         $ClienteData->setNombre($json['nombre']);
         $ClienteData->setAbreviatura($json['abreviatura']);
         //$ClienteData->setGrupoPrecioCabId	($json['grupo_precio_cab_id']);
         $ClienteData->setDireccion($json['direccion']);
         $ClienteData->setCiudad($json['ciudad']);
         $ClienteData->setEstadosId($json['estados_id']);
         $ClienteData->setEstadoNombre($json['estado_nombre']);
         $ClienteData->setPaisId($json['pais_id']);
         $ClienteData->setCodigoPostal($json['codigo_postal']);
         $ClienteData->setComprador($json['comprador']);
         $ClienteData->setTelefono1($json['telefono1']);
         $ClienteData->setTelefono1Ext($json['telefono1_ext']);
         $ClienteData->setTelefono2($json['telefono2']);
         $ClienteData->setTelefono2Ext($json['telefono2_ext']);
         $ClienteData->setFax1($json['fax1']);
         $ClienteData->setFax1Ext($json['fax1_ext']);
         $ClienteData->setFax2($json['fax2']);
         $ClienteData->setFax2Ext($json['fax2_ext']);
         $ClienteData->setUsuarioVendedorId($json['usuario_vendedor_id']);
         $ClienteData->setTcLimiteCredito($json['tc_limite_credito']);
         $ClienteData->setTcInteres($json['tc_interes']);
         $ClienteData->setEstCreditoSuspendido($json['est_credito_suspendido']);
         $ClienteData->setCreditoSuspendidoRazon($json['credito_suspendido_razon']);
         //$ClienteData->setEmail				($json['email']);
         $ClienteData->setContacto($json['contacto']);
         $ClienteData->setClienteFacturaId($json['cliente_factura_id']);
         $ClienteData->setTelefonoFact1($json['telefono_fact1']);
         $ClienteData->setTelefonoFact1Ext($json['telefono_fact1_ext']);
         $ClienteData->setTelefonoFact2($json['telefono_fact2']);
         $ClienteData->setTelefonoFact2Ext($json['telefono_fact2_ext']);
         $ClienteData->setFaxFact1($json['fax_fact1']);
         $ClienteData->setFaxFact1Ext($json['fax_fact1_ext']);
         $ClienteData->setFaxFact2($json['fax_fact2']);
         $ClienteData->setFaxFact2Ext($json['fax_fact2_ext']);
         $ClienteData->setEmailFactura($json['email_factura']);
         $ClienteData->setPaisFUE($json['pais_fue']);
         $ClienteData->setFacturacionSRI($json['facturacion_sri']);
         $ClienteData->setPorcIva($json['porc_iva']);
         $ClienteData->setEstado($json['estado']);
         $ClienteData->setIncobrable($json['incobrable']);
         $ClienteData->setClienteEspecial($json['cliente_especial']);
         $ClienteData->setEnviaEstadoCta($json['envia_estadocta']);
         $ClienteData->setFormatoEstadoCta($json['formato_estado_cta']);
         $ClienteData->setTipoEnvioEstCta($json['tipo_envio_estcta']);
         $ClienteData->setDiaSemana($json['dia_semana']);
         $ClienteData->setDiaCalFecha1($json['diacal_fecha1']);
         $ClienteData->setDiaCalFecha2($json['diacal_fecha2']);
         $ClienteData->setInmediato($json['inmediato']);
         $response = new \stdClass();
         switch ($accion) {
             case 'I':
                 $ClienteData->setUsuarioIngId($usuario_id);
                 $result = $ClienteBO->ingresar($ClienteData);
                 break;
             case 'M':
                 $ClienteData->setUsuarioModId($usuario_id);
                 $result = $ClienteBO->modificar($ClienteData);
                 break;
             default:
                 $result['validacion_code'] = 'ERROR';
                 $result['respuesta_mensaje'] = 'ACCESO NO VALIDO';
                 break;
         }
         //end switch
         //Se consulta el registro siempre y cuando el validacion_code sea OK
         if ($result['validacion_code'] == 'OK') {
             $row = $ClienteBO->consultar($json['cliente_id'], \Application\Constants\ResultType::MATRIZ);
         } else {
             $row = null;
         }
         //end if
         //Retorna la informacion resultante por JSON
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->validacion_code = $result['validacion_code'];
         $response->respuesta_mensaje = $result['respuesta_mensaje'];
         if ($row) {
             $response->row = $row;
             $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
         } else {
             $response->row = null;
             $response->cbo_estado = '';
         }
         //end if
         $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 grabarusuarionormaldataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $usuario_id = $SesionUsuarioPlugin->getUsuarioId();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $UsuarioData = new UsuarioData();
         $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);
         $accion = $json['accion'];
         //I, M
         $UsuarioData->setId($json['id']);
         $UsuarioData->setClienteId($json['cliente_id']);
         $UsuarioData->setNombre($json['nombre']);
         $UsuarioData->setUsername($json['username']);
         $UsuarioData->setPassword($json['password']);
         $UsuarioData->setEmail($json['email']);
         $UsuarioData->setPerfilId(\Application\Constants\Perfil::ID_CLIENTE);
         $UsuarioData->setEstado($json['estado']);
         $UsuarioData->setGrupoDispoCabId($json['grupo_dispo_cab_id']);
         $UsuarioData->setGrupoPrecioCabId($json['grupo_precio_cab_id']);
         $UsuarioData->setInventarioId($json['inventario_id']);
         $UsuarioData->setCalidadId($json['calidad_id']);
         $response = new \stdClass();
         switch ($accion) {
             case 'I':
                 $UsuarioData->setUsuarioIngId($usuario_id);
                 $result = $UsuarioBO->ingresar($UsuarioData);
                 break;
             case 'M':
                 $UsuarioData->setUsuarioModId($usuario_id);
                 $result = $UsuarioBO->modificar($UsuarioData);
                 break;
             default:
                 $result['validacion_code'] = 'ERROR';
                 $result['respuesta_mensaje'] = 'ACCESO NO VALIDO';
                 break;
         }
         //end switch
         //Se consulta el registro siempre y cuando el validacion_code sea OK
         if ($result['validacion_code'] == 'OK') {
             $row = $UsuarioBO->consultar($json['id'], \Application\Constants\ResultType::MATRIZ);
         } else {
             $row = null;
         }
         //end if
         //Retorna la informacion resultante por JSON
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->validacion_code = $result['validacion_code'];
         $response->respuesta_mensaje = $result['respuesta_mensaje'];
         if ($row) {
             $response->row = $row;
             //$response->cbo_perfil_id		= $PerfilBO->getComboPerfilRestringido($row['perfil_id'], " ");
             $response->cbo_cbo_grupo_dispo = $GrupoDispoCabBO->getComboGrupoDispo($row['grupo_dispo_cab_id'], " ");
             $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
         } else {
             $response->row = null;
             $response->cbo_tipo = '';
             $response->cbo_estado = '';
         }
         //end if
         $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 grabardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $usuario_id = $SesionUsuarioPlugin->getUsuarioId();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $VariedadData = new VariedadData();
         $VariedadBO = new VariedadBO();
         $ObtentorBO = new ObtentorBO();
         $ColoresBO = new ColoresBO();
         $CalidadVariedadBO = new CalidadVariedadBO();
         $TamanoBunchBO = new TamanoBunchBO();
         $ColorVentasBO = new ColorVentasBO();
         $VariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ColoresBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadVariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ObtentorBO->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);
         $accion = $json['accion'];
         //I, M
         $VariedadData->setId($json['id']);
         $VariedadData->setNombre($json['nombre']);
         $VariedadData->setNombreTecnico($json['nombre_tecnico']);
         $VariedadData->setCalidadVariedadId($json['calidad_variedad_id']);
         $VariedadData->setColor($json['color']);
         $VariedadData->setColor2($json['color2']);
         $VariedadData->setGrupoColorId($json['grupo_color_id']);
         $VariedadData->setColorBase($json['colorbase']);
         $VariedadData->setSolido($json['solido']);
         $VariedadData->setEsReal($json['es_real']);
         $VariedadData->setEstProductoEspecial($json['est_producto_especial']);
         $VariedadData->setMensaje($json['mensaje']);
         $VariedadData->setCultivada($json['cultivada']);
         $VariedadData->setCicloProd($json['ciclo_prod']);
         $VariedadData->setObtentorId($json['obtentor_id']);
         $VariedadData->setColorVentasId($json['color_ventas_id']);
         $VariedadData->setUrlFicha($json['url_ficha']);
         $VariedadData->setTamanoBunchId($json['tamano_bunch_id']);
         $VariedadData->setEstado($json['estado']);
         switch ($accion) {
             case 'I':
                 $VariedadData->setUsuarioIngId($usuario_id);
                 $VariedadData->setProductoId('ROS');
                 $result = $VariedadBO->ingresar($VariedadData);
                 break;
             case 'M':
                 $VariedadData->setUsuarioModId($usuario_id);
                 $result = $VariedadBO->modificar($VariedadData);
                 break;
             default:
                 $result['validacion_code'] = 'ERROR';
                 $result['respuesta_mensaje'] = 'ACCESO NO VALIDO';
                 break;
         }
         //end switch
         //Se consulta el registro siempre y cuando el validacion_code sea OK
         if ($result['validacion_code'] == 'OK') {
         } else {
             $row = null;
         }
         //end if
         //Retorna la informacion resultante por JSON
         $row = null;
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->validacion_code = $result['validacion_code'];
         $response->respuesta_mensaje = $result['respuesta_mensaje'];
         if ($row) {
             $response->row = $row;
             $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
             $response->cbo_color_base = $ColoresBO->getCombo($row['colorbase'], "<Seleccione>");
         } else {
             $response->row = null;
             $response->cbo_estado = '';
             $response->cbo_color_base = '';
         }
         //end if
         $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 grabardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $usuario_id = $SesionUsuarioPlugin->getUsuarioId();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $TransportadoraData = new TransportadoraData();
         $TransportadoraBO = new TransportadoraBO();
         $TransportadoraBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $accion = $json['accion'];
         //I, M
         $TransportadoraData->setId($json['id']);
         $TransportadoraData->setNombre($json['nombre']);
         $TransportadoraData->setTipo($json['tipo']);
         $TransportadoraData->setEstado($json['estado']);
         $response = new \stdClass();
         switch ($accion) {
             case 'I':
                 $TransportadoraData->setUsuarioIngId($usuario_id);
                 $result = $TransportadoraBO->ingresar($TransportadoraData);
                 break;
             case 'M':
                 $TransportadoraData->setUsuarioModId($usuario_id);
                 $result = $TransportadoraBO->modificar($TransportadoraData);
                 break;
             default:
                 $result['validacion_code'] = 'ERROR';
                 $result['respuesta_mensaje'] = 'ACCESO NO VALIDO';
                 break;
         }
         //end switch
         //Se consulta el registro siempre y cuando el validacion_code sea OK
         if ($result['validacion_code'] == 'OK') {
             $row = $TransportadoraBO->consultar($json['id'], \Application\Constants\ResultType::MATRIZ);
         } else {
             $row = null;
         }
         //end if
         //Retorna la informacion resultante por JSON
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->validacion_code = $result['validacion_code'];
         $response->respuesta_mensaje = $result['respuesta_mensaje'];
         if ($row) {
             $response->row = $row;
             $response->cbo_tipo = $TransportadoraBO->getComboTipo($row['tipo'], " ");
             $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
         } else {
             $response->row = null;
             $response->cbo_tipo = '';
             $response->cbo_estado = '';
         }
         //end if
         $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 consultardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $MarcacionBO = new MarcacionBO();
         $PaisBO = new PaisBO();
         $TipoCajaBO = new TipoCajaBO();
         $MarcacionBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $PaisBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $marcacion_sec = $json['marcacion_sec'];
         $row = $MarcacionBO->consultar($marcacion_sec, \Application\Constants\ResultType::MATRIZ);
         $response = new \stdClass();
         $response->row = $row;
         $response->cbo_pais_id = $PaisBO->getComboPais($row['pais_id'], "<Seleccione>");
         $response->cbo_tipo_caja = $TipoCajaBO->getCombo($row['tipo_caja_default_id'], "<Seleccione>");
         $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
         $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;
     }
 }