diff --git a/Business/BaseDataAccess.cs b/Business/BaseDataAccess.cs index da937100..73792a2b 100644 --- a/Business/BaseDataAccess.cs +++ b/Business/BaseDataAccess.cs @@ -297,11 +297,29 @@ public object Get(Type type, object id) } } - public object Get(object id) + public object Get(object id) + { + return this.Get(this.GetType(), id); + } + + + + public object GetIfExists(Type type, object id) { - return this.Get(this.GetType(),id); - } + object returnValue = null; + try + { + returnValue = m_session.Get(type, id); + + return returnValue; + } + catch (Exception ex) + { + //TODO: disciminar en caso q la excepcion sea del tipo id inexistente. + throw ex; + } + } public IList GetListByPropertyValue(Type type, string propertyName, object propertyValue) { try diff --git a/Business/Business.csproj b/Business/Business.csproj index e7919c36..40e6bc94 100644 --- a/Business/Business.csproj +++ b/Business/Business.csproj @@ -148,6 +148,7 @@ + @@ -321,6 +322,7 @@ + diff --git a/Business/Data/AutoAnalizador/RealItem.cs b/Business/Data/AutoAnalizador/RealItem.cs new file mode 100644 index 00000000..0615d231 --- /dev/null +++ b/Business/Data/AutoAnalizador/RealItem.cs @@ -0,0 +1,127 @@ +/* +insert license info here +*/ +using System; +using System.Collections; + +namespace Business.Data.AutoAnalizador +{ + /// + /// Generated by MyGeneration using the NHibernate Object Mapping template + /// + [Serializable] + public sealed class RealItem: Business.BaseDataAccess + { + + #region Private Members + private bool m_isChanged; + + private int m_idrealitem; + private string m_idreal; + private int m_iditem; + private bool m_habilitado; + #endregion + + #region Default ( Empty ) Class Constuctor + /// + /// default constructor + /// + public RealItem() + { + m_idrealitem = 0; + m_idreal = String.Empty; + m_iditem = 0; + m_habilitado = false; + } + #endregion // End of Default ( Empty ) Class Constuctor + + #region Required Fields Only Constructor + /// + /// required (not null) fields only constructor + /// + public RealItem( + string idreal, + int iditem, + bool habilitado) + : this() + { + m_idreal = idreal; + m_iditem = iditem; + m_habilitado = habilitado; + } + #endregion // End Required Fields Only Constructor + + #region Public Properties + + /// + /// + /// + public int IdRealItem + { + get { return m_idrealitem; } + set + { + m_isChanged |= (m_idrealitem != value ); + m_idrealitem = value; + } + + } + + /// + /// + /// + public string IdReal + { + get { return m_idreal; } + + set + { + if( value == null ) + throw new ArgumentOutOfRangeException("Null value not allowed for IdReal", value, "null"); + + if( value.Length > 50) + throw new ArgumentOutOfRangeException("Invalid value for IdReal", value, value.ToString()); + + m_isChanged |= (m_idreal != value); m_idreal = value; + } + } + + /// + /// + /// + public int IdItem + { + get { return m_iditem; } + set + { + m_isChanged |= ( m_iditem != value ); + m_iditem = value; + } + + } + + /// + /// + /// + public bool Habilitado + { + get { return m_habilitado; } + set + { + m_isChanged |= ( m_habilitado != value ); + m_habilitado = value; + } + + } + + /// + /// Returns whether or not the object has changed it's values. + /// + public bool IsChanged + { + get { return m_isChanged; } + } + + #endregion + } +} diff --git a/Business/Data/AutoAnalizador/RealItem.hbm.xml b/Business/Data/AutoAnalizador/RealItem.hbm.xml new file mode 100644 index 00000000..dc314397 --- /dev/null +++ b/Business/Data/AutoAnalizador/RealItem.hbm.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Business/Data/Laboratorio/Configuracion.cs b/Business/Data/Laboratorio/Configuracion.cs index 84a7d61a..e1863fbc 100644 --- a/Business/Data/Laboratorio/Configuracion.cs +++ b/Business/Data/Laboratorio/Configuracion.cs @@ -152,6 +152,7 @@ public sealed class Configuracion : Business.BaseDataAccess private string m_urlResultadosQR; private bool m_verificaIngresoAnterior; + private bool m_habilitaEnfermedadBase; private string m_tipoOrdenProtocolo; #endregion @@ -304,6 +305,7 @@ public Configuracion() m_verificaIngresoAnterior = false; m_habilitaNoPublicacion = false; m_tipoOrdenProtocolo = String.Empty; + m_habilitaEnfermedadBase = false; } @@ -453,8 +455,8 @@ public Configuracion( string tokenMPI , string urlResultadosQR , bool verificaIngresoAnterior, - string tipoOrdenProtocolo - + string tipoOrdenProtocolo, + bool habilitaEnfermedadBase ) : this() { @@ -592,6 +594,7 @@ string tipoOrdenProtocolo m_verificaIngresoAnterior = verificaIngresoAnterior; m_tipoOrdenProtocolo = tipoOrdenProtocolo; + m_habilitaEnfermedadBase = habilitaEnfermedadBase; } #endregion // End Required Fields Only Constructor @@ -797,6 +800,17 @@ public bool HabilitaNoPublicacion } + public bool HabilitaEnfermedadBase + { + get { return m_habilitaEnfermedadBase; } + set + { + m_isChanged |= (m_habilitaEnfermedadBase != value); + m_habilitaEnfermedadBase = value; + } + + } + public bool VerificaIngresoAnterior { diff --git a/Business/Data/Laboratorio/Configuracion.hbm.xml b/Business/Data/Laboratorio/Configuracion.hbm.xml index 978d4740..6290b876 100644 --- a/Business/Data/Laboratorio/Configuracion.hbm.xml +++ b/Business/Data/Laboratorio/Configuracion.hbm.xml @@ -155,5 +155,6 @@ + diff --git a/Business/Data/Laboratorio/Derivacion.cs b/Business/Data/Laboratorio/Derivacion.cs index 3eebb651..f7fd4f20 100644 --- a/Business/Data/Laboratorio/Derivacion.cs +++ b/Business/Data/Laboratorio/Derivacion.cs @@ -267,46 +267,46 @@ public int IdMotivoCancelacion { } #endregion - public static List DerivacionesByLote(int idLote) { - List derivaciones = new List(); - try { - ISession session = NHibernateHttpModule.CurrentSession; - IList lista = session.CreateQuery("from Derivacion where idLote="+idLote).List(); - - foreach (Derivacion item in lista) { - derivaciones.Add(item); - } - } catch (Exception) { - - } - return derivaciones; - } - - public void MarcarComoRecibidas(Protocolo oAnterior, Protocolo oNuevo, Usuario oUser, int idLoteDerivacion) - { - string query = - @"update LAB_Derivacion - set estado=3---recibido - ,idProtocoloDerivacion=" + oNuevo.IdProtocolo.ToString() + @" - from LAB_Derivacion D - inner join LAB_DetalleProtocolo Det on Det.idDetalleProtocolo= d.idDetalleProtocolo - where Det.idProtocolo=" + oAnterior.IdProtocolo.ToString() + " and idLote=" + idLoteDerivacion; - - SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; - SqlCommand cmd = new SqlCommand(query, conn); - int idRealizado = Convert.ToInt32(cmd.ExecuteScalar()); - - //Se indica en el protocolo de Origen que fue recibido en el destino - if (oAnterior != null) - { - if (idLoteDerivacion != 0) - oAnterior.GrabarAuditoriaDetalleProtocolo("Recepcion Derivacion", oUser.IdUsuario, "Lote " + idLoteDerivacion, "Protocolo " + oNuevo.Numero.ToString()); - else - oAnterior.GrabarAuditoriaDetalleProtocolo("Recepcion Derivacion", oUser.IdUsuario, "Protocolo", oNuevo.Numero.ToString()); - } - } - - public string ObtenerItemsPendientes(string idLoteDerivacion, string idProtocolo) + //public static List DerivacionesByLote(int idLote) { + // List derivaciones = new List(); + // try { + // ISession session = NHibernateHttpModule.CurrentSession; + // IList lista = session.CreateQuery("from Derivacion where idLote="+idLote).List(); + + // foreach (Derivacion item in lista) { + // derivaciones.Add(item); + // } + // } catch (Exception) { + + // } + // return derivaciones; + //} + + //public void MarcarComoRecibidas(Protocolo oAnterior, Protocolo oNuevo, Usuario oUser, int idLoteDerivacion) //Se hace ahora en DetalleProtocolo.ActualizarItemsDerivados + // { + // string query = + // @"update LAB_Derivacion + // set estado=3---recibido + // ,idProtocoloDerivacion=" + oNuevo.IdProtocolo.ToString() + @" + // from LAB_Derivacion D + // inner join LAB_DetalleProtocolo Det on Det.idDetalleProtocolo= d.idDetalleProtocolo + // where Det.idProtocolo=" + oAnterior.IdProtocolo.ToString() + " and idLote=" + idLoteDerivacion; + + // SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + // SqlCommand cmd = new SqlCommand(query, conn); + // int idRealizado = Convert.ToInt32(cmd.ExecuteScalar()); + + // //Se indica en el protocolo de Origen que fue recibido en el destino + // if (oAnterior != null) + // { + // if (idLoteDerivacion != 0) + // oAnterior.GrabarAuditoriaDetalleProtocolo("Recepcion Derivacion", oUser.IdUsuario, "Lote " + idLoteDerivacion, "Protocolo " + oNuevo.Numero.ToString()); + // else + // oAnterior.GrabarAuditoriaDetalleProtocolo("Recepcion Derivacion", oUser.IdUsuario, "Protocolo", oNuevo.Numero.ToString()); + // } + //} + + public string ObtenerItemsPendientes(string idLoteDerivacion, string idProtocolo) { ////// ---------------------->Buscar las derivaciones que no han sido ingresadas //los protocolos detalles me dan las derivaciones diff --git a/Business/Data/Laboratorio/DetalleProtocolo.cs b/Business/Data/Laboratorio/DetalleProtocolo.cs index 10b806c6..00aa0306 100644 --- a/Business/Data/Laboratorio/DetalleProtocolo.cs +++ b/Business/Data/Laboratorio/DetalleProtocolo.cs @@ -470,6 +470,35 @@ public int IdUsuarioPreValida } + public void GuardarDisponible( ) + {/// saca las marcas de validacion + //ItemEfector oItem = new ItemEfector(); + //oItem = (ItemEfector)oItem.Get(typeof(ItemEfector), "IdItem", this.IdSubItem, "IdEfector", this.IdEfector); + //if (oItem != null) //Siempre tiene que haber + // if (oItem.IdEfectorDerivacion == this.IdEfector) + // { + // if (!oItem.SinInsumo) + // { + //resul = "Sin Insumo"; + + if (this.IdSubItem.IdTipoResultado != 2)///numerico o predefinido + { + this.Observaciones = ""; + this.IdUsuarioValidaObservacion =0; + this.FechaValidaObservacion = DateTime.Parse("01/01/1900"); + this.FechaValida = DateTime.Parse("01/01/1900"); + } + if (this.IdSubItem.IdTipoResultado == 2)///texto + { + this.ResultadoCar = ""; + this.IdUsuarioValida = 0; // oItem.IdUsuarioRegistro.IdUsuario; + this.FechaValida = DateTime.Parse("01/01/1900"); + } + this.Save(); + // } + //} + + } /// /// /// @@ -1295,7 +1324,7 @@ public bool tieneAdjuntoVisible() return false; } - public string getPlaca() + public string getPlaca_old() { string s_placa = ""; ICriteria crit = m_session.CreateCriteria(typeof(DetalleProtocoloPlaca)); @@ -1318,6 +1347,26 @@ public string getPlaca() return s_placa; } + public string getPlaca() + { + ICriteria crit = m_session.CreateCriteria(typeof(DetalleProtocoloPlaca)); + crit.Add(Expression.Eq("IdDetalleProtocolo", this.IdDetalleProtocolo)); + + IList lista = crit.List(); + + HashSet placas = new HashSet(); + + foreach (DetalleProtocoloPlaca oDetalle in lista) + { + Placa oP = (Placa)m_session.Get(typeof(Placa), oDetalle.IdPlaca); + + if (!oP.Baja) + placas.Add(oDetalle.IdPlaca); + } + + return string.Join("-", placas); + } + public bool esDerivado() { bool sederiva = false; @@ -1330,36 +1379,68 @@ public bool esDerivado() return sederiva; } - public void GuardarSinInsumo() + public void GuardarSinInsumo(Usuario oUser) { - + //Llamado desde marca de sin insumo string resul = ""; - ItemEfector oItem = new ItemEfector(); - oItem = (ItemEfector)oItem.Get(typeof(ItemEfector), "IdItem", this.IdSubItem, "IdEfector", this.IdEfector); - if (oItem != null) //Siempre tiene que haber - if (oItem.IdEfectorDerivacion == this.IdEfector) - { - if (oItem.SinInsumo) - { + //ItemEfector oItem = new ItemEfector(); + //oItem = (ItemEfector)oItem.Get(typeof(ItemEfector), "IdItem", this.IdSubItem, "IdEfector", this.IdEfector); + //if (oItem != null) //Siempre tiene que haber + // if (oItem.IdEfectorDerivacion == this.IdEfector) + // { + // if (oItem.SinInsumo) + // { resul = "Sin Insumo"; if (this.IdSubItem.IdTipoResultado != 2)///numerico o predefinido { this.Observaciones = resul; - this.IdUsuarioValidaObservacion = oItem.IdUsuarioRegistro.IdUsuario; + this.IdUsuarioValidaObservacion = oUser.IdUsuario; this.FechaValidaObservacion = DateTime.Now; this.FechaValida = DateTime.Now; } if (this.IdSubItem.IdTipoResultado == 2)///texto { this.ResultadoCar = resul; - this.IdUsuarioValida = oItem.IdUsuarioRegistro.IdUsuario; - this.FechaValida = DateTime.Now; + this.IdUsuarioValida = oUser.IdUsuario; + this.FechaValida = DateTime.Now; } this.Save(); + // } + //} + + + } + public void GuardarSinInsumo( ) + {//Llamado de guardado de protocolo + + string resul = ""; + ItemEfector oItem = new ItemEfector(); + oItem = (ItemEfector)oItem.Get(typeof(ItemEfector), "IdItem", this.IdSubItem, "IdEfector", this.IdEfector); + if (oItem != null) //Siempre tiene que haber + if (oItem.IdEfectorDerivacion == this.IdEfector) + { + if (oItem.SinInsumo) + { + resul = "Sin Insumo"; + + if (this.IdSubItem.IdTipoResultado != 2)///numerico o predefinido + { + this.Observaciones = resul; + this.IdUsuarioValidaObservacion = oItem.IdUsuarioRegistro.IdUsuario; + this.FechaValidaObservacion = DateTime.Now; + this.FechaValida = DateTime.Now; + } + if (this.IdSubItem.IdTipoResultado == 2)///texto + { + this.ResultadoCar = resul; + this.IdUsuarioValida = oItem.IdUsuarioRegistro.IdUsuario; + this.FechaValida = DateTime.Now; + } + this.Save(); } } - + } @@ -1449,11 +1530,80 @@ public void GuardarDerivacion(Usuario oUser) oRegistro.Save(); - // graba el resultado en ResultadCar "Derivado: " + oItem.GetEfectorDerivacion(oCon.IdEfector); - //oDetalle.ResultadoCar = "Pendiente de Derivacion";//"se podria poner a que efector.... - //oDetalle.Save(); + // graba el resultado en ResultadCar "Pendiente de derivar" + this.ResultadoCar = "Pendiente de derivar"; + this.Save(); this.GrabarAuditoriaDetalleProtocolo("Graba Derivado", oUser.IdUsuario); } } + + //public void ActualizoResultado(Protocolo oRegistro, Protocolo oAnterior, int idLoteDerivacion) + //{ + + //Se hace ahora en el metodo ActualizarItemsDerivados + //ResultadoCar: “Recibido en YYYY Protocolo Nro. XXXX” + + //string query = + // " update LAB_DetalleProtocolo " + + // " set resultadoCar= 'Recibido en " + oRegistro.IdEfector.Nombre + " Protocolo Nro. " + oRegistro.Numero + + // "' from LAB_DetalleProtocolo Det " + + // " inner join LAB_Derivacion D on Det.idDetalleProtocolo = d.idDetalleProtocolo " + + // " where Det.idProtocolo=" + oAnterior.IdProtocolo.ToString() + " and idLote=" + idLoteDerivacion; + + + //// Pero que pasa en los casos que en el efector destino un analisis no se ingrese? + //// Tendriamos como recibido el analisis en el emisor pero en el receptor no estaria cargado + + //SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + //SqlCommand cmd = new SqlCommand(query, conn); + //int idRealizado = Convert.ToInt32(cmd.ExecuteScalar()); + + //} + + public void ActualizarItemsDerivados(Protocolo oRegistro, Protocolo oAnterior, int idLoteDerivacion, Usuario oUser) + { + // PREMISA: Cuales son los idDetalle del protocolo emisor que si se grabaron en el protocolo nuevo + string query = + @" SELECT dp_origen.idDetalleProtocolo + FROM LAB_DetalleProtocolo dp_origen + INNER JOIN LAB_Derivacion d on d.idDetalleProtocolo = dp_origen.idDetalleProtocolo + WHERE dp_origen.idProtocolo = " + oAnterior.IdProtocolo + " and idLote = " + idLoteDerivacion + @" + AND EXISTS ( + SELECT 1 + FROM LAB_DetalleProtocolo dp_dest + WHERE dp_dest.idProtocolo = " + oRegistro.IdProtocolo + @" + AND dp_dest.idItem = dp_origen.idItem + ); "; + + SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + DataSet Ds = new DataSet(); + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(query, conn); + adapter.Fill(Ds); + DataTable dt = Ds.Tables[0]; + + foreach (DataRow item in dt.Rows) + { + int idDetalleProtocolo = int.Parse(item[0].ToString()); + + DetalleProtocolo dp = new DetalleProtocolo(); + dp = (DetalleProtocolo)dp.Get(typeof(DetalleProtocolo), "IdDetalleProtocolo", idDetalleProtocolo); + dp.ResultadoCar = "Recibido en " + oRegistro.IdEfector.Nombre + " Protocolo Nro. " + oRegistro.Numero; + dp.Save(); + + Derivacion de = new Derivacion(); + de = (Derivacion)de.Get(typeof(Derivacion), "IdDetalleProtocolo", dp); + de.Estado = 3; + de.IdProtocoloDerivacion = oAnterior.IdProtocolo; + de.Save(); + } + + //Se indica en el protocolo de Origen que fue recibido en el destino + if (oAnterior != null) + { + oAnterior.GrabarAuditoriaDetalleProtocolo("Recepcion Derivacion", oUser.IdUsuario, "Lote " + idLoteDerivacion, "Protocolo " + oRegistro.Numero.ToString()); + + } + } } } diff --git a/Business/Data/Laboratorio/Item.cs b/Business/Data/Laboratorio/Item.cs index a6192ea9..c7f10712 100644 --- a/Business/Data/Laboratorio/Item.cs +++ b/Business/Data/Laboratorio/Item.cs @@ -863,7 +863,7 @@ public int GetPresentacionEfector(Efector idEfector) public bool VerificaMuestrasAsociadas(int idMuestra) { bool dev = true; - if (this.IdArea.IdTipoServicio.IdTipoServicio == 3) //micro + if ((this.IdArea.IdTipoServicio.IdTipoServicio == 3) && (idMuestra>0))//micro: se agrega control que se haya ingresado una muestra { ISession m_session = NHibernateHttpModule.CurrentSession; ICriteria crit = m_session.CreateCriteria(typeof(ItemMuestra)); diff --git a/Business/Data/Laboratorio/LogAccesoTerminosCondiciones.cs b/Business/Data/Laboratorio/LogAccesoTerminosCondiciones.cs new file mode 100644 index 00000000..ddf0777f --- /dev/null +++ b/Business/Data/Laboratorio/LogAccesoTerminosCondiciones.cs @@ -0,0 +1,104 @@ +/* +insert license info here +*/ +using System; +using System.Collections; + +namespace Business.Data.Laboratorio +{ + /// + /// Generated by MyGeneration using the NHibernate Object Mapping template + /// + [Serializable] + public sealed class LogAccesoTerminosCondiciones: Business.BaseDataAccess + { + + #region Private Members + private bool m_isChanged; + + private int m_idlogacceso; + private int m_idusuario; + private DateTime m_fecha; + #endregion + + #region Default ( Empty ) Class Constuctor + /// + /// default constructor + /// + public LogAccesoTerminosCondiciones() + { + m_idlogacceso = 0; + m_idusuario = 0; + m_fecha = DateTime.MinValue; + } + #endregion // End of Default ( Empty ) Class Constuctor + + #region Required Fields Only Constructor + /// + /// required (not null) fields only constructor + /// + public LogAccesoTerminosCondiciones( + int idusuario, + DateTime fecha) + : this() + { + m_idusuario = idusuario; + m_fecha = fecha; + } + #endregion // End Required Fields Only Constructor + + #region Public Properties + + /// + /// + /// + public int IdLogAcceso + { + get { return m_idlogacceso; } + set + { + m_isChanged |= ( m_idlogacceso != value ); + m_idlogacceso = value; + } + + } + + /// + /// + /// + public int IdUsuario + { + get { return m_idusuario; } + set + { + m_isChanged |= ( m_idusuario != value ); + m_idusuario = value; + } + + } + + /// + /// + /// + public DateTime Fecha + { + get { return m_fecha; } + set + { + m_isChanged |= ( m_fecha != value ); + m_fecha = value; + } + + } + + /// + /// Returns whether or not the object has changed it's values. + /// + public bool IsChanged + { + get { return m_isChanged; } + } + + #endregion + } +} diff --git a/Business/Data/Laboratorio/LogAccesoTerminosCondiciones.hbm.xml b/Business/Data/Laboratorio/LogAccesoTerminosCondiciones.hbm.xml new file mode 100644 index 00000000..180265fc --- /dev/null +++ b/Business/Data/Laboratorio/LogAccesoTerminosCondiciones.hbm.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Business/Data/Laboratorio/LoteDerivacion.cs b/Business/Data/Laboratorio/LoteDerivacion.cs index 12e32c7c..ef7ace96 100644 --- a/Business/Data/Laboratorio/LoteDerivacion.cs +++ b/Business/Data/Laboratorio/LoteDerivacion.cs @@ -1,5 +1,10 @@ -using System; -using System.Collections.Generic; +using NHibernate; +using NHibernate.Expression; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; using System.Text; @@ -143,34 +148,55 @@ public string descripcionEstadoLote() { return estado.Nombre; } - public bool HayDerivacionesPendientes() { - List dList = Derivacion.DerivacionesByLote(this.IdLoteDerivacion); - dList = dList.FindAll(x => x.IdProtocoloDerivacion == 0 && x.Estado == 1); - - if (dList.Count > 0) - return true; + public bool HayDerivacionesPendientes() + { + //List dList = Derivacion.DerivacionesByLote(this.IdLoteDerivacion); + //dList = dList.FindAll(x => x.IdProtocoloDerivacion == 0 && x.Estado == 1); + + //Revisar que Derivacion tenga DetalleProtocolo + string m_strSQL = " Select idDerivacion FROM LAB_Derivacion WHERE idLote=" +this.IdLoteDerivacion+ " and idProtocoloDerivacion=0 and estado=1 and " + + " idDetalleProtocolo in (Select idDetalleProtocolo FROM LAB_DetalleProtocolo where IdEfector = " + this.IdEfectorOrigen.IdEfector + ")"; + DataSet Ds = new DataSet(); + SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + adapter.Fill(Ds); + DataTable dt = Ds.Tables[0]; + + if(dt != null) + { + if (dt.Rows.Count > 0) + return true; + else + return false; + } else return false; - + } + public void ActualizaEstadoLote(int idUsuario, string ProtocoloNuevo, string ProtocoloAnterior) { if (Estado == 4) //Pasa de Recibido a Ingresado { Estado = 5; - GrabarAuditoriaLoteDerivacion(descripcionEstadoLote(), idUsuario); + LoteDerivacionEstado oEstado = new LoteDerivacionEstado(); + oEstado = (LoteDerivacionEstado)oEstado.Get(typeof(LoteDerivacionEstado), Estado); + GrabarAuditoriaLoteDerivacion(oEstado.Nombre, idUsuario); FechaIngreso = DateTime.Now; } //Graba el ingreso del protocolo en el lote GrabarAuditoriaLoteDerivacion("Ingresa protocolo", idUsuario, "Número Protocolo", ProtocoloNuevo, ProtocoloAnterior); - //Si al generar este nuevo protocolo se finalizo la carga del lote, cambiar estado a Completado + //No hay derivaciones pendientes, cambio el estado del lote a Ingresado Total if (!HayDerivacionesPendientes()) { Estado = 6; //Pasa a Completado si no tiene más derivaciones pendientes - GrabarAuditoriaLoteDerivacion(descripcionEstadoLote(), idUsuario); + LoteDerivacionEstado oEstado = new LoteDerivacionEstado(); + oEstado = (LoteDerivacionEstado)oEstado.Get(typeof(LoteDerivacionEstado), Estado); + GrabarAuditoriaLoteDerivacion(oEstado.Nombre, idUsuario); } Save(); diff --git a/Business/Data/Laboratorio/LoteDerivacion.hbm.xml b/Business/Data/Laboratorio/LoteDerivacion.hbm.xml index 499cc40d..41a49f27 100644 --- a/Business/Data/Laboratorio/LoteDerivacion.hbm.xml +++ b/Business/Data/Laboratorio/LoteDerivacion.hbm.xml @@ -3,7 +3,7 @@ - + diff --git a/Business/Data/Laboratorio/Placa.cs b/Business/Data/Laboratorio/Placa.cs index b17f7d95..2b4e38f9 100644 --- a/Business/Data/Laboratorio/Placa.cs +++ b/Business/Data/Laboratorio/Placa.cs @@ -20,6 +20,7 @@ public sealed class Placa : Business.BaseDataAccess private bool m_isChanged; private int m_idPlaca; + private Efector m_idefector; private DateTime m_fecha; private string m_operador; private string m_equipo; @@ -37,6 +38,7 @@ public sealed class Placa : Business.BaseDataAccess public Placa() { m_idPlaca = 0; + m_idefector = new Efector(); m_fecha = DateTime.MinValue; m_operador = String.Empty; m_equipo = String.Empty; @@ -53,6 +55,7 @@ public Placa() /// public Placa( int idPlaca, + Efector idefector, DateTime fecha, string operador, string equipo, @@ -62,6 +65,7 @@ public Placa( : this() { m_idPlaca = idPlaca; + m_idefector = idefector; m_fecha = fecha; m_operador = operador; m_equipo = equipo; @@ -86,6 +90,18 @@ public int IdPlaca } + public Efector IdEfector + { + get { return m_idefector; } + set + { + m_isChanged |= (m_idefector != value); + m_idefector = value; + } + + } + + public DateTime Fecha { get { return m_fecha; } diff --git a/Business/Data/Laboratorio/Placa.hbm.xml b/Business/Data/Laboratorio/Placa.hbm.xml index 5b2b1b31..2895d149 100644 --- a/Business/Data/Laboratorio/Placa.hbm.xml +++ b/Business/Data/Laboratorio/Placa.hbm.xml @@ -5,7 +5,7 @@ - + diff --git a/Business/Data/Laboratorio/Protocolo.cs b/Business/Data/Laboratorio/Protocolo.cs index 97cc0395..2f88115e 100644 --- a/Business/Data/Laboratorio/Protocolo.cs +++ b/Business/Data/Laboratorio/Protocolo.cs @@ -11,6 +11,8 @@ insert license info here using System.IO; using System.Drawing; using QRCoder; +using System.Collections.Generic; +using System.Linq; namespace Business.Data.Laboratorio { @@ -489,28 +491,31 @@ public string NombreObraSocial public string getPlacas() { - DetalleProtocolo oDetalle = new DetalleProtocolo(); - oDetalle = (DetalleProtocolo)oDetalle.Get(typeof(DetalleProtocolo),"IdProtocolo", this); - - string s_placa = ""; - ICriteria crit = m_session.CreateCriteria(typeof(DetalleProtocoloPlaca)); + string m_strSQL = @" select distinct idPlaca +from LAB_DetalleProtocoloPlaca DPP +inner join lab_detalleprotocolo DP on DPP.iddetalleprotocolo = DP.iddetalleprotocolo + where DP.idprotocolo = " + this.IdProtocolo.ToString(); + + DataSet Ds = new DataSet(); + SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + adapter.Fill(Ds); - crit.Add(Expression.Eq("IdDetalleProtocolo", oDetalle.IdDetalleProtocolo)); + DataTable dt = Ds.Tables[0]; - IList lista = crit.List(); - foreach (DetalleProtocoloPlaca oDetalle1 in lista) - { - Placa oP = new Placa(); - oP = (Placa)oP.Get(typeof(Placa), oDetalle1.IdPlaca); - if (!oP.Baja) + for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { - if (s_placa == "") - s_placa = oDetalle1.IdPlaca.ToString(); - else - s_placa += "-" + oDetalle1.IdPlaca.ToString(); + + string s_placaaux = Ds.Tables[0].Rows[i]["idPlaca"].ToString(); + + if (s_placa == "") + s_placa = s_placaaux; + else + s_placa += "-" + s_placaaux; } - } + return s_placa; @@ -1113,6 +1118,120 @@ public DateTime FechaTomaMuestra } } + public class ResultadoAnteriorDTO + { + public int IdSubItem { get; set; } + public string Resultado { get; set; } + } + + public Dictionary ObtenerResultadosAnteriores(string conexion) + { + int idPaciente = this.IdPaciente.IdPaciente; + int idProtocoloActual = this.IdProtocolo; + Dictionary diccionario = + new Dictionary(); + + string sql = @" + SELECT + dp.IdSubItem, + dp.ResultadoCar, + dp.ResultadoNum, + dp.FormatoValida, + dp.UnidadMedida + FROM LAB_DetalleProtocolo dp + INNER JOIN LAB_Protocolo p + ON p.IdProtocolo = dp.IdProtocolo + INNER JOIN + ( + SELECT + dp2.IdSubItem, + MAX(dp2.IdDetalleProtocolo) IdDetalle + FROM LAB_DetalleProtocolo dp2 + INNER JOIN LAB_Protocolo p2 + ON p2.IdProtocolo = dp2.IdProtocolo + WHERE p2.IdPaciente = @idPaciente + AND p2.Baja = 0 + AND p2.Estado > 0 + AND p2.IdProtocolo < @idProtocoloActual + AND dp2.IdUsuarioValida > 0 + GROUP BY dp2.IdSubItem + ) ult + ON ult.IdDetalle = dp.IdDetalleProtocolo + "; + + Utility oUtil = new Utility(); + + using (SqlConnection conn = + new SqlConnection(conexion + )) + { + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@idPaciente", idPaciente); + cmd.Parameters.AddWithValue("@idProtocoloActual", idProtocoloActual); + + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + while (dr.Read()) + { + int idSubItem = + Convert.ToInt32(dr["IdSubItem"]); + + string resultado = ""; + + string resultadoCar = + dr["ResultadoCar"] != DBNull.Value + ? dr["ResultadoCar"].ToString().Trim() + : ""; + + if (resultadoCar == "") + { + decimal resultadoNum = + dr["ResultadoNum"] != DBNull.Value + ? Convert.ToDecimal(dr["ResultadoNum"]) + : 0; + + string formatoValida = + dr["FormatoValida"] != DBNull.Value + ? dr["FormatoValida"].ToString() + : "0"; + + string unidadMedida = + dr["UnidadMedida"] != DBNull.Value + ? dr["UnidadMedida"].ToString() + : ""; + + string formato = + oUtil.Formato(formatoValida); + + resultado = + resultadoNum.ToString( + formato, + System.Globalization.CultureInfo.InvariantCulture); + + if (unidadMedida != "") + resultado += " " + unidadMedida; + } + else + { + resultado = + resultadoCar.Length > 10 + ? resultadoCar.Substring(0, 10) + : resultadoCar; + } + + if (!diccionario.ContainsKey(idSubItem)) + diccionario.Add(idSubItem, resultado); + } + } + } + } + + return diccionario; + } + /// /// Returns whether or not the object has changed it's values. /// @@ -1249,13 +1368,11 @@ public int GenerarNumeroMultiEfector(int idEfector) } public bool tieneAdjuntoProtocolo() { - ICriteria crit = m_session.CreateCriteria(typeof(ProtocoloAnexo)); - + ICriteria crit = m_session.CreateCriteria(typeof(ProtocoloAnexo)); crit.Add(Expression.Eq("IdProtocolo", this)); crit.Add(Expression.Eq("IdDetalleProtocolo", 0)); IList lista = crit.List(); if (lista.Count > 0) - return true; else @@ -2158,14 +2275,24 @@ public void CalcularFormulas(string s_operacion, int i_idusuario, bool solovacio { crit.Add(Expression.Eq("ConResultado",false)); } + - IList lista = crit.List(); + IList lista = crit.List(); - if (lista.Count > 0) - { + //if (lista.Count > 0) + //{ foreach (DetalleProtocolo oDet in lista) - { - ICriteria critFormula = m_session.CreateCriteria(typeof(Formula)); + { + + /*Agrego control si no tiene insumo no calcula*/ + ItemEfector oItem = new ItemEfector(); + oItem = (ItemEfector)oItem.Get(typeof(ItemEfector), "IdItem", oDet.IdSubItem, "IdEfector", this.IdEfector); + + if (oItem.SinInsumo) continue; + + /*fin control insumo */ + + ICriteria critFormula = m_session.CreateCriteria(typeof(Formula)); critFormula.Add(Expression.Eq("IdItem", oDet.IdSubItem)); critFormula.Add(Expression.Eq("IdTipoFormula", 1)); critFormula.Add(Expression.Eq("Baja", false)); @@ -2199,23 +2326,28 @@ public void CalcularFormulas(string s_operacion, int i_idusuario, bool solovacio ///evaluar si la condicion de determinacion habilita el calculo de la formula } - - - if (idraza == 1) // si es afro - { - if (idraza == oDet.IdProtocolo.IdPaciente.IdRaza) - sicalcula = true; - else - sicalcula = false; - } - if (idraza == 0) - { - if ( oDet.IdProtocolo.IdPaciente.IdRaza!=1) - sicalcula = true; - else - sicalcula = false; - } + if (idraza == 1) // si es afro + { + if (idraza == oDet.IdProtocolo.IdPaciente.IdRaza) + sicalcula = true; + else + sicalcula = false; + } + if (idraza == 0) + { + if ( oDet.IdProtocolo.IdPaciente.IdRaza!=1) + sicalcula = true; + else + sicalcula = false; + } + + /* if ((idraza == 1) && (oDet.IdProtocolo.IdPaciente.IdRaza != 1)) + sicalcula = false; + + if ((idraza == 0) && (oDet.IdProtocolo.IdPaciente.IdRaza == 1)) + sicalcula = false; + */ } if (sicalcula) @@ -2308,7 +2440,7 @@ public void CalcularFormulas(string s_operacion, int i_idusuario, bool solovacio //valor = resultado.ToString(); } } - } + //return valor; @@ -2735,33 +2867,57 @@ FROM LAB_AuditoriaProtocolo AS A INNER JOIN public string GetPracticasPedidas() { - string s_practicas = ""; - DetalleProtocolo oDetalle = new DetalleProtocolo(); - ISession m_session = NHibernateHttpModule.CurrentSession; - ICriteria crit = m_session.CreateCriteria(typeof(DetalleProtocolo)); - crit.Add(Expression.Eq("IdProtocolo", this)); - crit.Add(Expression.Eq("Informable", true)); - crit.AddOrder(Order.Asc("IdDetalleProtocolo")); - - IList items = crit.List(); - string pivot = ""; - string sDatos = ""; - foreach (DetalleProtocolo oDet in items) - { - if (pivot != oDet.IdItem.Nombre) - { - if (sDatos == "") - sDatos = oDet.IdItem.Nombre; - else - sDatos += " - " + oDet.IdItem.Nombre; - //sDatos += "#" + oDet.IdItem.Codigo + "#" + oDet.IdItem.Nombre + "#" + oDet.TrajoMuestra + "@"; - pivot = oDet.IdItem.Nombre; - } - + /* string s_practicas = ""; + DetalleProtocolo oDetalle = new DetalleProtocolo(); + ISession m_session = NHibernateHttpModule.CurrentSession; + ICriteria crit = m_session.CreateCriteria(typeof(DetalleProtocolo)); + crit.Add(Expression.Eq("IdProtocolo", this)); + crit.Add(Expression.Eq("Informable", true)); + crit.AddOrder(Order.Asc("IdDetalleProtocolo")); + + IList items = crit.List(); + string pivot = ""; + string sDatos = ""; + foreach (DetalleProtocolo oDet in items) + { + if (pivot != oDet.IdItem.Nombre) + { + if (sDatos == "") + sDatos = oDet.IdItem.Nombre; + else + sDatos += " - " + oDet.IdItem.Nombre; + //sDatos += "#" + oDet.IdItem.Codigo + "#" + oDet.IdItem.Nombre + "#" + oDet.TrajoMuestra + "@"; + pivot = oDet.IdItem.Nombre; + } + + } + + s_practicas = sDatos; + return s_practicas; + */ + ISession session = NHibernateHttpModule.CurrentSession; + + IList practicas = session.CreateQuery(@" + select distinct i.Nombre + from DetalleProtocolo dp + inner join dp.IdItem i + where dp.IdProtocolo = :protocolo + and dp.Informable = 1 + order by i.Nombre") + .SetEntity("protocolo", this) + .List(); + + string resultado = ""; + + foreach (object item in practicas) + { + if (resultado == "") + resultado = item.ToString(); + else + resultado += " - " + item.ToString(); } - s_practicas = sDatos; - return s_practicas; + return resultado; } public void ActualizarNumeroDesdeID() diff --git a/Business/Data/Laboratorio/ProtocoloAtbMecanismo.cs b/Business/Data/Laboratorio/ProtocoloAtbMecanismo.cs index e2482c6d..a509fb3c 100644 --- a/Business/Data/Laboratorio/ProtocoloAtbMecanismo.cs +++ b/Business/Data/Laboratorio/ProtocoloAtbMecanismo.cs @@ -18,6 +18,7 @@ public sealed class ProtocoloAtbMecanismo : Business.BaseDataAccess private int m_idProtocoloAtbMecanismo; private Protocolo m_idprotocolo; + private int m_numeroaislamiento; private int m_idmetodologia; private int m_iditem; private Germen m_idgermen; @@ -40,6 +41,7 @@ public ProtocoloAtbMecanismo() m_idprotocolo = new Protocolo(); m_idgermen = new Germen(); m_idmetodologia = 0; + m_numeroaislamiento = 0; m_iditem = 0; m_idmecanismo = new MecanismoResistencia(); @@ -54,6 +56,7 @@ public ProtocoloAtbMecanismo( Protocolo idprotocolo, Germen idgermen, int idmetodologia, + int numeroaislamiento, int iditem, MecanismoResistencia idmecanismo ) @@ -61,6 +64,7 @@ MecanismoResistencia idmecanismo { m_idprotocolo = idprotocolo; m_idgermen = idgermen; + m_numeroaislamiento = numeroaislamiento; m_idmetodologia = idmetodologia; m_iditem = iditem; m_idmecanismo = idmecanismo; @@ -100,6 +104,18 @@ public int IdItem } + + public int NumeroAislamiento + { + get { return m_numeroaislamiento; } + set + { + m_isChanged |= (m_numeroaislamiento != value); + m_numeroaislamiento = value; + } + + } + public int IdMetodologia { get { return m_idmetodologia; } diff --git a/Business/Data/Laboratorio/ProtocoloAtbMecanismo.hbm.xml b/Business/Data/Laboratorio/ProtocoloAtbMecanismo.hbm.xml index c971ec33..7659d249 100644 --- a/Business/Data/Laboratorio/ProtocoloAtbMecanismo.hbm.xml +++ b/Business/Data/Laboratorio/ProtocoloAtbMecanismo.hbm.xml @@ -8,7 +8,7 @@ - + diff --git a/Business/Data/Laboratorio/ProtocoloDiagnostico.cs b/Business/Data/Laboratorio/ProtocoloDiagnostico.cs index 3273fdfa..3736e423 100644 --- a/Business/Data/Laboratorio/ProtocoloDiagnostico.cs +++ b/Business/Data/Laboratorio/ProtocoloDiagnostico.cs @@ -19,20 +19,22 @@ public sealed class ProtocoloDiagnostico : Business.BaseDataAccess private int m_idprotocolodiagnostico; private Protocolo m_idprotocolo; private Efector m_idefector; - private int m_iddiagnostico; - #endregion + private int m_iddiagnostico; + private string m_tipo; + #endregion - #region Default ( Empty ) Class Constuctor - /// - /// default constructor - /// - public ProtocoloDiagnostico() + #region Default ( Empty ) Class Constuctor + /// + /// default constructor + /// + public ProtocoloDiagnostico() { m_idprotocolodiagnostico = 0; m_idprotocolo = new Protocolo(); m_idefector = new Efector(); - m_iddiagnostico = 0; - } + m_iddiagnostico = 0; + m_tipo = String.Empty; + } #endregion // End of Default ( Empty ) Class Constuctor #region Required Fields Only Constructor @@ -42,13 +44,15 @@ public ProtocoloDiagnostico() public ProtocoloDiagnostico( Protocolo idprotocolo, Efector idefector, - int iddiagnostico) + int iddiagnostico, + string tipo) : this() { m_idprotocolo = idprotocolo; m_idefector = idefector; m_iddiagnostico = iddiagnostico; - } + m_tipo = tipo; + } #endregion // End Required Fields Only Constructor #region Public Properties @@ -108,11 +112,28 @@ public int IdDiagnostico } } - - /// - /// Returns whether or not the object has changed it's values. - /// - public bool IsChanged + + + public string Tipo + { + get { return m_tipo; } + + set + { + if (value == null) + throw new ArgumentOutOfRangeException("Null value not allowed for m_tipo", value, "null"); + + if (value.Length > 10) + throw new ArgumentOutOfRangeException("Invalid value for m_tipo", value, value.ToString()); + + m_isChanged |= (m_tipo != value); m_tipo = value; + } + } + + /// + /// Returns whether or not the object has changed it's values. + /// + public bool IsChanged { get { return m_isChanged; } } diff --git a/Business/Data/Laboratorio/ProtocoloDiagnostico.hbm.xml b/Business/Data/Laboratorio/ProtocoloDiagnostico.hbm.xml index 49bcadb4..5ec0aa95 100644 --- a/Business/Data/Laboratorio/ProtocoloDiagnostico.hbm.xml +++ b/Business/Data/Laboratorio/ProtocoloDiagnostico.hbm.xml @@ -11,6 +11,6 @@ - + diff --git a/Business/Data/Laboratorio/ProtocoloMecanismoResistencia.cs b/Business/Data/Laboratorio/ProtocoloMecanismoResistencia.cs deleted file mode 100644 index 0af34681..00000000 --- a/Business/Data/Laboratorio/ProtocoloMecanismoResistencia.cs +++ /dev/null @@ -1,113 +0,0 @@ -/* -insert license info here -*/ -using System; -using System.Collections; - -namespace Business.Data.Laboratorio -{ - /// - /// Generated by MyGeneration using the NHibernate Object Mapping template - /// - [Serializable] - public sealed class ProtocoloMecanismoResistencia : Business.BaseDataAccess - { - - #region Private Members - private bool m_isChanged; - - private int m_idprotocolomecanismoresistencia; - private ProtocoloGermen m_idprotocologermen; - private MecanismoResistencia m_idmecanismoresistencia; - - #endregion - - #region Default ( Empty ) Class Constuctor - /// - /// default constructor - /// - public ProtocoloMecanismoResistencia() - { - m_idprotocolomecanismoresistencia = 0; - m_idprotocologermen = new ProtocoloGermen(); - m_idmecanismoresistencia = new MecanismoResistencia(); - - } - #endregion // End of Default ( Empty ) Class Constuctor - - #region Required Fields Only Constructor - /// - /// required (not null) fields only constructor - /// - public ProtocoloMecanismoResistencia( - ProtocoloGermen idprotocologermen, - MecanismoResistencia idmecanismoresistencia - ) - : this() - { - m_idprotocologermen = idprotocologermen; - m_idmecanismoresistencia = idmecanismoresistencia; - - } - #endregion // End Required Fields Only Constructor - - #region Public Properties - - /// - /// - /// - public int IdProtocoloMecanismoResistencia - { - get { return m_idprotocolomecanismoresistencia; } - set - { - m_isChanged |= (m_idprotocolomecanismoresistencia != value); - m_idprotocolomecanismoresistencia = value; - } - - } - - /// - /// - /// - public ProtocoloGermen IdProtocoloGermen - { - get { return m_idprotocologermen; } - set - { - m_isChanged |= (m_idprotocologermen != value); - m_idprotocologermen = value; - } - - } - - /// - /// - /// - public MecanismoResistencia IdMecanismoResistencia - { - get { return m_idmecanismoresistencia ; } - set - { - m_isChanged |= (m_idmecanismoresistencia != value); - m_idmecanismoresistencia = value; - } - - } - - /// - /// - /// - - - /// - /// Returns whether or not the object has changed it's values. - /// - public bool IsChanged - { - get { return m_isChanged; } - } - - #endregion - } -} diff --git a/Business/Data/Laboratorio/ProtocoloMecanismoResistencia.hbm.xml b/Business/Data/Laboratorio/ProtocoloMecanismoResistencia.hbm.xml deleted file mode 100644 index 34f6c682..00000000 --- a/Business/Data/Laboratorio/ProtocoloMecanismoResistencia.hbm.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Business/Data/Laboratorio/ValorReferencia.cs b/Business/Data/Laboratorio/ValorReferencia.cs index c1f138be..f7479268 100644 --- a/Business/Data/Laboratorio/ValorReferencia.cs +++ b/Business/Data/Laboratorio/ValorReferencia.cs @@ -304,7 +304,7 @@ public string Observacion if (value == null) throw new ArgumentOutOfRangeException("Null value not allowed for Descripcion", value, "null"); - if (value.Length > 500) + if (value.Length > 1000) throw new ArgumentOutOfRangeException("Invalid value for Descripcion", value, value.ToString()); m_isChanged |= (m_observacion != value); m_observacion = value; diff --git a/Business/Data/Usuario.cs b/Business/Data/Usuario.cs index af779a53..1982d0a8 100644 --- a/Business/Data/Usuario.cs +++ b/Business/Data/Usuario.cs @@ -33,9 +33,11 @@ public sealed class Usuario: Business.BaseDataAccess private int m_idarea; private bool m_requiereCambioPass; private bool m_administrador; - private bool m_externo; + private bool m_externo; private string m_email; private string m_telefono; + private DateTime m_fechaTerminosCondiciones; + private string m_tipoAutenticacion; #endregion #region Default ( Empty ) Class Constuctor @@ -63,7 +65,8 @@ public Usuario() m_externo = false; m_email= String.Empty; m_telefono = String.Empty; - + m_tipoAutenticacion = String.Empty; + m_fechaTerminosCondiciones = new DateTime(1900,01,01); } @@ -93,7 +96,8 @@ public Usuario( m_requiereCambioPass = false; m_administrador = false; m_externo = false; - + m_tipoAutenticacion = String.Empty; + m_fechaTerminosCondiciones = new DateTime(1900, 01, 01); } #endregion // End Required Fields Only Constructor @@ -330,7 +334,7 @@ public bool Activo } } - public bool Externo + public bool Externo { get { return m_externo; } set @@ -429,24 +433,46 @@ public bool IsChanged get { return m_isChanged; } } - - #endregion + /// + /// + /// + public string TipoAutenticacion + { + get { return m_tipoAutenticacion; } + + set + { + if (value != null && value.Length > 10) + throw new ArgumentOutOfRangeException("Invalid value for m_tipoAutenticacion", value, value.ToString()); + + m_isChanged |= (m_tipoAutenticacion != value); m_tipoAutenticacion = value; + } + } + #endregion + + #region Metodos - #region Metodos + #endregion - #endregion + //public bool esHemoterapia() + //{ + // var index=this.IdPerfil.Nombre.ToUpper().IndexOf("HEMOTERAPIA"); + // if (index > -1) return true; + // else return false; - //public bool esHemoterapia() - //{ - // var index=this.IdPerfil.Nombre.ToUpper().IndexOf("HEMOTERAPIA"); - // if (index > -1) return true; - // else return false; + //} - //} + public DateTime FechaAceptaTerminosCondiciones { + get { return m_fechaTerminosCondiciones; } + set { + m_isChanged |= (m_fechaTerminosCondiciones != value); + m_fechaTerminosCondiciones = value; + } } + } } diff --git a/Business/Data/Usuario.hbm.xml b/Business/Data/Usuario.hbm.xml index c0208ff7..189eb376 100644 --- a/Business/Data/Usuario.hbm.xml +++ b/Business/Data/Usuario.hbm.xml @@ -27,8 +27,10 @@ - + + + diff --git a/ImprimeLocal/App.config b/ImprimeLocal/App.config index b22e4bae..60ff3ed0 100644 --- a/ImprimeLocal/App.config +++ b/ImprimeLocal/App.config @@ -21,12 +21,12 @@ - - + + - + - + diff --git a/WebLab/Agendas/AgendaEdit.aspx b/WebLab/Agendas/AgendaEdit.aspx index 87ba3874..602dd73e 100644 --- a/WebLab/Agendas/AgendaEdit.aspx +++ b/WebLab/Agendas/AgendaEdit.aspx @@ -52,7 +52,11 @@
- + + + + diff --git a/WebLab/Derivaciones/Derivados2.aspx.cs b/WebLab/Derivaciones/Derivados2.aspx.cs index 8abf0a89..f3bc023f 100644 --- a/WebLab/Derivaciones/Derivados2.aspx.cs +++ b/WebLab/Derivaciones/Derivados2.aspx.cs @@ -239,16 +239,25 @@ private void verificaResultados(string str_condicion) if (dt.Rows.Count > 0) { - if (Request["tipo"] == "informe") - Response.Redirect("InformeList3.aspx?Parametros=" + str_condicion + "&Estado=" + rdbEstado.SelectedValue + "&Destino=" + ddlEfector.SelectedValue + "&Tipo=Alta" , false); + if(dt.Rows.Count <= 5000) + { + if (Request["tipo"] == "informe") + Response.Redirect("InformeList3.aspx?Parametros=" + str_condicion + "&Estado=" + rdbEstado.SelectedValue + "&Destino=" + ddlEfector.SelectedValue + "&Tipo=Alta", false); + else + if (Request["tipo"] == "resultado") + Response.Redirect("../Derivaciones/ResultadoEdit.aspx?Parametros=" + str_condicion, false); + } else - if (Request["tipo"] == "resultado") - Response.Redirect("../Derivaciones/ResultadoEdit.aspx?Parametros=" + str_condicion, false); + { + cvBotonBuscar.IsValid = false; + cvBotonBuscar.ErrorMessage = "La búsqueda ha superado el límite de procesamiento para la operación que desea realizar. Acote los filtros de búsqueda. Si cree que este mensaje es un error, póngase en contacto con el soporte del SIL."; + } } else { cvBotonBuscar.IsValid = false; //que de error sin enviar alert + cvBotonBuscar.ErrorMessage = "No hay coincidencias con los criterios ingresados."; } @@ -279,5 +288,34 @@ public DataTable GetDataSet(string parametros) return Ds.Tables[0]; } + protected void cvBotonBuscar_ServerValidate(object source, ServerValidateEventArgs args) + { + if (Page.IsValid) + { + if (diferenciamayorunanio(DateTime.Parse(txtFechaDesde.Value), DateTime.Parse(txtFechaHasta.Value)) > 1) + { + cvBotonBuscar.ErrorMessage = "No es posible generar información para mas de 1 año. Verifique."; + args.IsValid = false; + } + } + else + { + + cvBotonBuscar.ErrorMessage = "No hay coincidencias con los criterios ingresados."; + args.IsValid = false; + } + } + + + private double diferenciamayorunanio(DateTime desde, DateTime hasta) + { + double dif = 0; + TimeSpan diferencia = hasta - desde; + + // 365.2425 días es la duración media de un año gregoriano (considerando años bisiestos) + dif = diferencia.TotalDays / 365.2425; + return dif; + } + } } diff --git a/WebLab/Derivaciones/InformeLote.aspx b/WebLab/Derivaciones/InformeLote.aspx index 6b01eb65..fb9427e9 100644 --- a/WebLab/Derivaciones/InformeLote.aspx +++ b/WebLab/Derivaciones/InformeLote.aspx @@ -3,6 +3,12 @@ diff --git a/WebLab/Derivaciones/InformeLote.aspx.cs b/WebLab/Derivaciones/InformeLote.aspx.cs index b6914eca..9b0efd72 100644 --- a/WebLab/Derivaciones/InformeLote.aspx.cs +++ b/WebLab/Derivaciones/InformeLote.aspx.cs @@ -65,10 +65,10 @@ protected void Page_Load(object sender, EventArgs e) CargarGrilla(); CargarControles(); } - else - { - CargarFechaHoraActual(); //Despues de guardar, si no tenia fecha seleccionada lo trae ahora sin datos - } + //else + //{ + // CargarFechaHoraActual(); //Despues de guardar, si no tenia fecha seleccionada lo trae ahora sin datos --> NO recuerdo cuando sucedia, pero si ahora lo dejo, pone la fecha actual en envio y no la del formulario. + //} } else diff --git a/WebLab/Estadisticas/EstadisticaResultadoTexto.aspx.cs b/WebLab/Estadisticas/EstadisticaResultadoTexto.aspx.cs index 88ac67a0..f75d45d9 100644 --- a/WebLab/Estadisticas/EstadisticaResultadoTexto.aspx.cs +++ b/WebLab/Estadisticas/EstadisticaResultadoTexto.aspx.cs @@ -195,6 +195,8 @@ private void CargarListas() protected void btnExcel_Click(object sender, EventArgs e) { string m_listaCodigo = ""; string m_listaNombres = ""; + HashSet listaNombres = new HashSet(StringComparer.OrdinalIgnoreCase); //Para que no repitan los nombres de los analisis de las practicas, que da un error en PIVOT as Child. + for (int i = 0; i < lstItem.Items.Count; i++) { if (lstItem.Items[i].Selected) @@ -234,10 +236,12 @@ protected void btnExcel_Click(object sender, EventArgs e) m_listaCodigo = "'" + oDet2.Codigo + "'"; else m_listaCodigo += ",'" + oDet2.Codigo + "'"; - if (m_listaNombres == "") - m_listaNombres = "[" + oDet2.Nombre.Replace("[", "").Replace("]", "") + "]"; - else - m_listaNombres += ",[" + oDet2.Nombre.Replace("[", "").Replace("]", "") + "]"; + //if (m_listaNombres == "") + // m_listaNombres = "[" + oDet2.Nombre.Replace("[", "").Replace("]", "") + "]"; + //else + // m_listaNombres += ",[" + oDet2.Nombre.Replace("[", "").Replace("]", "") + "]"; + string nombres = "[" + oDet2.Nombre.Replace("[", "").Replace("]", "") + "]"; + listaNombres.Add(nombres); } } } @@ -248,10 +252,12 @@ protected void btnExcel_Click(object sender, EventArgs e) m_listaCodigo = "'" + oitemEfector.IdItem.Codigo + "'"; else m_listaCodigo += ",'" + oitemEfector.IdItem.Codigo + "'"; - if (m_listaNombres == "") - m_listaNombres = "[" + oitemEfector.IdItem.Nombre.Replace("[","").Replace("]", "") + "]"; - else - m_listaNombres += ",[" + oitemEfector.IdItem.Nombre.Replace("[", "").Replace("]", "") + "]"; + //if (m_listaNombres == "") + // m_listaNombres = "[" + oitemEfector.IdItem.Nombre.Replace("[","").Replace("]", "") + "]"; + //else + // m_listaNombres += ",[" + oitemEfector.IdItem.Nombre.Replace("[", "").Replace("]", "") + "]"; + string nombres = "[" + oitemEfector.IdItem.Nombre.Replace("[", "").Replace("]", "") + "]"; + listaNombres.Add(nombres); } } @@ -261,7 +267,8 @@ protected void btnExcel_Click(object sender, EventArgs e) } } - if (m_listaNombres != "") + //if (m_listaNombres != "") + if(listaNombres.Count > 0) { string m_strSQLCondicion = " 1=1 and b.baja=0 "; @@ -290,22 +297,30 @@ protected void btnExcel_Click(object sender, EventArgs e) m_strSQLCondicion += " AND b.fechaRegistro < '" + fecha2.ToString("yyyyMMdd") + "'"; } + foreach (string nombre in listaNombres) + { + if (m_listaNombres == "") + m_listaNombres = nombre; + else + m_listaNombres += "," + nombre ; + } + string m_strSQL = @"with vta_ResultadoPivot_car1 as ( -SELECT b.numero AS numero, b.fecha, -case when I.idtiporesultado=1 then convert(varchar,DP.resultadoNum) else -DP.resultadoCar end as resultadoCar, DP.idProtocolo,replace( replace(I.nombre,'[',''),']','') AS item -FROM dbo.LAB_DetalleProtocolo AS DP with (nolock) - inner join LAB_Item I with (nolock) on I.iditem= DP.idsubitem - inner join lab_protocolo b with (nolock) on dp.idProtocolo = b.idProtocolo -WHERE " + m_strSQLCondicion + @" and codigo in (" + m_listaCodigo + @") and DP.idUsuarioValida>0 -) -SELECT Child.numero as Protocolo, fecha," + m_listaNombres + - @"FROM ( - SELECT a.* FROM vta_ResultadoPivot_car1 a " + @" - ) - pvt PIVOT (max(resultadocar) FOR item IN (" + m_listaNombres + @")) AS Child - "; + SELECT b.numero AS numero, b.fecha, + case when I.idtiporesultado=1 then convert(varchar,DP.resultadoNum) else + DP.resultadoCar end as resultadoCar, DP.idProtocolo,replace( replace(I.nombre,'[',''),']','') AS item + FROM dbo.LAB_DetalleProtocolo AS DP with (nolock) + inner join LAB_Item I with (nolock) on I.iditem= DP.idsubitem + inner join lab_protocolo b with (nolock) on dp.idProtocolo = b.idProtocolo + WHERE " + m_strSQLCondicion + @" and codigo in (" + m_listaCodigo + @") and DP.idUsuarioValida>0 + ) + SELECT Child.numero as Protocolo, fecha," + m_listaNombres + + @"FROM ( + SELECT a.* FROM vta_ResultadoPivot_car1 a " + @" + ) + pvt PIVOT (max(resultadocar) FOR item IN (" + m_listaNombres + @")) AS Child + "; DataSet Ds = new DataSet(); diff --git a/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs b/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs index 4a72bc94..1a6c1f42 100644 --- a/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs +++ b/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs @@ -1041,13 +1041,13 @@ FROM LAB_DetalleProtocolo AS DP FROM LAB_DetalleProtocolo AS DP INNER JOIN LAB_Protocolo AS P ON DP.idProtocolo = P.idProtocolo -INNER JOIN LAB_Item AS I ON DP.idItem = I.idItem +---INNER JOIN LAB_Item AS I ON DP.idItem = I.idItem inner join lab_item as I1 on Dp.idsubitem= I1.iditem INNER JOIN Sys_Paciente AS Pa ON P.idPaciente = Pa.idPaciente left JOIN vta_LAB_Embarazadas AS PD ON PD.idProtocolo = P.idProtocolo WHERE dp.idItem=" + ddlAnalisis.SelectedValue + " AND (P.fecha >= '" + fecha1.ToString("yyyyMMdd") + "') AND (P.fecha <= '" + fecha2.ToString("yyyyMMdd") + "') and P.idtiposervicio=3 " + - " and I1.idtiporesultado=3 and resultadocar<>'' and idusuariovalida>0 " + m_strCondicion + " order by P.idprotocolo ,P.fecha "; + " and I1.idtiporesultado in (3,4) and resultadocar<>'' and idusuariovalida>0 " + m_strCondicion + " order by P.idprotocolo ,P.fecha "; } diff --git a/WebLab/ImpresionResult/ImprimirBusqueda.aspx.cs b/WebLab/ImpresionResult/ImprimirBusqueda.aspx.cs index d60e2a21..d49d1cf6 100644 --- a/WebLab/ImpresionResult/ImprimirBusqueda.aspx.cs +++ b/WebLab/ImpresionResult/ImprimirBusqueda.aspx.cs @@ -11,16 +11,41 @@ using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using Business; +using Business.Data; namespace WebLab.ImpresionResult { public partial class ImprimirBusqueda : System.Web.UI.Page { + + public Usuario oUser = new Usuario(); + + protected void Page_PreInit(object sender, EventArgs e) + { + + //MiltiEfector: Filtra para configuracion del efector del usuario + if (Session["idUsuario"] != null) + { + oUser = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString())); + + } + else Response.Redirect("../FinSesion.aspx", false); + + + } + protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { - CargarPagina(); + if (Session["idUsuario"] != null) + { + CargarPagina(); + + } + else Response.Redirect("../FinSesion.aspx", false); + + } } @@ -203,7 +228,8 @@ private void CargarListas() CargarArea(); ///Carga de Sectores - m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio (nolock) WHERE (baja = 0) order by nombre"; + m_ssql = @"SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio S (nolock) WHERE (baja = 0) + and exists (select 1 from Lab_SectorServicioEfector SE where SE.idSectorServicio = S.idSectorServicio and se.idefector = " + oUser.IdEfector.IdEfector.ToString() + @") order by nombre"; oUtil.CargarListBox(lstSector, m_ssql, "idSectorServicio", "nombre"); for (int i = 0; i < lstSector.Items.Count; i++) { diff --git a/WebLab/ImpresionResult/ResultadoList.aspx.cs b/WebLab/ImpresionResult/ResultadoList.aspx.cs index 77b83c5d..eb50a559 100644 --- a/WebLab/ImpresionResult/ResultadoList.aspx.cs +++ b/WebLab/ImpresionResult/ResultadoList.aspx.cs @@ -202,17 +202,24 @@ private object LeerDatos() string m_strSQL = ""; if (Request["idTipoServicio"].ToString() != "5") - m_strSQL = @" SELECT DISTINCT P.idProtocolo, - P.numero as numero, CONVERT(varchar(10),P.fecha,103) as fecha, case when Pa.idestado= 2 then Pa.numeroAdic else convert(varchar,Pa.numeroDocumento) end as dni ,Pa.apellido+ ' ' + Pa.nombre as paciente, + m_strSQL = @" SELECT P.idProtocolo, + P.numero as numero, CONVERT(varchar(10),P.fecha,103) as fecha, + CASE + WHEN Pa.idestado = 2 THEN CAST(Pa.numeroAdic AS varchar(20)) + ELSE CAST(Pa.numeroDocumento AS varchar(20)) + END as dni ,Pa.apellido+ ' ' + Pa.nombre as paciente, O.nombre as origen, Pri.nombre as prioridad, SS.nombre as sector,P.estado, P.impreso FROM Lab_Protocolo P (nolock) INNER JOIN Lab_Origen O (nolock) on O.idOrigen= P.idOrigen INNER JOIN Lab_Prioridad Pri (nolock) on Pri.idPrioridad= P.idPrioridad INNER JOIN Sys_Paciente Pa (nolock) on Pa.idPaciente= P.idPaciente - INNER JOIN LAB_SectorServicio SS (nolock) ON P.idSector= SS.idSectorServicio - INNER JOIN LAB_DetalleProtocolo AS DP (nolock) ON P.idProtocolo = DP.idProtocolo - INNER JOIN LAB_Item AS I (nolock) ON DP.idItem = I.idItem - WHERE " + str_condicion +str_orden; + INNER JOIN LAB_SectorServicio SS (nolock) ON P.idSector= SS.idSectorServicio + WHERE " + str_condicion + + @" AND EXISTS ( + SELECT 1 + FROM LAB_DetalleProtocolo DP WITH (NOLOCK) + WHERE DP.idProtocolo = P.idProtocolo + )"+ str_orden; else m_strSQL = @" SELECT DISTINCT P.idProtocolo, P.numero as numero, CONVERT(varchar(10),P.fecha,103) as fecha, M.nombre as muestra, C.descripcion as conservacion, diff --git a/WebLab/Informes/Auditoria.aspx.cs b/WebLab/Informes/Auditoria.aspx.cs index b1e2c999..e7f53358 100644 --- a/WebLab/Informes/Auditoria.aspx.cs +++ b/WebLab/Informes/Auditoria.aspx.cs @@ -124,11 +124,11 @@ private void CargarListas() string m_ssql = @" select idusuario, apellido + ' ' +nombre as nombre from sys_usuario u with (nolock) - where activo = 1 + where activo = 1 and username <>'adminapi' and exists (select 1 from sys_usuarioefector e (nolock) where e.idusuario = u.idusuario and e.idEfector = " + oUser.IdEfector.IdEfector.ToString() + @") order by apellido, nombre"; if (oUser.Administrador) { - m_ssql = @" select idusuario, apellido + ' ' +nombre as nombre from sys_usuario u with (nolock) where activo = 1 order by apellido, nombre"; + m_ssql = @" select idusuario, apellido + ' ' +nombre as nombre from sys_usuario u with (nolock) where activo = 1 and username <>'adminapi' order by apellido, nombre"; } oUtil.CargarCombo(ddlUsuario, m_ssql, "idusuario", "nombre", connReady); oUtil.CargarCombo(ddlUsuario2, m_ssql, "idusuario", "nombre", connReady); diff --git a/WebLab/Informes/AuditoriaUsuario.aspx.cs b/WebLab/Informes/AuditoriaUsuario.aspx.cs index afb4eff7..225967c0 100644 --- a/WebLab/Informes/AuditoriaUsuario.aspx.cs +++ b/WebLab/Informes/AuditoriaUsuario.aspx.cs @@ -68,7 +68,7 @@ private void CargarListas() { Utility oUtil = new Utility(); ///Carga de combos de tipos de servicios - string m_ssql = "select idusuario, apellido + ' ' +nombre as nombre from sys_usuario order by apellido, nombre"; + string m_ssql = "select idusuario, apellido + ' ' +nombre as nombre from sys_usuario where username<>'adminapi' order by apellido, nombre"; oUtil.CargarCombo(ddlUsuarioModificado, m_ssql, "idusuario", "nombre"); oUtil.CargarCombo(ddlUsuarioABM, m_ssql, "idusuario", "nombre"); diff --git a/WebLab/Informes/HistoriaClinica.aspx.cs b/WebLab/Informes/HistoriaClinica.aspx.cs index d1f36f04..ad26db10 100644 --- a/WebLab/Informes/HistoriaClinica.aspx.cs +++ b/WebLab/Informes/HistoriaClinica.aspx.cs @@ -24,17 +24,26 @@ namespace WebLab.Informes public partial class HistoriaClinica : System.Web.UI.Page { Paciente oPaciente = new Paciente(); - + Configuracion oCon = new Configuracion(); public CrystalReportSource oCr = new CrystalReportSource(); - + public Usuario oUser = new Usuario(); protected void Page_PreInit(object sender, EventArgs e) { oCr.Report.FileName = ""; oCr.CacheDuration = 0; oCr.EnableCaching = false; + if (Session["idUsuario"] != null) + { + + oUser = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString())); + oCon = (Configuracion)oCon.Get(typeof(Configuracion), "IdEfector", oUser.IdEfector); - } + } + else + Response.Redirect("SinDatos.aspx", false); + + } protected void Page_Load(object sender, EventArgs e) { @@ -131,7 +140,8 @@ private void MostrarPaciente() private DataTable LlenarDatos() { DataSet Ds = new DataSet(); - SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + string conexion = ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString; + SqlConnection conn = new SqlConnection(conexion); ///Performance: conexion de solo lectura SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; @@ -186,16 +196,25 @@ private void ExportarPDF() dt =LlenarDatos(); if (dt.Rows.Count > 0) { - Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1); + /// Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1); + string enc1 = "SUBSECRETARIA DE SALUD"; + string enc2 = "SISTEMA INFORMATICO PROVINCIAL DE LABORATORIO"; + string enc3 = ""; + if (oUser.IdEfector.IdEfector != 227) + { + enc1= oCon.EncabezadoLinea1; + enc2 = oCon.EncabezadoLinea2; + enc3 = oCon.EncabezadoLinea3; + } ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue(); - encabezado1.Value = oCon.EncabezadoLinea1; + encabezado1.Value = enc1;// oCon.EncabezadoLinea1; ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue(); - encabezado2.Value = oCon.EncabezadoLinea2; + encabezado2.Value = enc2; // oCon.EncabezadoLinea2; ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue(); - encabezado3.Value = oCon.EncabezadoLinea3; + encabezado3.Value = enc3;// oCon.EncabezadoLinea3; ParameterDiscreteValue encabezado4 = new ParameterDiscreteValue(); encabezado4.Value = lblAnalisis.Text; @@ -244,15 +263,7 @@ private void ExportarPDF() oCr.DataBind(); oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Historial_Resultados.pdf"); - //MemoryStream oStream; // using System.IO - //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); - //Response.Clear(); - //Response.Buffer = true; - //Response.ContentType = "application/pdf"; - //Response.AddHeader("Content-Disposition", "attachment;filename=Historial_Resultados.pdf"); - - //Response.BinaryWrite(oStream.ToArray()); - //Response.End(); + } else Response.Redirect("SinDatos.aspx", false); diff --git a/WebLab/Informes/HojasdeTrabajo/HTrabajoProtocolo2Horizontal.cs b/WebLab/Informes/HojasdeTrabajo/HTrabajoProtocolo2Horizontal.cs new file mode 100644 index 00000000..da616cbc --- /dev/null +++ b/WebLab/Informes/HojasdeTrabajo/HTrabajoProtocolo2Horizontal.cs @@ -0,0 +1,217 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebLab.Informes.HojasdeTrabajo { + using System; + using System.ComponentModel; + using CrystalDecisions.Shared; + using CrystalDecisions.ReportSource; + using CrystalDecisions.CrystalReports.Engine; + + + public class HTrabajoProtocolo2Horizontal : ReportClass { + + public HTrabajoProtocolo2Horizontal() { + } + + public override string ResourceName { + get { + return "HTrabajoProtocolo2Horizontal.rpt"; + } + set { + // Do nothing + } + } + + public override bool NewGenerator { + get { + return true; + } + set { + // Do nothing + } + } + + public override string FullResourceName { + get { + return "WebLab.Informes.HojasdeTrabajo.HTrabajoProtocolo2Horizontal.rpt"; + } + set { + // Do nothing + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section Section1 { + get { + return this.ReportDefinition.Sections[0]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section Section2 { + get { + return this.ReportDefinition.Sections[1]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section GroupHeaderSection1 { + get { + return this.ReportDefinition.Sections[2]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section GroupHeaderSection2 { + get { + return this.ReportDefinition.Sections[3]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section Section3 { + get { + return this.ReportDefinition.Sections[4]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section GroupFooterSection2 { + get { + return this.ReportDefinition.Sections[5]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section GroupFooterSection1 { + get { + return this.ReportDefinition.Sections[6]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section Section4 { + get { + return this.ReportDefinition.Sections[7]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.CrystalReports.Engine.Section Section5 { + get { + return this.ReportDefinition.Sections[8]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.Shared.IParameterField Parameter_encabezado1 { + get { + return this.DataDefinition.ParameterFields[0]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.Shared.IParameterField Parameter_encabezado2 { + get { + return this.DataDefinition.ParameterFields[1]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.Shared.IParameterField Parameter_encabezado3 { + get { + return this.DataDefinition.ParameterFields[2]; + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public CrystalDecisions.Shared.IParameterField Parameter_imprimirFechaHora { + get { + return this.DataDefinition.ParameterFields[3]; + } + } + } + + [System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions), "report.bmp")] + public class CachedHTrabajoProtocolo2Horizontal : Component, ICachedReport { + + public CachedHTrabajoProtocolo2Horizontal() { + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public virtual bool IsCacheable { + get { + return true; + } + set { + // + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public virtual bool ShareDBLogonInfo { + get { + return false; + } + set { + // + } + } + + [Browsable(false)] + [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public virtual System.TimeSpan CacheTimeOut { + get { + return CachedReportConstants.DEFAULT_TIMEOUT; + } + set { + // + } + } + + public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { + HTrabajoProtocolo2Horizontal rpt = new HTrabajoProtocolo2Horizontal(); + rpt.Site = this.Site; + return rpt; + } + + public virtual string GetCustomizedCacheKey(RequestContext request) { + String key = null; + // // The following is the code used to generate the default + // // cache key for caching report jobs in the ASP.NET Cache. + // // Feel free to modify this code to suit your needs. + // // Returning key == null causes the default cache key to + // // be generated. + // + // key = RequestContext.BuildCompleteCacheKey( + // request, + // null, // sReportFilename + // this.GetType(), + // this.ShareDBLogonInfo ); + return key; + } + } +} diff --git a/WebLab/Informes/HojasdeTrabajo/HTrabajoProtocolo2Horizontal.rpt b/WebLab/Informes/HojasdeTrabajo/HTrabajoProtocolo2Horizontal.rpt index 61d55423..5beb3223 100644 Binary files a/WebLab/Informes/HojasdeTrabajo/HTrabajoProtocolo2Horizontal.rpt and b/WebLab/Informes/HojasdeTrabajo/HTrabajoProtocolo2Horizontal.rpt differ diff --git a/WebLab/Informes/Informe.aspx b/WebLab/Informes/Informe.aspx index 9cf9458a..a6c55f61 100644 --- a/WebLab/Informes/Informe.aspx +++ b/WebLab/Informes/Informe.aspx @@ -271,7 +271,7 @@ - + + + + + +
+ +
Tipo de Servicio: 0) + { + args.IsValid = false; + this.customValidadorGeneral.ErrorMessage = "Existe superposición de fechas con otra agenda"; + } + } + } } } diff --git a/WebLab/Agendas/AgendaEdit.aspx.designer.cs b/WebLab/Agendas/AgendaEdit.aspx.designer.cs index 3d5027ef..18fd6d2c 100644 --- a/WebLab/Agendas/AgendaEdit.aspx.designer.cs +++ b/WebLab/Agendas/AgendaEdit.aspx.designer.cs @@ -7,11 +7,22 @@ // //------------------------------------------------------------------------------ -namespace WebLab.Agendas { - - - public partial class AgendaEdit { - +namespace WebLab.Agendas +{ + + + public partial class AgendaEdit + { + + /// + /// customValidadorGeneral control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CustomValidator customValidadorGeneral; + /// /// rvTipoServicio control. /// @@ -20,7 +31,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RangeValidator rvTipoServicio; - + /// /// cboTipoServicio control. /// @@ -29,7 +40,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList cboTipoServicio; - + /// /// ddlItem control. /// @@ -38,7 +49,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlItem; - + /// /// rvEfector control. /// @@ -47,7 +58,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RangeValidator rvEfector; - + /// /// ddlEfector control. /// @@ -56,7 +67,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlEfector; - + /// /// rfvFechaDesde control. /// @@ -65,7 +76,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvFechaDesde; - + /// /// txtFechaDesde control. /// @@ -74,7 +85,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtFechaDesde; - + /// /// rfvFechaHasta control. /// @@ -83,7 +94,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvFechaHasta; - + /// /// txtFechaHasta control. /// @@ -92,7 +103,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtFechaHasta; - + /// /// rfvLimite control. /// @@ -101,7 +112,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvLimite; - + /// /// txtLimite control. /// @@ -110,7 +121,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtLimite; - + /// /// cvDias control. /// @@ -119,7 +130,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CustomValidator cvDias; - + /// /// rdbTipoDias control. /// @@ -128,7 +139,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RadioButtonList rdbTipoDias; - + /// /// cklDias control. /// @@ -137,7 +148,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.CheckBoxList cklDias; - + /// /// rfvHoraDesde control. /// @@ -146,7 +157,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvHoraDesde; - + /// /// txtHoraDesde control. /// @@ -155,7 +166,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtHoraDesde; - + /// /// rfvHoraHasta control. /// @@ -164,7 +175,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvHoraHasta; - + /// /// txtHoraHasta control. /// @@ -173,7 +184,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtHoraHasta; - + /// /// rdbHorarioTurno control. /// @@ -182,7 +193,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RadioButtonList rdbHorarioTurno; - + /// /// rfvFrecuencia control. /// @@ -191,7 +202,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RequiredFieldValidator rfvFrecuencia; - + /// /// txtFrecuenciaTurno control. /// @@ -200,7 +211,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtFrecuenciaTurno; - + /// /// vs control. /// @@ -209,7 +220,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ValidationSummary vs; - + /// /// lnkRegresar control. /// @@ -218,7 +229,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lnkRegresar; - + /// /// btnGuardar control. /// @@ -227,7 +238,7 @@ public partial class AgendaEdit { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnGuardar; - + /// /// CompareValidator1 control. /// diff --git a/WebLab/AutoAnalizador/ProtocoloBusqueda2.aspx.cs b/WebLab/AutoAnalizador/ProtocoloBusqueda2.aspx.cs index fee3def6..c1447f6f 100644 --- a/WebLab/AutoAnalizador/ProtocoloBusqueda2.aspx.cs +++ b/WebLab/AutoAnalizador/ProtocoloBusqueda2.aspx.cs @@ -156,7 +156,8 @@ private void CargarListas() ///Carga de Sectores - string m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio WHERE (baja = 0) order by nombre"; + string m_ssql = @"SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio S with (nolock) WHERE (baja = 0) + and exists(select 1 from Lab_SectorServicioEfector SE with (nolock) where SE.idSectorServicio = S.idSectorServicio and se.idefector = " + oUser.IdEfector.IdEfector.ToString()+@") order by nombre"; oUtil.CargarListBox(lstSector, m_ssql, "idSectorServicio", "nombre"); for (int i = 0; i < lstSector.Items.Count; i++) { @@ -281,33 +282,7 @@ protected void btnBuscar_Click(object sender, EventArgs e) if (txtProtocoloDesde.Value != "") m_parametro += " And P.numero>=" + int.Parse(txtProtocoloDesde.Value); if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numero<=" + int.Parse(txtProtocoloHasta.Value); - /* switch (oC.TipoNumeracionProtocolo)// busqueda con autonumerico - { - case 0: - { - if (txtProtocoloDesde.Value != "") m_parametro += " And P.numero>=" + int.Parse(txtProtocoloDesde.Value); - if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numero<=" + int.Parse(txtProtocoloHasta.Value); - } - break; - case 1: - { - if (txtProtocoloDesde.Value != "") m_parametro += " And P.numeroDiario>=" + int.Parse(txtProtocoloDesde.Value); - if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numeroDiario<=" + int.Parse(txtProtocoloHasta.Value); - } - break; - case 2: - { - if (txtProtocoloDesde.Value != "") m_parametro += " And P.numeroSector>=" + int.Parse(txtProtocoloDesde.Value); - if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numeroSector<=" + int.Parse(txtProtocoloHasta.Value); - } - break; - case 3: - { - if (txtProtocoloDesde.Value != "") m_parametro += " And P.numeroTipoServicio>=" + int.Parse(txtProtocoloDesde.Value); - if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numeroTipoServicio<=" + int.Parse(txtProtocoloHasta.Value); - } - break; - }*/ + if (ddlEfector.SelectedValue != "0") m_parametro += " AND P.idEfectorSolicitante=" + ddlEfector.SelectedValue; diff --git a/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx b/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx new file mode 100644 index 00000000..0221967d --- /dev/null +++ b/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx @@ -0,0 +1,144 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConfiguracionEdit.aspx.cs" Inherits="WebLab.AutoAnalizador.REAL.ConfiguracionEdit" MasterPageFile="~/Site1.Master" %> +<%@ Register assembly="Anthem" namespace="Anthem" tagprefix="anthem" %> + + + + + + + + + +
+
+
+

Configuración SIL - REAL

+
+ +
+ + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + +
+ Area: + + +
+ Análisis del LIS: + + + + + + +
+ ID en Equipo: + + + +
+   + +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+
+ + + +
diff --git a/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx.cs b/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx.cs new file mode 100644 index 00000000..f8bf8818 --- /dev/null +++ b/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Xml.Linq; +using System.Data.SqlClient; +using Business; +using Business.Data.AutoAnalizador; +using NHibernate; +using NHibernate.Expression; +using System.Text; +using System.IO; +using Business.Data; + +namespace WebLab.AutoAnalizador.REAL +{ + public partial class ConfiguracionEdit : System.Web.UI.Page + { + Usuario oUser = new Usuario(); + + protected void Page_PreInit(object sender, EventArgs e) + { + if (Session["idUsuario"] != null) + oUser = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString())); + // oC = (Configuracion)oC.Get(typeof(Configuracion), "IdConfiguracion", 1, "IdEfector", oEfector); + else + Response.Redirect("../FinSesion.aspx", false); + + } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + VerificaPermisos("Config. REAL"); + CargarCombos(); + CargarGrilla(); + } + } + private void VerificaPermisos(string sObjeto) + { + if (Session["s_permiso"] != null) + { + Utility oUtil = new Utility(); + int i_permiso = oUtil.VerificaPermisos((ArrayList)Session["s_permiso"], sObjeto); + switch (i_permiso) + { + case 0: Response.Redirect("../AccesoDenegado.aspx", false); break; + //case 1: btn .Visible = false; break; + } + } + else Response.Redirect("../FinSesion.aspx", false); + } + private void CargarGrilla() + { + gvLista.DataSource = LeerDatos(); + gvLista.DataBind(); + } + + private DataTable LeerDatos() + { + string m_strSQL = @" SELECT M.idrealitem, I.codigo, I.nombre, M.idreal, M.habilitado as Habilitado + FROM lab_realitem AS M + INNER JOIN LAB_Item AS I ON M.idItem = I.idItem Order by I.nombre "; + + DataSet Ds = new DataSet(); + SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + adapter.Fill(Ds); + + // CantidadRegistros.Text = Ds.Tables[0].Rows.Count.ToString() + " registros encontrados"; + + return Ds.Tables[0]; + } + private DataTable LeerDatosExcel() + { + string m_strSQL = @" SELECT I.codigo as [Codigo SIL], I.nombre as [Descripcion], M.idreal as [Codigo Real], M.habilitado as Habilitado + FROM lab_realitem AS M + INNER JOIN LAB_Item AS I ON M.idItem = I.idItem Order by I.nombre "; + + DataSet Ds = new DataSet(); + SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + adapter.Fill(Ds); + + // CantidadRegistros.Text = Ds.Tables[0].Rows.Count.ToString() + " registros encontrados"; + + return Ds.Tables[0]; + } + + private void CargarCombos() + { + + Utility oUtil = new Utility(); + string connReady = ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString; ///Performance: conexion de solo lectura + + string m_ssql = "select idArea, nombre from Lab_Area where baja=0 and idtiposervicio=3 order by nombre"; + oUtil.CargarCombo(ddlArea, m_ssql, "idArea", "nombre", connReady); + + + + CargarItem(); + //ddlArea.Items.Insert(0, new ListItem("Seleccione Area", "0")); + + + m_ssql = null; + oUtil = null; + } + + + + + + + private void GuardarDetalleConfiguracion() + { + RealItem oDetalle = new RealItem(); + oDetalle.IdReal = txtIDEquipo.Text; + oDetalle.IdItem = int.Parse(ddlItem.SelectedValue); + oDetalle.Habilitado = true; + oDetalle.Save(); + + + + } + + + protected void btnGuardar_Click2(object sender, EventArgs e) + { + if (Page.IsValid) + { + string validacion = existe(); + if (validacion == "") + { + lblMensajeValidacion.Text = ""; + GuardarDetalleConfiguracion(); + CargarGrilla(); + } + else + lblMensajeValidacion.Text = validacion; + } + } + + private string existe() + { + ////////////////////////////////////////////////////////////////////////////////////////// + ///Verifica de que no exista un item para la combincacion orden y tipo de muestra + ////////////////////////////////////////////////////////////////////////////////////////// + string hay = ""; + + RealItem oItem = new RealItem(); + oItem = (RealItem)oItem.Get(typeof(RealItem), "IdItem", int.Parse(ddlItem.SelectedValue)); + if (oItem == null) + { + + ISession m_session = NHibernateHttpModule.CurrentSession; + ICriteria crit = m_session.CreateCriteria(typeof(RealItem)); + crit.Add(Expression.Eq("IdReal", txtIDEquipo.Text)); + IList detalle = crit.List(); + if (detalle.Count > 0) + hay = "Ya existe una vinculación para el ID de muestra seleccionado. Verifique."; + } + else + hay = "Ya existe una configuración para el análisis seleccionado"; + + return hay; + } + + protected void gvLista_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + + ImageButton CmdEliminar = (ImageButton)e.Row.Cells[4].Controls[1]; + CmdEliminar.CommandArgument = this.gvLista.DataKeys[e.Row.RowIndex].Value.ToString(); + CmdEliminar.CommandName = "Eliminar"; + CmdEliminar.ToolTip = "Eliminar"; + + + CheckBox chkStatus = (CheckBox)e.Row.Cells[3].Controls[1]; + if (oUser.IdEfector.IdEfector == 227) + { + CmdEliminar.Visible = true; + chkStatus.Visible = true; + + } + else + { + CmdEliminar.Visible = false; + chkStatus.Enabled = false; + } + + + } + } + + protected void gvLista_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "Eliminar") + { + RealItem oRegistro = new RealItem(); + oRegistro = (RealItem)oRegistro.Get(typeof(RealItem), int.Parse(e.CommandArgument.ToString())); + oRegistro.Delete(); + + CargarGrilla(); + + } + + } + protected void chkStatus_OnCheckedChanged(object sender, EventArgs e) + { + CheckBox chkStatus = (CheckBox)sender; + GridViewRow row = (GridViewRow)chkStatus.NamingContainer; + + int i_id = int.Parse(gvLista.DataKeys[row.RowIndex].Value.ToString()); + + RealItem oRegistro = new RealItem(); + oRegistro = (RealItem)oRegistro.Get(typeof(RealItem), i_id); + oRegistro.Habilitado = chkStatus.Checked; + oRegistro.Save(); + + + } + protected void lnkRegresar_Click(object sender, EventArgs e) + { + // Response.Redirect("../PrincipalSysmex.aspx", false); + } + + protected void ddlArea_SelectedIndexChanged(object sender, EventArgs e) + { + CargarItem(); + } + + private void CargarItem() + { + + + + + Utility oUtil = new Utility(); + string connReady = ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString; ///Performance: conexion de solo lectura + + ///Carga de combos de Item sin el item que se está configurando y solo las determinaciones simples + string m_ssql = @"select idItem, nombre + ' - ' + codigo as nombre from Lab_Item I + where baja=0 AND idArea=" + ddlArea.SelectedValue + + " order by nombre"; + + oUtil.CargarCombo(ddlItem, m_ssql, "idItem", "nombre", connReady); + ddlItem.Items.Insert(0, new ListItem("Seleccione Item", "0")); + ddlItem.UpdateAfterCallBack = true; + } + + protected void btnExcel_Click(object sender, EventArgs e) + { + if (Page.IsValid) + dataTableAExcel(LeerDatosExcel(), "REAL_SIL"); + } + + + private void dataTableAExcel(DataTable tabla, string nombreArchivo) + { + if (tabla.Rows.Count > 0) + { + StringBuilder sb = new StringBuilder(); + StringWriter sw = new StringWriter(sb); + HtmlTextWriter htw = new HtmlTextWriter(sw); + Page pagina = new Page(); + HtmlForm form = new HtmlForm(); + GridView dg = new GridView(); + dg.EnableViewState = false; + dg.DataSource = tabla; + dg.DataBind(); + pagina.EnableEventValidation = false; + pagina.DesignerInitialize(); + pagina.Controls.Add(form); + form.Controls.Add(dg); + pagina.RenderControl(htw); + Response.Clear(); + Response.Buffer = true; + Response.ContentType = "application/vnd.ms-excel"; + Response.AddHeader("Content-Disposition", "attachment;filename=" + nombreArchivo + ".xls"); + Response.Charset = "UTF-8"; + Response.ContentEncoding = Encoding.Default; + Response.Write(sb.ToString()); + Response.End(); + } + } + } +} diff --git a/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx.designer.cs b/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx.designer.cs new file mode 100644 index 00000000..ce56935f --- /dev/null +++ b/WebLab/AutoAnalizador/REAL/ConfiguracionEdit.aspx.designer.cs @@ -0,0 +1,96 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebLab.AutoAnalizador.REAL { + + + public partial class ConfiguracionEdit { + + /// + /// ddlArea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Anthem.DropDownList ddlArea; + + /// + /// ddlItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Anthem.DropDownList ddlItem; + + /// + /// RangeValidator1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator RangeValidator1; + + /// + /// txtIDEquipo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtIDEquipo; + + /// + /// RequiredFieldValidator1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + + /// + /// btnGuardar control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnGuardar; + + /// + /// lblMensajeValidacion control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMensajeValidacion; + + /// + /// btnExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnExcel; + + /// + /// gvLista control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvLista; + } +} diff --git a/WebLab/ControlResultados/ControlPlanilla.aspx.cs b/WebLab/ControlResultados/ControlPlanilla.aspx.cs index 6e86645f..52f6059c 100644 --- a/WebLab/ControlResultados/ControlPlanilla.aspx.cs +++ b/WebLab/ControlResultados/ControlPlanilla.aspx.cs @@ -83,7 +83,8 @@ private void CargarListas() oUtil.CargarCombo(ddlServicio, m_ssql, "idTipoServicio", "nombre"); ///Carga de Sectores - m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio with (nolock) WHERE (baja = 0) order by nombre"; + m_ssql = @"SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio S with (nolock) WHERE (baja = 0) + and exists (select 1 from Lab_SectorServicioEfector SE where SE.idSectorServicio = S.idSectorServicio and se.idefector = " + oUser.IdEfector.IdEfector.ToString() + @") order by nombre"; oUtil.CargarListBox(lstSector, m_ssql, "idSectorServicio", "nombre"); for (int i = 0; i < lstSector.Items.Count; i++) @@ -187,46 +188,20 @@ protected void btnBuscar_Click(object sender, EventArgs e) string m_parametro = " P.idTipoServicio=" + ddlServicio.SelectedValue; m_parametro += " AND P.Fecha>='" + fecha1.ToString("yyyyMMdd") + "' AND P.fecha<='" + fecha2.ToString("yyyyMMdd") + "'"; m_parametro += " and P.idEfector =" + oUser.IdEfector.IdEfector.ToString(); - //if (ddlArea.SelectedValue != "0") m_parametro += " AND i.idArea=" + ddlArea.SelectedValue; - - - Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1); - switch (oCon.TipoNumeracionProtocolo)// busqueda con autonumerico - { - case 0: - { + if (txtProtocoloDesde.Value != "") m_parametro += " And P.numero>=" + int.Parse(txtProtocoloDesde.Value); if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numero<=" + int.Parse(txtProtocoloHasta.Value); - } break; - case 1: - { - if (txtProtocoloDesde.Value != "") m_parametro += " And P.numeroDiario>=" + int.Parse(txtProtocoloDesde.Value); - if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numeroDiario<=" + int.Parse(txtProtocoloHasta.Value); - } break; - case 2: - { - if (txtProtocoloDesde.Value != "") m_parametro += " And P.numeroSector>=" + int.Parse(txtProtocoloDesde.Value); - if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numeroSector<=" + int.Parse(txtProtocoloHasta.Value); - } break; - - case 3: - { - if (txtProtocoloDesde.Value != "") m_parametro += " And P.numeroTipoServicio>=" + int.Parse(txtProtocoloDesde.Value); - if (txtProtocoloHasta.Value != "") m_parametro += " AND P.numeroTipoServicio<=" + int.Parse(txtProtocoloHasta.Value); - } break; - } + if (ddlEfector.SelectedValue != "0") m_parametro += " AND P.idEfectorSolicitante=" + ddlEfector.SelectedValue; if (ddlOrigen.SelectedValue != "0") m_parametro += " AND P.idOrigen=" + ddlOrigen.SelectedValue; if (ddlPrioridad.SelectedValue != "0") m_parametro += " AND P.idPrioridad=" + ddlPrioridad.SelectedValue; - // if (ddlSectorServicio.SelectedValue != "0") m_parametro += " AND P.idSector = " + ddlSectorServicio.SelectedValue; - + m_parametro += " AND P.idSector in (" + getListaSectores() + ")"; string m_orden = " order by P.numero "; - //string operacion = "Carga"; - // string modoCarga = "HT"; + if (chkRecordarFiltro.Checked) AlmacenarSesion(); diff --git a/WebLab/ControlResultados/ProtocoloList.aspx.cs b/WebLab/ControlResultados/ProtocoloList.aspx.cs index 8f067068..b839ef24 100644 --- a/WebLab/ControlResultados/ProtocoloList.aspx.cs +++ b/WebLab/ControlResultados/ProtocoloList.aspx.cs @@ -72,20 +72,47 @@ private object LeerDatos() /* Filtra los protocolos con analisis con formulas a calcular sin resultados*/ + //string m_strSQL = @" SELECT P.idProtocolo, P.numero as numero, cONVERT(varchar(10),P.fecha,103) as fecha, + // CASE + // WHEN Pa.idestado = 2 THEN CAST(Pa.numeroAdic AS varchar(20)) + // ELSE CAST(Pa.numeroDocumento AS varchar(20)) + // END AS dni, + // Pa.apellido+ ' ' + Pa.nombre as paciente, + // O.nombre as origen, Pri.nombre as prioridad, SS.nombre as sector,P.estado, P.impreso + // FROM Lab_Protocolo P with (nolock) + // INNER JOIN Lab_Origen O with (nolock) on O.idOrigen= P.idOrigen + // INNER JOIN Lab_Prioridad Pri with (nolock) on Pri.idPrioridad= P.idPrioridad + // INNER JOIN Sys_Paciente Pa with (nolock) on Pa.idPaciente= P.idPaciente + // INNER JOIN LAB_SectorServicio SS with (nolock) ON P.idSector= SS.idSectorServicio + // INNER JOIN LAB_DetalleProtocolo AS DP with (nolock) ON P.idProtocolo = DP.idProtocolo + // INNER JOIN LAB_Item AS I with (nolock) ON DP.idSubItem = I.idItem + // INNER JOIN LAB_Formula AS F with (nolock) ON I.idItem = F.idItem + // WHERE (F.idTipoFormula = 1) AND (P.estado =1) AND (DP.conResultado = 0) AND " + Request["Parametros"].ToString(); // +str_orden; + + /*Se reformula sql con mejor preformance para no mostrar protocolos duplicados */ string m_strSQL = @" SELECT P.idProtocolo, P.numero as numero, cONVERT(varchar(10),P.fecha,103) as fecha, - case when Pa.idestado=2 then Pa.numeroAdic else Pa.numeroDocumento end as dni,Pa.apellido+ ' ' + Pa.nombre as paciente, + CASE + WHEN Pa.idestado = 2 THEN CAST(Pa.numeroAdic AS varchar(20)) + ELSE CAST(Pa.numeroDocumento AS varchar(20)) + END AS dni, + LTRIM(RTRIM(ISNULL(Pa.apellido,'') + ' ' + ISNULL(Pa.nombre,''))) AS paciente, O.nombre as origen, Pri.nombre as prioridad, SS.nombre as sector,P.estado, P.impreso - FROM Lab_Protocolo P with (nolock) - INNER JOIN Lab_Origen O with (nolock) on O.idOrigen= P.idOrigen - INNER JOIN Lab_Prioridad Pri with (nolock) on Pri.idPrioridad= P.idPrioridad - INNER JOIN Sys_Paciente Pa with (nolock) on Pa.idPaciente= P.idPaciente - INNER JOIN LAB_SectorServicio SS with (nolock) ON P.idSector= SS.idSectorServicio - INNER JOIN LAB_DetalleProtocolo AS DP with (nolock) ON P.idProtocolo = DP.idProtocolo - INNER JOIN LAB_Item AS I with (nolock) ON DP.idSubItem = I.idItem - INNER JOIN LAB_Formula AS F with (nolock) ON I.idItem = F.idItem - WHERE (F.idTipoFormula = 1) AND (P.estado =1) AND (DP.conResultado = 0) AND " + Request["Parametros"].ToString(); // +str_orden; - - //" INNER JOIN Lab_Configuracion Con ON Con.idEfector= P.idEfector " + + FROM Lab_Protocolo P WITH (NOLOCK) + INNER JOIN Lab_Origen O WITH (NOLOCK) ON O.idOrigen = P.idOrigen + INNER JOIN Lab_Prioridad Pri WITH (NOLOCK) ON Pri.idPrioridad = P.idPrioridad + INNER JOIN Sys_Paciente Pa WITH (NOLOCK) ON Pa.idPaciente = P.idPaciente + INNER JOIN LAB_SectorServicio SS WITH (NOLOCK) ON P.idSector = SS.idSectorServicio + WHERE (P.estado =1) AND " + Request["Parametros"].ToString()+ + @" AND EXISTS ( SELECT 1 + FROM LAB_DetalleProtocolo DP WITH (NOLOCK) + + INNER JOIN LAB_Formula F WITH (NOLOCK) ON DP.idSubItem = F.idItem + WHERE DP.idProtocolo = P.idProtocolo and P.idEfector = DP.idEfector + AND DP.conResultado = 0 + AND F.idTipoFormula = 1 ) + order by P.numero " ; + + DataSet Ds = new DataSet(); // SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString); ///Performance: conexion de solo lectura diff --git a/WebLab/Derivaciones/Derivados2.aspx b/WebLab/Derivaciones/Derivados2.aspx index e34edf8d..a87d57b2 100644 --- a/WebLab/Derivaciones/Derivados2.aspx +++ b/WebLab/Derivaciones/Derivados2.aspx @@ -76,7 +76,7 @@
Fecha Desde:* -
- +

-

+

diff --git a/WebLab/Informes/Informe.aspx.cs b/WebLab/Informes/Informe.aspx.cs index 3feae528..de25e7f7 100644 --- a/WebLab/Informes/Informe.aspx.cs +++ b/WebLab/Informes/Informe.aspx.cs @@ -198,7 +198,9 @@ private void CargarListas() if (Request["Tipo"].ToString() == "HojaTrabajo") ddlPrioridad.SelectedValue = "1";//rutina ///Carga de Sectores - m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio (nolock) WHERE (baja = 0) order by nombre"; + m_ssql = @"SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio S with (nolock) WHERE (baja = 0) + and exists(select 1 from Lab_SectorServicioEfector SE where SE.idSectorServicio = S.idSectorServicio and se.idefector = "+oUser.IdEfector.IdEfector.ToString()+@") order by nombre"; + oUtil.CargarListBox(lstSector, m_ssql, "idSectorServicio", "nombre"); for (int i = 0; i < lstSector.Items.Count; i++) @@ -626,12 +628,7 @@ private void VistaPreeliminar(object p, string accion) } if (accion == "PDF") { - - oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, nombrePDF); - - //oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, nombrePDF+".pdf"); - - + oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, nombrePDF); } else { diff --git a/WebLab/Items/ItemEdit2.aspx b/WebLab/Items/ItemEdit2.aspx index 210d45b3..3a203408 100644 --- a/WebLab/Items/ItemEdit2.aspx +++ b/WebLab/Items/ItemEdit2.aspx @@ -829,9 +829,13 @@
Presentación por Defecto: -
 
diff --git a/WebLab/Items/ItemEdit2.aspx.cs b/WebLab/Items/ItemEdit2.aspx.cs index 41789b84..d58e0e85 100644 --- a/WebLab/Items/ItemEdit2.aspx.cs +++ b/WebLab/Items/ItemEdit2.aspx.cs @@ -209,6 +209,17 @@ private void MostrarDatosEfector(Efector oEfector) ddlPresentacionEfectorDefecto.SelectedValue = oItem.IdPresentacionDefecto.ToString(); + if(oItem.IdPresentacionDefecto == 0) + { + lblPresentacionDefecto.Text = "No se ha determinado una presentación por defecto"; + } + else + { + ItemPresentacion itemPres = new ItemPresentacion(); + itemPres = (ItemPresentacion) itemPres.Get(typeof(ItemPresentacion), oItem.IdPresentacionDefecto); + lblPresentacionDefecto.Text = "Presentacion: "+ itemPres.Codigo + '-' + itemPres.Presentacion + " se aplicará por defecto."; + } + MostrarDatosValoresReferencia(); } } @@ -1057,15 +1068,17 @@ protected void cvValores_ServerValidate(object source, ServerValidateEventArgs a else args.IsValid = true; } - + //Caro: se saca el ingreso de observaciones, puede ir sin valor- if (rdbRango.Items[3].Selected)///solo observaciones - { - cvValores.ErrorMessage = "Debe ingresar una observación"; - if (txtObservaciones.Text == "") - args.IsValid = false; - else - args.IsValid = true; - } + args.IsValid = true; + //if (rdbRango.Items[3].Selected)///solo observaciones + //{ + // cvValores.ErrorMessage = "Debe ingresar una observación"; + // if (txtObservaciones.Text == "") + // args.IsValid = false; + // else + // args.IsValid = true; + //} } @@ -3264,6 +3277,12 @@ private void GuardarPresentacionporDefecto(int pres) oItem.IdPresentacionDefecto = pres; oItem.Save(); + ItemPresentacion itemPres = new ItemPresentacion(); + itemPres = (ItemPresentacion)itemPres.Get(typeof(ItemPresentacion), oItem.IdPresentacionDefecto); + lblPresentacionDefecto.Text = "Presentacion: " + itemPres.Codigo + '-' + itemPres.Presentacion + " se aplicará por defecto."; + //Ademas actualizo el seleccionable "Presentacion por Defecto + ddlPresentacionEfectorDefecto.SelectedValue = pres.ToString(); + ddlPresentacionEfectorDefecto.UpdateAfterCallBack = true; } } diff --git a/WebLab/Items/ItemEdit2.aspx.designer.cs b/WebLab/Items/ItemEdit2.aspx.designer.cs index 56a2da8b..ea16a23d 100644 --- a/WebLab/Items/ItemEdit2.aspx.designer.cs +++ b/WebLab/Items/ItemEdit2.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace WebLab.Items { - - - public partial class ItemEdit2 { - +namespace WebLab.Items +{ + + + public partial class ItemEdit2 + { + /// /// HFCurrTabIndex control. /// @@ -20,7 +22,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField HFCurrTabIndex; - + /// /// txtEfector control. /// @@ -29,7 +31,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label txtEfector; - + /// /// rfvCodigo control. /// @@ -38,7 +40,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvCodigo; - + /// /// txtCodigo control. /// @@ -47,7 +49,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtCodigo; - + /// /// lblMensajeCodigo control. /// @@ -56,7 +58,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensajeCodigo; - + /// /// rfvNombre control. /// @@ -65,7 +67,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvNombre; - + /// /// txtNombre control. /// @@ -74,7 +76,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtNombre; - + /// /// rfvDescripcion control. /// @@ -83,7 +85,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvDescripcion; - + /// /// txtDescripcion control. /// @@ -92,7 +94,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtDescripcion; - + /// /// rvArea control. /// @@ -101,7 +103,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RangeValidator rvArea; - + /// /// ddlServicio control. /// @@ -110,7 +112,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlServicio; - + /// /// ddlArea control. /// @@ -119,7 +121,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlArea; - + /// /// ddlUnidadMedida control. /// @@ -128,7 +130,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlUnidadMedida; - + /// /// rdbRequiereMuestra control. /// @@ -137,7 +139,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RadioButtonList rdbRequiereMuestra; - + /// /// ddlDerivable control. /// @@ -146,7 +148,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlDerivable; - + /// /// ddlEfector control. /// @@ -155,7 +157,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlEfector; - + /// /// rvEfector control. /// @@ -164,7 +166,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RangeValidator rvEfector; - + /// /// txtCodigoReferencia control. /// @@ -173,7 +175,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtCodigoReferencia; - + /// /// ddlItemReferencia control. /// @@ -182,7 +184,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlItemReferencia; - + /// /// rfvDuracion control. /// @@ -191,7 +193,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvDuracion; - + /// /// txtDuracion control. /// @@ -200,7 +202,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtDuracion; - + /// /// rfvItem control. /// @@ -209,7 +211,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvItem; - + /// /// rdbTipo control. /// @@ -218,7 +220,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RadioButtonList rdbTipo; - + /// /// rfvCategoria control. /// @@ -227,7 +229,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RequiredFieldValidator rfvCategoria; - + /// /// rdbCategoria control. /// @@ -236,7 +238,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RadioButtonList rdbCategoria; - + /// /// ddlTipoMuestra control. /// @@ -245,7 +247,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlTipoMuestra; - + /// /// chkImprimeMuestra control. /// @@ -254,7 +256,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox chkImprimeMuestra; - + /// /// rvTipoResultado control. /// @@ -263,7 +265,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RangeValidator rvTipoResultado; - + /// /// ddlTipoResultado control. /// @@ -272,7 +274,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlTipoResultado; - + /// /// ddlDecimales control. /// @@ -281,7 +283,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlDecimales; - + /// /// ddlMultiplicador control. /// @@ -290,7 +292,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlMultiplicador; - + /// /// txtValorMinimo control. /// @@ -299,7 +301,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtValorMinimo; - + /// /// revValorMinimo control. /// @@ -308,7 +310,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RegularExpressionValidator revValorMinimo; - + /// /// txtValorMaximo control. /// @@ -317,7 +319,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtValorMaximo; - + /// /// revValorMaximo control. /// @@ -326,7 +328,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RegularExpressionValidator revValorMaximo; - + /// /// txtValorDefecto control. /// @@ -335,7 +337,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtValorDefecto; - + /// /// revValorDefecto control. /// @@ -344,7 +346,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RegularExpressionValidator revValorDefecto; - + /// /// ddlDisponible control. /// @@ -353,7 +355,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlDisponible; - + /// /// lblSininsumo control. /// @@ -362,7 +364,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblSininsumo; - + /// /// ddlInformable control. /// @@ -371,7 +373,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlInformable; - + /// /// ddlCaracter control. /// @@ -380,7 +382,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlCaracter; - + /// /// txtCodigoNomenclador control. /// @@ -389,7 +391,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtCodigoNomenclador; - + /// /// lblMensaje control. /// @@ -398,7 +400,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensaje; - + /// /// ddlItemNomenclador control. /// @@ -407,7 +409,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlItemNomenclador; - + /// /// lblValorNomenclador control. /// @@ -416,7 +418,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblValorNomenclador; - + /// /// btnAuditoria control. /// @@ -425,7 +427,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnAuditoria; - + /// /// btnGuardar control. /// @@ -434,7 +436,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnGuardar; - + /// /// ddlMarca control. /// @@ -443,7 +445,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlMarca; - + /// /// rvMarca control. /// @@ -452,7 +454,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RangeValidator rvMarca; - + /// /// txtCodigoPresentacion control. /// @@ -461,7 +463,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtCodigoPresentacion; - + /// /// rfvCodigoPresentacion control. /// @@ -470,7 +472,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvCodigoPresentacion; - + /// /// txtPresentacion control. /// @@ -479,7 +481,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtPresentacion; - + /// /// rfvPresentacion control. /// @@ -488,7 +490,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvPresentacion; - + /// /// btnAgregarPresentacion control. /// @@ -497,7 +499,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnAgregarPresentacion; - + /// /// lblMensagePresentacion control. /// @@ -506,7 +508,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensagePresentacion; - + /// /// gdPresentacion control. /// @@ -515,7 +517,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.GridView gdPresentacion; - + /// /// gvAutoAnalizadores control. /// @@ -524,7 +526,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.GridView gvAutoAnalizadores; - + /// /// lblMensajeMuestra1 control. /// @@ -533,7 +535,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblMensajeMuestra1; - + /// /// ddlMuestra1 control. /// @@ -542,7 +544,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlMuestra1; - + /// /// RangeValidator1 control. /// @@ -551,7 +553,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RangeValidator RangeValidator1; - + /// /// btnAgregarMuestra control. /// @@ -560,7 +562,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnAgregarMuestra; - + /// /// lblMensajeMuestra control. /// @@ -569,7 +571,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensajeMuestra; - + /// /// gvMuestraItem control. /// @@ -578,7 +580,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.GridView gvMuestraItem; - + /// /// pnlVR control. /// @@ -587,7 +589,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Panel pnlVR; - + /// /// pnlNuevoVR control. /// @@ -596,7 +598,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Panel pnlNuevoVR; - + /// /// lblItemVR control. /// @@ -605,7 +607,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemVR; - + /// /// ddlTipoServicio control. /// @@ -614,7 +616,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlTipoServicio; - + /// /// ddlSexo control. /// @@ -623,7 +625,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlSexo; - + /// /// rfvEdadDesde control. /// @@ -632,7 +634,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RequiredFieldValidator rfvEdadDesde; - + /// /// txtEdadDesde control. /// @@ -641,7 +643,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtEdadDesde; - + /// /// rfvEdadHasta control. /// @@ -650,7 +652,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RequiredFieldValidator rfvEdadHasta; - + /// /// txtEdadHasta control. /// @@ -659,7 +661,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtEdadHasta; - + /// /// ddlUnidadEdad control. /// @@ -668,7 +670,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlUnidadEdad; - + /// /// ddlMetodo control. /// @@ -677,7 +679,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlMetodo; - + /// /// lblDecimales control. /// @@ -686,7 +688,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblDecimales; - + /// /// rdbRango control. /// @@ -695,7 +697,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RadioButtonList rdbRango; - + /// /// txtValorMinimoVR control. /// @@ -704,7 +706,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtValorMinimoVR; - + /// /// RegularExpressionValidator1 control. /// @@ -713,7 +715,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RegularExpressionValidator RegularExpressionValidator1; - + /// /// txtValorMaximoVR control. /// @@ -722,7 +724,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtValorMaximoVR; - + /// /// RegularExpressionValidator2 control. /// @@ -731,7 +733,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RegularExpressionValidator RegularExpressionValidator2; - + /// /// txtObservaciones control. /// @@ -740,7 +742,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtObservaciones; - + /// /// cvObservaciones control. /// @@ -749,7 +751,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.CustomValidator cvObservaciones; - + /// /// cvValores control. /// @@ -758,7 +760,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.CustomValidator cvValores; - + /// /// ddlPresentacionItem control. /// @@ -767,7 +769,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlPresentacionItem; - + /// /// btGuardarVR control. /// @@ -776,7 +778,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btGuardarVR; - + /// /// PnlVREfector control. /// @@ -785,7 +787,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Panel PnlVREfector; - + /// /// ddlPresentacionEfector control. /// @@ -794,7 +796,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlPresentacionEfector; - + /// /// btnAgregarVREfector control. /// @@ -803,7 +805,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnAgregarVREfector; - + /// /// ddlPresentacionEfectorDefecto control. /// @@ -812,7 +814,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlPresentacionEfectorDefecto; - + /// /// btnPresentacionDefecto control. /// @@ -821,7 +823,16 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnPresentacionDefecto; - + + /// + /// lblPresentacionDefecto control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Anthem.Label lblPresentacionDefecto; + /// /// gvListaVR control. /// @@ -830,7 +841,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.GridView gvListaVR; - + /// /// lblMensaje3 control. /// @@ -839,7 +850,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensaje3; - + /// /// btnAplicarEfectores control. /// @@ -848,7 +859,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnAplicarEfectores; - + /// /// gvListaVRNP control. /// @@ -857,7 +868,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.GridView gvListaVRNP; - + /// /// lblMensaje2 control. /// @@ -866,7 +877,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensaje2; - + /// /// btnAplicarEfectoresNP control. /// @@ -875,7 +886,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnAplicarEfectoresNP; - + /// /// ValidationSummary2 control. /// @@ -884,7 +895,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.ValidationSummary ValidationSummary2; - + /// /// pnlDiagrama control. /// @@ -893,7 +904,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Panel pnlDiagrama; - + /// /// lblItemDiagrama control. /// @@ -902,7 +913,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemDiagrama; - + /// /// txtCodigoDiagrama control. /// @@ -911,7 +922,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtCodigoDiagrama; - + /// /// lblMensajeDiagrama control. /// @@ -920,7 +931,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensajeDiagrama; - + /// /// ddlItemDiagrama control. /// @@ -929,7 +940,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlItemDiagrama; - + /// /// rvItem control. /// @@ -938,7 +949,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RangeValidator rvItem; - + /// /// txtNombreDiagrama control. /// @@ -947,7 +958,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.TextBox txtNombreDiagrama; - + /// /// RequiredFieldValidator1 control. /// @@ -956,7 +967,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.RequiredFieldValidator RequiredFieldValidator1; - + /// /// TxtDatosDiagrama control. /// @@ -965,7 +976,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden TxtDatosDiagrama; - + /// /// btnGuardarDiagrama control. /// @@ -974,7 +985,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnGuardarDiagrama; - + /// /// pnlPredefinidos control. /// @@ -983,7 +994,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Panel pnlPredefinidos; - + /// /// lblItemRP control. /// @@ -992,7 +1003,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemRP; - + /// /// txtNombreRP control. /// @@ -1001,7 +1012,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtNombreRP; - + /// /// ddlEfectorItemDeriva control. /// @@ -1010,7 +1021,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlEfectorItemDeriva; - + /// /// btnGuardarRP control. /// @@ -1019,7 +1030,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnGuardarRP; - + /// /// lblMensajeRpD control. /// @@ -1028,7 +1039,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Label lblMensajeRpD; - + /// /// TxtDatosResultados control. /// @@ -1037,7 +1048,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden TxtDatosResultados; - + /// /// ddlResultadoPorDefecto control. /// @@ -1046,7 +1057,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.DropDownList ddlResultadoPorDefecto; - + /// /// btnGuardarRPDefecto control. /// @@ -1055,7 +1066,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnGuardarRPDefecto; - + /// /// pnlRecomendacion control. /// @@ -1064,7 +1075,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Panel pnlRecomendacion; - + /// /// lblItemRecomendacion control. /// @@ -1073,7 +1084,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemRecomendacion; - + /// /// ddlRecomendacion control. /// @@ -1082,7 +1093,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlRecomendacion; - + /// /// rvRecomendacion control. /// @@ -1091,7 +1102,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RangeValidator rvRecomendacion; - + /// /// btnAgregarRecomendacion control. /// @@ -1100,7 +1111,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.Button btnAgregarRecomendacion; - + /// /// gvListaRecomendacion control. /// @@ -1109,7 +1120,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::Anthem.GridView gvListaRecomendacion; - + /// /// lblItemHiv control. /// @@ -1118,7 +1129,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemHiv; - + /// /// chkCodificaHiv control. /// @@ -1127,7 +1138,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox chkCodificaHiv; - + /// /// chkEtiquetaAdicional control. /// @@ -1136,7 +1147,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox chkEtiquetaAdicional; - + /// /// btnGuardarHIV control. /// @@ -1145,7 +1156,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnGuardarHIV; - + /// /// txtLimite control. /// @@ -1154,7 +1165,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText txtLimite; - + /// /// rfvLimite control. /// @@ -1163,7 +1174,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvLimite; - + /// /// lnkRegresar control. /// @@ -1172,7 +1183,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lnkRegresar; - + /// /// btnNuevo control. /// @@ -1181,7 +1192,7 @@ public partial class ItemEdit2 { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnNuevo; - + /// /// ValidationSummary1 control. /// diff --git a/WebLab/Items/ItemInsumo.aspx b/WebLab/Items/ItemInsumo.aspx index 4e625433..b73055b7 100644 --- a/WebLab/Items/ItemInsumo.aspx +++ b/WebLab/Items/ItemInsumo.aspx @@ -2,16 +2,47 @@ <%@ Register assembly="Anthem" namespace="Anthem" tagprefix="anthem" %> + - - - <%----%> - + + + + + + + + + + + - - - @@ -19,7 +50,6 @@ -
@@ -35,7 +65,7 @@ - Efector:  + Efector:  @@ -44,7 +74,7 @@ - Servicio: + Servicio: - + Area: @@ -66,7 +96,7 @@ - + Estado: @@ -80,6 +110,31 @@ + + + Fecha Desde: + + + <%-- Fecha Hasta: + --%> + + + + + + + + + + @@ -137,7 +192,7 @@
+ Text="Guardar" ValidationGroup="0" />
diff --git a/WebLab/Items/ItemInsumo.aspx.cs b/WebLab/Items/ItemInsumo.aspx.cs index 897102f5..304a1ecf 100644 --- a/WebLab/Items/ItemInsumo.aspx.cs +++ b/WebLab/Items/ItemInsumo.aspx.cs @@ -50,6 +50,67 @@ protected void Page_Load(object sender, EventArgs e) } + protected void cvValidacionInput_ServerValidate(object source, ServerValidateEventArgs args) + { + + + + + if (txtFechaDesde.Value != "") + + { + if (DateTime.Parse(txtFechaDesde.Value) > DateTime.Now) + { + //TxtDatos.Value = ""; + args.IsValid = false; + this.cvValidacionInput.ErrorMessage = "La Fecha Desde no puede ser superior a la fecha actual"; + return; + } + else + { + //if (DateTime.Parse(txtFechaHasta.Value) < DateTime.Parse(txtFechaDesde.Value)) + //{ + // //TxtDatos.Value = ""; + // args.IsValid = false; + // this.cvValidacionInput.ErrorMessage = "La Fecha desde no puede ser mayor a fecha hasta"; + // return; + //} + //else + args.IsValid = true; + } + } + else args.IsValid = false; + + + + //if (txtFechaHasta.Value != "") + + //{ + // if (DateTime.Parse(txtFechaHasta.Value) > DateTime.Now) + // { + // //TxtDatos.Value = ""; + // args.IsValid = false; + // this.cvValidacionInput.ErrorMessage = "La Fecha Hasta no puede ser superior a la fecha actual"; + // return; + // } + // else + // { + // if (DateTime.Parse(txtFechaHasta.Value) < DateTime.Parse(txtFechaDesde.Value)) + // { + // //TxtDatos.Value = ""; + // args.IsValid = false; + // this.cvValidacionInput.ErrorMessage = "La Fecha desde no puede ser mayor a fecha hasta"; + // return; + // } + // else + // args.IsValid = true; + + // } + //} + //else + // args.IsValid = false; + + } private void CargarListas() { @@ -234,66 +295,106 @@ protected void btnGuardar_Click(object sender, EventArgs e) private void Guardar() { - foreach (GridViewRow row in gvLista.Rows) + if (Page.IsValid) { - CheckBox a = ((CheckBox)(row.Cells[0].FindControl("CheckBox1"))); - if (a.Checked == true) + foreach (GridViewRow row in gvLista.Rows) { - - ItemEfector oItem = new ItemEfector(); - oItem = (ItemEfector)oItem.Get(typeof(ItemEfector), int.Parse(gvLista.DataKeys[row.RowIndex].Value.ToString())); + CheckBox a = ((CheckBox)(row.Cells[0].FindControl("CheckBox1"))); + if (a.Checked == true) + { + ItemEfector oItem = new ItemEfector(); + oItem = (ItemEfector)oItem.Get(typeof(ItemEfector), int.Parse(gvLista.DataKeys[row.RowIndex].Value.ToString())); - if (oItem != null) - { - ISession m_session = NHibernateHttpModule.CurrentSession; - ICriteria crit = m_session.CreateCriteria(typeof(ItemEfector)); - crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); - crit.Add(Expression.Eq("IdItem", oItem.IdItem)); - IList items = crit.List(); - foreach (ItemEfector oResultado in items) + if (oItem != null) { - if (oResultado.SinInsumo) + if (oItem.SinInsumo) { - oResultado.SinInsumo = false; - oResultado.IdUsuarioRegistro = oUser; - oResultado.FechaRegistro = DateTime.Now; - oResultado.Save(); - + oItem.SinInsumo = false; + oItem.IdUsuarioRegistro = oUser; + oItem.FechaRegistro = DateTime.Now; + oItem.Save(); + oItem.IdItem.GrabarAuditoriaDetalleItem("Cambia estado", oUser, "Disponible", oUser.IdEfector.Nombre, ""); + + ActualizarProtocolos(oItem.IdItem, "0", oUser); } else { - oResultado.SinInsumo = true; - oResultado.IdUsuarioRegistro = oUser; - oResultado.FechaRegistro = DateTime.Now; - oResultado.Save(); + oItem.SinInsumo = true; + oItem.IdUsuarioRegistro = oUser; + oItem.FechaRegistro = DateTime.Now; + oItem.Save(); oItem.IdItem.GrabarAuditoriaDetalleItem("Cambia estado", oUser, "Sin Insumo", oUser.IdEfector.Nombre, ""); - ActualizarProtocolos(oItem.IdItem); + ActualizarProtocolos(oItem.IdItem, "1", oUser); } + //ISession m_session = NHibernateHttpModule.CurrentSession; + //ICriteria crit = m_session.CreateCriteria(typeof(ItemEfector)); + //crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); + //crit.Add(Expression.Eq("IdItem", oItem.IdItem)); + //IList items = crit.List(); + //foreach (ItemEfector oResultado in items) + //{ + // if (oResultado.SinInsumo) + // { + // oResultado.SinInsumo = false; + // oResultado.IdUsuarioRegistro = oUser; + // oResultado.FechaRegistro = DateTime.Now; + // oResultado.Save(); + + // oItem.IdItem.GrabarAuditoriaDetalleItem("Cambia estado", oUser, "Disponible", oUser.IdEfector.Nombre, ""); + + // ActualizarProtocolos(oItem.IdItem, "0", oUser); + // } + // else + // { + // oResultado.SinInsumo = true; + // oResultado.IdUsuarioRegistro = oUser; + // oResultado.FechaRegistro = DateTime.Now; + // oResultado.Save(); + // oItem.IdItem.GrabarAuditoriaDetalleItem("Cambia estado", oUser, "Sin Insumo", oUser.IdEfector.Nombre, ""); + + // ActualizarProtocolos(oItem.IdItem, "1", oUser); + // } + + //} // foreach - } // foreach - - } - }// chececk - }// primero + } + }// chececk + }// primero + } } - private void ActualizarProtocolos(Item oItem) + private void ActualizarProtocolos(Item oItem, string s_tipo, Usuario oUser) { + string str_condicion = ""; string m_strSQL = @" select DP.iddetalleprotocolo from lab_detalleprotocolo DP (nolock) inner join LAb_Protocolo P (nolock) on DP.idprotocolo=p.idprotocolo - - where P.baja=0 and P.estado<2 - and P.IdEfector=" + oUser.IdEfector.IdEfector.ToString() + @" and P.fecha>getdate()-3 - and DP.idsubitem="+oItem.IdItem.ToString()+@" and DP.idusuariovalida=0 "; + and P.IdEfector=" + oUser.IdEfector.IdEfector.ToString() + @" + and DP.idsubitem=" + oItem.IdItem.ToString() ; + if (txtFechaDesde.Value != "") + { + DateTime fecha1 = DateTime.Parse(txtFechaDesde.Value); + str_condicion += " AND P.fecha>= '" + fecha1.ToString("yyyyMMdd") + "'"; + } + //if (txtFechaHasta.Value != "") + //{ + // DateTime fecha2 = DateTime.Parse(txtFechaHasta.Value); + // str_condicion += " AND P.fecha<= '" + fecha2.ToString("yyyyMMdd") + "'"; + //} + + if (s_tipo=="1") // poner marca sin insumo solo trae los anteriores a tres dias y sin validar + str_condicion += @" and DP.idusuariovalida=0 "; + //if (s_tipo == "0") // poner marca disponible es sacar la marca de validado lo de estaba a partir de hoy. + // str_condicion += @" and DP.idusuariovalida>0 "; + m_strSQL += str_condicion; DataSet Ds = new DataSet(); SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; @@ -309,29 +410,14 @@ and P.estado<2 detalle = (DetalleProtocolo)detalle.Get(typeof(DetalleProtocolo), int.Parse(Ds.Tables[0].Rows[i][0].ToString())); if (detalle != null) { - detalle.GuardarSinInsumo(); + if (s_tipo == "1") + detalle.GuardarSinInsumo(oUser); + if (s_tipo == "0") + detalle.GuardarDisponible(); ActualizaEstadoProtocolo(detalle.IdProtocolo); } } - - //string ssql_Protocolo = @" IdProtocolo in (Select LAb_Protocolo.IdProtocolo - // From LAb_Protocolo - // where LAb_Protocolo.baja=0 - // and LAb_Protocolo.estado<2 - // and lab_Protocolo.IdEfector=" + oUser.IdEfector.IdEfector.ToString() + " and Lab_Protocolo.fecha>getdate()-5 )"; - //critProtocolo.Add(Expression.Sql(ssql_Protocolo)); - //critProtocolo.Add(Expression.Eq("IdEfector", oUser.IdEfector)); - //critProtocolo.Add(Expression.Eq("IdSubItem", oItem)); - ////Protocolo oUltimoProtocolo = (Protocolo)critProtocolo.List; - - //IList detalle = critProtocolo.List(); - - //foreach (DetalleProtocolo oResultado in detalle) - //{ - // if (oResultado.IdUsuarioValida==0) - // oResultado.GuardarSinInsumo(); - - //} + } private void ActualizaEstadoProtocolo(Protocolo oRegistro) diff --git a/WebLab/Items/ItemInsumo.aspx.designer.cs b/WebLab/Items/ItemInsumo.aspx.designer.cs index f704b540..fbe0a199 100644 --- a/WebLab/Items/ItemInsumo.aspx.designer.cs +++ b/WebLab/Items/ItemInsumo.aspx.designer.cs @@ -48,6 +48,24 @@ public partial class ItemInsumo { /// protected global::Anthem.DropDownList ddlEstado; + /// + /// txtFechaDesde control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlInputText txtFechaDesde; + + /// + /// cvValidacionInput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CustomValidator cvValidacionInput; + /// /// estatus control. /// diff --git a/WebLab/ParametrosEdit.aspx b/WebLab/ParametrosEdit.aspx index 4090aecc..bc20c7c0 100644 --- a/WebLab/ParametrosEdit.aspx +++ b/WebLab/ParametrosEdit.aspx @@ -275,6 +275,19 @@ $("#tabContainer").tabs({ selected: currTab }); + + + Habilita Enfermedad Base : + + + + No + Si + Solo Microbiologia + + @@ -1672,6 +1685,26 @@ $("#tabContainer").tabs({ selected: currTab }); + + +
Mapeo SIL y SISA:
+ + + + Descargar Excel + + + + +
Mapeo SIL y SISA (Resultados):
+ + + + Descargar Excel + + diff --git a/WebLab/ParametrosEdit.aspx.cs b/WebLab/ParametrosEdit.aspx.cs index f2877f9c..f85533f4 100644 --- a/WebLab/ParametrosEdit.aspx.cs +++ b/WebLab/ParametrosEdit.aspx.cs @@ -20,6 +20,8 @@ using CrystalDecisions.Web; using CrystalDecisions.Shared; using System.Web.Script.Serialization; +using System.Text; +using System.IO; namespace WebLab { @@ -54,7 +56,7 @@ protected void Page_PreInit(object sender, EventArgs e) oUser = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString())); - else Response.Redirect("../FinSesion.aspx", false); + else Response.Redirect("FinSesion.aspx", false); } @@ -64,12 +66,16 @@ protected void Page_PreInit(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) - { - VerificaPermisos("Parametros SI"); - CargarListas(); - MostrarDatos(); - HabilitarDatosModificables(); - + { + if (Session["idUsuario"] != null) + { + VerificaPermisos("Parametros SI"); + CargarListas(); + MostrarDatos(); + HabilitarDatosModificables(); + } + else Response.Redirect("FinSesion.aspx", false); + } } @@ -469,6 +475,7 @@ private void MostrarDatosCodigoBarrasPesquisa() } private void MostrarDatos() { + Efector oEfector = new Efector(); oEfector = (Efector)oEfector.Get(typeof(Efector), int.Parse(ddlEfector.SelectedValue)); if (oEfector != null) @@ -547,10 +554,17 @@ private void MostrarDatos() else ddlDiagnostico.SelectedValue = "0"; + if (oC.HabilitaEnfermedadBase) + ddlEnfermedadBase.SelectedValue = "1"; + else + ddlEnfermedadBase.SelectedValue = "0"; + + if (oC.MedicoObligatorio) ddlMedicoObligatorio.SelectedValue = "1"; else ddlMedicoObligatorio.SelectedValue = "0"; + txtUrlMatriculacion.Text = oC.UrlMatriculacion; string[] arr = oC.OrigenHabilitado.Split((",").ToCharArray()); foreach (string item in arr) @@ -859,7 +873,93 @@ private void MostrarDatos() } } - private bool SiNoHayProtocolosCargados() + + protected void lnkExcel_Click(object sender, EventArgs e) + { + + dataTableAExcel(LeerDatosSISA(), "MapeoSIL_SISA"); + } + + private void dataTableAExcel(DataTable tabla, string nombreArchivo) + { + if (tabla.Rows.Count > 0) + { + StringBuilder sb = new StringBuilder(); + StringWriter sw = new StringWriter(sb); + HtmlTextWriter htw = new HtmlTextWriter(sw); + Page pagina = new Page(); + HtmlForm form = new HtmlForm(); + GridView dg = new GridView(); + dg.EnableViewState = false; + dg.DataSource = tabla; + dg.DataBind(); + pagina.EnableEventValidation = false; + pagina.DesignerInitialize(); + pagina.Controls.Add(form); + form.Controls.Add(dg); + pagina.RenderControl(htw); + Response.Clear(); + Response.Buffer = true; + Response.ContentType = "application/vnd.ms-excel"; + Response.AddHeader("Content-Disposition", "attachment;filename=" + nombreArchivo + ".xls"); + Response.Charset = "UTF-8"; + Response.ContentEncoding = Encoding.Default; + Response.Write(sb.ToString()); + Response.End(); + } + } + private DataTable LeerDatosSISA() + { + + string m_strSQL = @"select idEvento as [idEventoSISA], nombreevento [Nombre Evento], idClasificacionManual, nombreClasificacionManual, idGrupoEvento, nombreGrupoEvento, +s.idmuestra as idmuestrasisa, idTipoMuestra as idtipomuestrasisa, idPrueba as idPruebaSISA , idTipoPrueba as idTipoPruebaSISA, +I.codigo as [codigo SIL],case when i.baja=0 then 'Activa' else 'Dada de baja' end as [Estado en SIL] ,I.nombre as [Det. Sil] , +fechaVigenciaDesde as [Fecha Vigencia Desde], case when fechaVigenciaHasta='19000101' then '' else convert(varchar,fechaVigenciaHasta) end [Fecha Vigencia Hasta], +isnull(o.nombre, 'Todos') as [Origen SIL], isnull(E.nombre, 'Todos') as [Efector Solicitante], edaddesde as [Edad Desde], edadHasta [Edad Hasta], +case unidadEdad when -1 then 'Todas las edades' + when 0 then 'Años' + when 1 then 'meses' + when 2 then 'dias' + end as [Tipo Edad], isnull(M.nombre, 'No aplica') as [Muestra SIL], isnull(c.nombre,'No aplica') as [Caracter SIL] +from lab_configuracionsisa s with (nolock) +left join LAB_Caracter c with (nolock) on C.idCaracter= s.idCaracter +inner join lab_item i with (nolock) on i.idItem= S.idItem +left join lab_origen O with (nolock) on S.idOrigen= O.idOrigen +left join Sys_Efector E with (nolock) on E.idEfector= S.idEfectorSolicitante +left join LAB_Muestra as M with (nolock) on M.idMuestra= S.idMuestraSIL +order by s.idEvento,s.idClasificacionManual,s.idGrupoEvento +"; + + DataSet Ds = new DataSet(); + SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + adapter.Fill(Ds); + + return Ds.Tables[0]; + } + + private DataTable LeerDatosSISAResultados() + { + + string m_strSQL = @"select I.codigo, I.nombre, C.resultado as [Resultado SIL], idResultadoSISA as [Id Resultado SISA], nombreResultadoSISA as [Resultado SISA] +from LAB_ConfiguracionSISADetalle C with (nolock) +inner join lab_item I with (nolock) on I.idItem= C.idItem +order by I.codigo, I.nombre +"; + + DataSet Ds = new DataSet(); + SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection; + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + adapter.Fill(Ds); + + return Ds.Tables[0]; + } + + + + private bool SiNoHayProtocolosCargados() { bool dev=true; ISession m_session = NHibernateHttpModule.CurrentSession; @@ -960,7 +1060,12 @@ private void Guardar() if (ddlDiagnostico.SelectedValue == "0") oC.DiagObligatorio = false; else oC.DiagObligatorio = true; - if (ddlPreValidacion.SelectedValue == "0") oC.PreValida = false; + + + if (ddlEnfermedadBase.SelectedValue == "0") oC.HabilitaEnfermedadBase = false; + else oC.HabilitaEnfermedadBase = true; + + if (ddlPreValidacion.SelectedValue == "0") oC.PreValida = false; else oC.PreValida = true; if (ddlNotificarSISA.SelectedValue == "0") oC.NotificarSISA = false; @@ -1590,6 +1695,39 @@ protected void ddlEfector_SelectedIndexChanged(object sender, EventArgs e) MostrarDatos(); } + protected void lnkExcelSISAResultados_Click(object sender, EventArgs e) + { + dataTableAExcelResultados(LeerDatosSISAResultados(), "MapeoSIL_SISA_Resultados"); + } + + private void dataTableAExcelResultados(DataTable tabla, string nombreArchivo) + { + if (tabla.Rows.Count > 0) + { + StringBuilder sb = new StringBuilder(); + StringWriter sw = new StringWriter(sb); + HtmlTextWriter htw = new HtmlTextWriter(sw); + Page pagina = new Page(); + HtmlForm form = new HtmlForm(); + GridView dg = new GridView(); + dg.EnableViewState = false; + dg.DataSource = tabla; + dg.DataBind(); + pagina.EnableEventValidation = false; + pagina.DesignerInitialize(); + pagina.Controls.Add(form); + form.Controls.Add(dg); + pagina.RenderControl(htw); + Response.Clear(); + Response.Buffer = true; + Response.ContentType = "application/vnd.ms-excel"; + Response.AddHeader("Content-Disposition", "attachment;filename=" + nombreArchivo + ".xls"); + Response.Charset = "UTF-8"; + Response.ContentEncoding = Encoding.Default; + Response.Write(sb.ToString()); + Response.End(); + } + } //protected void lnkImpresionPrueba_Click(object sender, EventArgs e) //{ // ImpresiondePrueba(); diff --git a/WebLab/ParametrosEdit.aspx.designer.cs b/WebLab/ParametrosEdit.aspx.designer.cs index 2e297f8d..13c6ae58 100644 --- a/WebLab/ParametrosEdit.aspx.designer.cs +++ b/WebLab/ParametrosEdit.aspx.designer.cs @@ -165,6 +165,15 @@ public partial class ParametrosEdit { /// protected global::System.Web.UI.WebControls.DropDownList ddlDiagnostico; + /// + /// ddlEnfermedadBase control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlEnfermedadBase; + /// /// ddlRecordarOrigenProtocolo control. /// @@ -930,6 +939,24 @@ public partial class ParametrosEdit { /// protected global::System.Web.UI.WebControls.TextBox txtCodigoEstablecimientoSISA; + /// + /// lnkExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lnkExcel; + + /// + /// lnkExcelSISAResultados control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lnkExcelSISAResultados; + /// /// btnReinializacion control. /// diff --git a/WebLab/Placas/PlacaEdit2.aspx.cs b/WebLab/Placas/PlacaEdit2.aspx.cs index 8a823670..d0e40ae2 100644 --- a/WebLab/Placas/PlacaEdit2.aspx.cs +++ b/WebLab/Placas/PlacaEdit2.aspx.cs @@ -437,7 +437,7 @@ private void Guardar(Placa oRegistro, string estado) oRegistro.Operador = ddlOperador.SelectedItem.Text + " -" + ddlOperador0.SelectedItem.Text; oRegistro.Equipo = lblEquipo.Text; oRegistro.Fecha =DateTime.Parse( lblFecha.Text); - + oRegistro.IdEfector = oC.IdEfector; if (Request["id"] == null) { oRegistro.FechaRegistro = DateTime.Now; @@ -445,7 +445,7 @@ private void Guardar(Placa oRegistro, string estado) } oRegistro.Estado = estado; oRegistro.Save(); - if (estado=="C") oRegistro.GrabarAuditoria("Graba y Cierra", int.Parse(Session["idUsuario"].ToString()), ""); + if (estado=="C") oRegistro.GrabarAuditoria("Graba y Cierra", int.Parse(Session["idUsuario"].ToString()), ""); //Caro: hago que recorra las determinacoines del tipo de placa @@ -728,7 +728,7 @@ private void guardarvalorCeldaAlplex(Placa oRegistro, Item oItem, string value, oDet.IdProtocolo.GrabarAuditoriaDetalleProtocolo("Vincula a Placa Alplex", int.Parse(Session["idUsuario"].ToString()), "", oRegistro.IdPlaca.ToString()); } else - { Session["errores"] += "- Protocolo " + value + " ya validado. No es posible incorporar a la placa."; } + { Session["errores"] += "- Protocolo " + value + " ya validado. No es posible incorporar a la placa."; break; } } } @@ -790,7 +790,7 @@ private void guardarvalorCelda(Placa oRegistro, Item oItem, string value, string oDet.IdProtocolo.GrabarAuditoriaDetalleProtocolo("Vincula a Placa Promega", int.Parse(Session["idUsuario"].ToString()), "", oRegistro.IdPlaca.ToString()); } else - { Session["errores"] += "- Protocolo " + value + " ya fue validado. No es posible incorporar en la placa"; } + { Session["errores"] += "- Protocolo " + value + " ya fue validado. No es posible incorporar en la placa"; break; } } } diff --git a/WebLab/Placas/PlacaEdit3.aspx.cs b/WebLab/Placas/PlacaEdit3.aspx.cs index 25680fc1..51533094 100644 --- a/WebLab/Placas/PlacaEdit3.aspx.cs +++ b/WebLab/Placas/PlacaEdit3.aspx.cs @@ -429,6 +429,7 @@ private void Guardar(Placa oRegistro, string estado) oRegistro.Operador = ddlOperador.SelectedItem.Text + " -" + ddlOperador0.SelectedItem.Text; oRegistro.Equipo = lblEquipo.Text; + oRegistro.IdEfector = oC.IdEfector; oRegistro.Fecha =DateTime.Parse( lblFecha.Text); if (Request["id"] == null) @@ -852,7 +853,7 @@ private void Imprimir(string id) Business.Data.Laboratorio.Placa oRegistro = new Business.Data.Laboratorio.Placa(); oRegistro = (Business.Data.Laboratorio.Placa)oRegistro.Get(typeof(Business.Data.Laboratorio.Placa), int.Parse(id)); - Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1); + // Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), "IdEfector", oC.IdEfector); CrystalReportSource oCr = new CrystalReportSource(); diff --git a/WebLab/Placas/PlacaList.aspx.cs b/WebLab/Placas/PlacaList.aspx.cs index 912f6980..e7b386b5 100644 --- a/WebLab/Placas/PlacaList.aspx.cs +++ b/WebLab/Placas/PlacaList.aspx.cs @@ -161,7 +161,7 @@ private string getEstado(string estado) } private object LeerDatos( ) { - string m_condicion = " 1=1 "; + string m_condicion = " 1=1 and P.idEfector="+ oUser.IdEfector.IdEfector.ToString(); ///placas del efector if (txtNumero.Text != "") m_condicion += " and IDPlaca =" + txtNumero.Text.Trim(); @@ -408,7 +408,7 @@ private void ImprimirAuditoria(string v) DataTable dtAuditoria = GetDataSetAuditoria(v); if (dtAuditoria.Columns.Count > 2) { - Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1); + Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), "IdEfector", oUser.IdEfector);///encabezado del efector ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue(); encabezado1.Value = oCon.EncabezadoLinea1; diff --git a/WebLab/Placas/PlacaMixtaEdit.aspx.cs b/WebLab/Placas/PlacaMixtaEdit.aspx.cs index 9fd24399..8c84831c 100644 --- a/WebLab/Placas/PlacaMixtaEdit.aspx.cs +++ b/WebLab/Placas/PlacaMixtaEdit.aspx.cs @@ -411,6 +411,7 @@ private void Guardar(Placa oRegistro, string estado) oRegistro.Operador = ddlOperador.SelectedItem.Text + " -" + ddlOperador0.SelectedItem.Text; oRegistro.Equipo = lblEquipo.Text; oRegistro.Fecha =DateTime.Parse( lblFecha.Text); + oRegistro.IdEfector = oC.IdEfector; if (Request["id"] == null) { diff --git a/WebLab/Principal.aspx b/WebLab/Principal.aspx index 0cc4eb11..5818f350 100644 --- a/WebLab/Principal.aspx +++ b/WebLab/Principal.aspx @@ -113,8 +113,12 @@ -
- +
+ + +
+ +
@@ -126,7 +130,6 @@

-
protected global::System.Web.UI.HtmlControls.HtmlGenericControl Div1; + /// + /// btnProtocoloEfector control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnProtocoloEfector; + /// /// gvProtocolosxEfector control. /// @@ -139,40 +148,49 @@ public partial class Principal { protected global::System.Web.UI.WebControls.GridView gvProtocolosxEfector; /// - /// Div2 control. + /// btnSISA control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl Div2; + protected global::System.Web.UI.WebControls.Button btnSISA; /// - /// LinkButton1 control. + /// gvProtocolosxSISA control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.LinkButton LinkButton1; + protected global::System.Web.UI.WebControls.GridView gvProtocolosxSISA; /// - /// lnkCambioEfector control. + /// Div2 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.LinkButton lnkCambioEfector; + protected global::System.Web.UI.HtmlControls.HtmlGenericControl Div2; /// - /// gvProtocolosxSISA control. + /// LinkButton1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.GridView gvProtocolosxSISA; + protected global::System.Web.UI.WebControls.LinkButton LinkButton1; + + /// + /// lnkCambioEfector control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lnkCambioEfector; /// /// mensajeria control. diff --git a/WebLab/Protocolos/Default2.aspx b/WebLab/Protocolos/Default2.aspx index b9e42a30..b1796bdb 100644 --- a/WebLab/Protocolos/Default2.aspx +++ b/WebLab/Protocolos/Default2.aspx @@ -99,9 +99,10 @@ - Sexo:* + MinimumValue="1" Type="Integer" ValidationGroup="0">*--%> @@ -112,6 +113,7 @@ X-No Binario + @@ -119,7 +121,7 @@ - Nro. Ident. Adicional/Parentesco: + Nro. Ident. Adicional: - + <%----%> diff --git a/WebLab/Protocolos/Default2.aspx.cs b/WebLab/Protocolos/Default2.aspx.cs index eaa84152..5eef41f4 100644 --- a/WebLab/Protocolos/Default2.aspx.cs +++ b/WebLab/Protocolos/Default2.aspx.cs @@ -363,14 +363,14 @@ private void CargarGrillaAmpliada() } private void CargarGrilla () { - string m_sexo = "F"; - if (ddlSexo.SelectedValue == "2") - m_sexo = "F"; + string m_sexo = ""; lblMensajeSexo.Visible = false; lblMensaje.Visible = false; + //if (ddlSexo.SelectedValue == "2") + // m_sexo = "F"; - if (ddlSexo.SelectedValue == "3") - m_sexo = "M"; - if (ddlSexo.SelectedValue == "4") - m_sexo = "X"; + //if (ddlSexo.SelectedValue == "3") + // m_sexo = "M"; + //if (ddlSexo.SelectedValue == "4") + // m_sexo = "X"; @@ -382,11 +382,22 @@ private void CargarGrilla () if (gvLista.Rows.Count == 0) { - lblMensaje.Visible = false; - - - Response.Redirect("ProcesaRenaper.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString()); + if (ddlSexo.SelectedValue != "0") // se debe seleccionar el sexo para generar un paciente nuevo + { + m_sexo = obtenerSexo(); + lblMensaje.Visible = false; + if (Request["Operacion"] != "Modifica") + Response.Redirect("ProcesaRenaper.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString()); + else + Response.Redirect("ProcesaRenaper.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString() + "&Operacion=" + Request["Operacion"].ToString() + "&idProtocolo=" + Request["idProtocolo"].ToString() + "&Desde=" + Request["Desde"].ToString()); + } + else + { + lblMensajeSexo.Text = "Debe ingresar un sexo para generar un paciente nuevo"; + lblMensajeSexo.Visible = true; + lblMensaje.Visible = false; + } } else @@ -396,31 +407,53 @@ private void CargarGrilla () if ((ddlTipo.SelectedValue == "T")) { //temporal + + if ((txtDni.Value != "") || (txtNumeroAdicional.Text != "")) { gvLista.DataSource = LeerDatos(); gvLista.DataBind(); - - if (gvLista.Rows.Count == 0) { - lblMensaje.Visible = false; - - - Response.Redirect("ProcesaRenaperT.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString()); - + if (ddlSexo.SelectedValue != "0") // se debe seleccionar el sexo para generar un paciente nuevo + { + m_sexo = obtenerSexo(); + lblMensaje.Visible = false; + if (Request["Operacion"] != "Modifica") + Response.Redirect("ProcesaRenaperT.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString()); + else + Response.Redirect("ProcesaRenaperT.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString() + "&Operacion=" + Request["Operacion"].ToString() + "&idProtocolo=" + Request["idProtocolo"].ToString() + "&Desde=" + Request["Desde"].ToString()); + } + else + { + lblMensajeSexo.Text = "Debe ingresar un sexo para generar un paciente nuevo"; + lblMensajeSexo.Visible = true; + lblMensaje.Visible = false; + } } else lblMensaje.Visible = true; } else + { + if (ddlSexo.SelectedValue != "0") // se debe seleccionar el sexo para generar un paciente nuevo + { + m_sexo = obtenerSexo(); - Response.Redirect("ProcesaRenaperT.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString()); - } + + Response.Redirect("ProcesaRenaperT.aspx?Tipo=" + ddlTipo.SelectedValue + "&dni=" + txtDni.Value + "&sexo=" + m_sexo + "&llamada=LaboProtocolo&idServicio=" + Request["idServicio"].ToString() + "&idUrgencia=" + Session["idUrgencia"].ToString()); + } + else + { + lblMensajeSexo.Text = "Debe ingresar un sexo para generar un paciente nuevo"; + lblMensajeSexo.Visible = true; + } + } + } @@ -437,6 +470,17 @@ private void CargarGrilla () } + private string obtenerSexo() + { + string m_sexo=""; + if (ddlSexo.SelectedValue == "2") + m_sexo = "F"; + if (ddlSexo.SelectedValue == "3") + m_sexo = "M"; + if (ddlSexo.SelectedValue == "4") + m_sexo = "X"; + return m_sexo; + } private object LeerDatos() { @@ -457,8 +501,8 @@ private object LeerDatos() { str_condicion += " and Pa.idEstado in (2)"; // temporal if (txtDni.Value != "") str_condicion += " AND (Pa.numeroDocumento = '" + txtDni.Value.Trim() + "')"; - if (txtNumeroAdicional.Text != "") str_condicion +=" and (Pa.numeroAdic like '%" + txtNumeroAdicional.Text.Trim() + @"%' - or Pa.idPaciente in (select idPaciente from sys_parentesco with (nolock) where numeroDocumento=" + txtNumeroAdicional.Text.Trim()+"))"; + if (txtNumeroAdicional.Text != "") str_condicion += " and (Pa.numeroAdic like '%" + txtNumeroAdicional.Text.Trim() + @"%')"; + ///or Pa.idPaciente in (select idPaciente from sys_parentesco with (nolock) where numeroDocumento=" + txtNumeroAdicional.Text.Trim()+"))"; // es incorrecto porque el campo numerodocumento es int y no graba txtNumeroAdicional en sys_parentesco } m_strSQL = " SELECT top 10 Pa.idPaciente, case when Pa.idestado=2 then convert(varchar,Pa.numeroAdic) + '-T' else convert(varchar,Pa.numeroDocumento) end as dni,Pa.apellido+ ' ' + Pa.nombre as paciente, convert(varchar(10),Pa.fechaNacimiento,103) as fechaNacimiento, " + diff --git a/WebLab/Protocolos/Default2.aspx.designer.cs b/WebLab/Protocolos/Default2.aspx.designer.cs index e435235d..fcd53793 100644 --- a/WebLab/Protocolos/Default2.aspx.designer.cs +++ b/WebLab/Protocolos/Default2.aspx.designer.cs @@ -121,22 +121,22 @@ public partial class Default2 { protected global::System.Web.UI.WebControls.CompareValidator cvDni; /// - /// rvSexo control. + /// ddlSexo control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RangeValidator rvSexo; + protected global::System.Web.UI.WebControls.DropDownList ddlSexo; /// - /// ddlSexo control. + /// lblMensajeSexo control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.DropDownList ddlSexo; + protected global::System.Web.UI.WebControls.Label lblMensajeSexo; /// /// txtNumeroAdicional control. diff --git a/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx b/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx index d7bfeb93..c3bf7499 100644 --- a/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx +++ b/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx @@ -11,12 +11,12 @@ var txtNumeroLote = document.getElementById('<%= txtNumeroLote.ClientID %>'); //console.log(txtNumeroLote); var num = txtNumeroLote.value; - //console.log(num); + //console.log(num); num = num.replace(/\D/g, ''); //console.log(num); $("#<%=txtNumeroLote.ClientID%>").val(num); } - + @@ -50,9 +50,10 @@
- - - + + Nro. Lote: + +
@@ -93,20 +94,14 @@
+ DataKeyNames="idProtocolo" OnRowDataBound="gvProtocolosDerivados_RowDataBound" OnRowCommand="gvProtocolosDerivados_RowCommand"> - - <%----%> - - - + + - diff --git a/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.cs b/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.cs index d1a4a55a..dab8e2ee 100644 --- a/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.cs +++ b/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.cs @@ -23,7 +23,7 @@ public partial class DerivacionMultiEfectorLote : System.Web.UI.Page public Configuracion oC = new Configuracion(); public Usuario oUser = new Usuario(); - #region Carga + protected void Page_PreInit(object sender, EventArgs e) { @@ -42,7 +42,7 @@ protected void Page_Load(object sender, EventArgs e) if (!Page.IsPostBack) { - VerificaPermisos("Derivacion"); + VerificaPermisos("Derivacion por Lotes"); if (Request["idServicio"].ToString() != "5") ProtocoloList1.CargarGrillaProtocolo(Request["idServicio"].ToString()); else @@ -56,6 +56,7 @@ protected void Page_Load(object sender, EventArgs e) txtNumeroLote.Focus(); } + } private void VerificaPermisos(string sObjeto) { @@ -110,28 +111,23 @@ protected bool NoIngresado(int estado) break; } return tiene; - } - #endregion - - #region Buscar + } protected void btnBuscar_Click(object sender, EventArgs e) { - try - { - resetearForm(); - LoteDerivacion lote = new LoteDerivacion(); - lote = (LoteDerivacion)lote.Get(typeof(LoteDerivacion), Convert.ToInt32(txtNumeroLote.Text)); + + resetearForm(); + LoteDerivacion lote = new LoteDerivacion(); + lote = (LoteDerivacion)lote.GetIfExists(typeof(LoteDerivacion),int.Parse(txtNumeroLote.Text)); + if (lote != null) + { if (efectorCorrecto(lote)) { //El efector destino es el efector logueado CargarControladores(lote); } + } - catch (Exception) - { - ScriptManager.RegisterStartupScript(this, GetType(), "mensajeError", "alert('Número de lote inexistente.');", true); - } - + else ScriptManager.RegisterStartupScript(this, GetType(), "mensajeError", "alert('Número de lote inexistente.');", true); } private void CargarControladores(LoteDerivacion lote) { @@ -142,60 +138,66 @@ private void CargarControladores(LoteDerivacion lote) } //Cargo el estado - lblEstadoLote.Text = lote.descripcionEstadoLote(); + // lblEstadoLote.Text = lote.descripcionEstadoLote(); + + LoteDerivacionEstado estado = new LoteDerivacionEstado(); + estado = (LoteDerivacionEstado)estado.Get(typeof(LoteDerivacionEstado), lote.Estado); + lblEstadoLote.Text = estado.Nombre; //Cargo el efector de Origen - Efector efectorOrigen = new Efector(); - efectorOrigen = (Efector)efectorOrigen.Get(typeof(Efector), "IdEfector", lote.IdEfectorOrigen.IdEfector); - lblEfectorOrigen.Text = efectorOrigen.Nombre; + if (lote.IdEfectorOrigen != null) + lblEfectorOrigen.Text = lote.IdEfectorOrigen.Nombre; + + //Cargo grilla de protocolos para ingresar + DataTable dt = LeerDatosProtocolosDerivados(); + if (dt != null) + { + gvProtocolosDerivados.DataSource = dt; + gvProtocolosDerivados.DataBind(); + + } + - //Cargo grilla de protocolos para ingresar - DataTable dt = LeerDatosProtocolosDerivados(); int cantidad = dt.Rows.Count; if (cantidad > 0) - { - gvProtocolosDerivados.DataSource = dt; + { lblCantidadRegistros.Text = "Cantidad de registros encontrados " + cantidad; if (cantidad <= 10) divScroll.Style["height"] = "auto"; // altura mínima else divScroll.Style["height"] = "500px"; // altura grande con scroll - + } else - { - gvProtocolosDerivados.DataSource = null; - gvProtocolosDerivados.Visible = true; //asi sale el cartel de grilla vacia "EmptyDataText" + { //Si no trajo datos verifico el estado del lote - gvProtocolosDerivados.EmptyDataRowStyle.ForeColor = System.Drawing.Color.Red; + // gvProtocolosDerivados.EmptyDataRowStyle.ForeColor = System.Drawing.Color.Red; switch (lote.Estado) { case 1: - gvProtocolosDerivados.EmptyDataText = "No se puede recepcionar lote, todavia no se ha derivado."; break; + // gvProtocolosDerivados.EmptyDataText = "No se puede recepcionar lote, todavia no se ha derivado."; break; + lblCantidadRegistros.Text = "No se puede recepcionar lote, todavia no se ha derivado "; break; case 2: case 3: case 4: - case 5: - gvProtocolosDerivados.EmptyDataText = "No se encontraron protocolos para el lote ingresado."; - - break; - case 6: //Si esta el lote esta completo muestro otro mensaje de la grilla - gvProtocolosDerivados.EmptyDataText = "Ya se ingresaron todos los protocolos del lote."; - gvProtocolosDerivados.EmptyDataRowStyle.ForeColor = System.Drawing.Color.Black; - break; - } - divScroll.Style["height"] = "auto"; - } - gvProtocolosDerivados.DataBind(); - + case 5: + lblCantidadRegistros.Text = "No se encontraron protocolos para el lote ingresado."; break; + + case 6: //Si esta el lote esta completo muestro otro mensaje de la grilla + lblCantidadRegistros.Text = "Ya se ingresaron todos los protocolos del lote."; break; + + + } + divScroll.Style["height"] = "auto"; + } + } private bool efectorCorrecto(LoteDerivacion lote) { - try - { + //Verifico que el efector de Destino sea el que se tenga que ingresar if (lote.IdEfectorDestino.IdEfector == oUser.IdEfector.IdEfector) { @@ -204,8 +206,9 @@ private bool efectorCorrecto(LoteDerivacion lote) } else { - Efector e = new Efector(); - e = (Efector)e.Get(typeof(Efector), lote.IdEfectorDestino.IdEfector); + //Efector e = new Efector(); + //e = (Efector)e.Get(typeof(Efector), lote.IdEfectorDestino.IdEfector); + lblErrorEfectorOrigen.Visible = true; lblErrorEfectorOrigen.Text = "El lote no corresponde al efector del usuario '" + oC.IdEfector.Nombre + "'"; divControlLote.Attributes["class"] = "form-group has-error"; @@ -214,13 +217,6 @@ private bool efectorCorrecto(LoteDerivacion lote) } - } - catch (Exception excep) - { - - // if(excep.Message.Contains("")) - return false; //Cuando da error idlote inexistente que devuelva falso - } } @@ -253,41 +249,42 @@ and L.estado in (2, 4, 5) DataSet Ds = new DataSet(); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString); ///Performance: conexion de solo lectura - SqlDataAdapter adapter = new SqlDataAdapter - { - SelectCommand = new SqlCommand(m_strSQL, conn) - }; + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + + adapter.Fill(Ds); return Ds.Tables[0]; } - - protected bool HabilitarIngreso() - { - bool puedeIngresarProtocolo = false; - LoteDerivacion lote = new LoteDerivacion(); - lote = (LoteDerivacion)lote.Get(typeof(LoteDerivacion), Convert.ToInt32(txtNumeroLote.Text)); - - /* Estados del Lote - idEstado nombre - 1 Creado -> NO permitir cargar protocolo - 2 Derivado -> NO permitir cargar protocolo - 3 Cancelado -> NO permitir cargar protocolo - 4 Recibido -> permitir cargar protocolo - 5 Ingresado -> permitir cargar protocolo - 6 Completado -> No hay más protocolos para cargar + //protected bool HabilitarIngreso() + //{ + // bool puedeIngresarProtocolo = false; + + // LoteDerivacion lote = new LoteDerivacion(); + // lote = (LoteDerivacion)lote.Get(typeof(LoteDerivacion), Convert.ToInt32(txtNumeroLote.Text)); + + // /* Estados del Lote + // idEstado nombre + // 1 Creado -> NO permitir cargar protocolo + // 2 Derivado -> NO permitir cargar protocolo + // 3 Cancelado -> NO permitir cargar protocolo + // 4 Recibido -> permitir cargar protocolo + // 5 Ingresado -> permitir cargar protocolo + // 6 Completado -> No hay más protocolos para cargar - */ - if (lote.Estado == 5 || lote.Estado == 4) - { - puedeIngresarProtocolo = true; - } - return puedeIngresarProtocolo; - } - #endregion + // */ + // if (lote.Estado == 5 || lote.Estado == 4) + // { + // puedeIngresarProtocolo = true; + // } + // return puedeIngresarProtocolo; + //} #region NuevoLote + + /* protected void lnkIngresoProtocolo_Command(object sender, CommandEventArgs e) { int idProtocolo = Convert.ToInt32(e.CommandArgument); @@ -325,6 +322,42 @@ private void GenerarNuevoProtocolo(int idProtocoloOrigen, int idPaciente) "&Operacion=AltaDerivacionMultiEfectorLote" , false); } + } + */ + + private void GenerarNuevoProtocolo(object idProtocoloOrigen ) + { + + string s_idServicio, idLote; + int i_idProtocoloOrigen = int.Parse(idProtocoloOrigen.ToString()); + + Protocolo p = new Protocolo(); + p = (Protocolo)p.Get(typeof(Protocolo), i_idProtocoloOrigen); + + s_idServicio = p.IdTipoServicio.IdTipoServicio.ToString(); + idLote = txtNumeroLote.Text; + int idPaciente= p.IdPaciente.IdPaciente; + + if (p.IdPaciente.IdPaciente > 0) + { + Response.Redirect("ProtocoloEdit2.aspx?idEfectorSolicitante=" + p.IdEfector.IdEfector + + "&idProtocolo=" + idProtocoloOrigen + + "&idServicio=" + s_idServicio + + "&idLote=" + idLote + + "&idPaciente=" + idPaciente + + "&Operacion=AltaDerivacionMultiEfectorLote", false); + } + else + { + //Es Muestra No Pacientes + Response.Redirect("ProtocoloProductoEdit.aspx?idEfectorSolicitante=" + p.IdEfector.IdEfector + + "&idProtocolo=" + idProtocoloOrigen + + "&idServicio=" + s_idServicio + + "&idLote=" + idLote + + "&Desde=AltaDerivacionMultiEfectorLote" + + "&Operacion=AltaDerivacionMultiEfectorLote", false); + } + } #endregion @@ -334,14 +367,35 @@ protected void btn_recibirLote_Click(object sender, EventArgs e) { Response.Redirect("DerivacionRecibirLote.aspx?idLote=" + txtNumeroLote.Text + "&idServicio=" + Request["idServicio"], false); } + + #endregion - protected void txtNumeroLote_TextChanged(object sender, EventArgs e) - { - //Si cambia el numero de lote, que vuelva a realizar la busqueda para que refresque los datos de busqueda - btnBuscar_Click(null, null); - } + protected void gvProtocolosDerivados_RowDataBound(object sender, GridViewRowEventArgs e) + { + + ///Cuando se carga la grilla es porque ya verifiqué el estado del lote + + if (e.Row.RowType == DataControlRowType.DataRow) + { + LinkButton cmdProtocolo = (LinkButton)e.Row.Cells[3].Controls[1]; + cmdProtocolo.CommandArgument = this.gvProtocolosDerivados.DataKeys[e.Row.RowIndex].Value.ToString(); + cmdProtocolo.ToolTip = "Ingresar Protocolo"; + if ((lblEstadoLote.Text == "Recibido") || (lblEstadoLote.Text == "Ingresado Parcial")) + cmdProtocolo.Enabled = true; + else + + cmdProtocolo.Enabled = false; + } + + } + protected void gvProtocolosDerivados_RowCommand(object sender, GridViewCommandEventArgs e) + { + + + GenerarNuevoProtocolo (e.CommandArgument); + } } } \ No newline at end of file diff --git a/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.designer.cs b/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.designer.cs index 05179157..4b6dedc4 100644 --- a/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.designer.cs +++ b/WebLab/Protocolos/DerivacionMultiEfectorLote.aspx.designer.cs @@ -50,6 +50,15 @@ public partial class DerivacionMultiEfectorLote /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divControlLote; + /// + /// lblNumeroLote control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblNumeroLote; + /// /// txtNumeroLote control. /// diff --git a/WebLab/Protocolos/DerivacionRecibirLote.aspx b/WebLab/Protocolos/DerivacionRecibirLote.aspx index 625adea2..dd94a4d7 100644 --- a/WebLab/Protocolos/DerivacionRecibirLote.aspx +++ b/WebLab/Protocolos/DerivacionRecibirLote.aspx @@ -8,10 +8,10 @@ - + --%> @@ -109,13 +110,13 @@ Fecha y Hora: - <%----%> + <%-- --%> - *Error en Fecha + <%-- *Error en Fecha *Error en Hora - + --%> @@ -128,12 +129,16 @@ - + + + +
diff --git a/WebLab/Protocolos/DerivacionRecibirLote.aspx.cs b/WebLab/Protocolos/DerivacionRecibirLote.aspx.cs index 31b87abd..b2d09505 100644 --- a/WebLab/Protocolos/DerivacionRecibirLote.aspx.cs +++ b/WebLab/Protocolos/DerivacionRecibirLote.aspx.cs @@ -38,7 +38,7 @@ protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { - VerificaPermisos("Derivacion"); + VerificaPermisos("Derivacion por Lotes"); CargarEncabezado(); } } @@ -70,15 +70,12 @@ private void CargarEncabezado() private void CargarFechaHoraActual() { DateTime miFecha = DateTime.UtcNow.AddHours(-3); //Hora estándar de Argentina (UTC-03:00) - //txt_Fecha.Value = miFecha.Date.ToString("yyyy-MM-dd"); txtHora.Value = miFecha.ToString("HH:mm"); txtFecha.Text = miFecha.Date.ToString("yyyy-MM-dd"); - //LAB-74 Control de fecha: La fecha de ingreso del lote no puede ser anterior a la fecha de envio del lote - rvFecha.MinimumValue = hidFechaEnvio.Value; - rvFecha.MaximumValue = txtFecha.Text; //Fecha Date today - rvFecha.Text = "La fecha de recepcion no puede ser menor a la fecha de envio " + hidFechaEnvio.Value; - + //rvFecha.MinimumValue = hidFechaEnvio.Value; + //rvFecha.MaximumValue = txtFecha.Text; //Fecha Date today + //rvFecha.Text = "La fecha de recepcion no puede ser menor a la fecha de envio " + hidFechaEnvio.Value; } private void VerificaPermisos(string sObjeto) @@ -112,16 +109,20 @@ private void VerificaPermisos(string sObjeto) protected void btn_recibirLote_Click(object sender, EventArgs e) { - //Cambiar estado al lote - LoteDerivacion lote = new LoteDerivacion(); - lote = (LoteDerivacion)lote.Get(typeof(LoteDerivacion), Convert.ToInt32(Request["idLote"])); - lote.Estado = 4; - lote.IdUsuarioRecepcion = oUser.IdUsuario; - lote.Save(); - - //Generar Auditorias - GenerarAuditorias(lote); - btn_volver_Click(null, null); + if (Page.IsValid) + { + //Cambiar estado al lote + LoteDerivacion lote = new LoteDerivacion(); + lote = (LoteDerivacion)lote.Get(typeof(LoteDerivacion), Convert.ToInt32(Request["idLote"])); + lote.Estado = 4; + lote.IdUsuarioRecepcion = oUser.IdUsuario; + lote.Save(); + + //Generar Auditorias + GenerarAuditorias(lote); + btn_volver_Click(null, null); + } + } private void GenerarAuditorias(LoteDerivacion lote) @@ -157,5 +158,34 @@ protected void btn_volver_Click(object sender, EventArgs e) { Response.Redirect("DerivacionMultiEfectorLote.aspx?idServicio=" + Request["idServicio"] + "&idLote=" + Request["idLote"], false); } + + protected void cvValidacionInput_ServerValidate(object source, ServerValidateEventArgs args) + { + + string error = ""; + + if (string.IsNullOrEmpty(txtFecha.Text )) + { + args.IsValid = false; + error = "*Error en Fecha"; + } + + if (string.IsNullOrEmpty(txtHora.Value)) + { + args.IsValid = false; + error = "*Error en Hora"; + } + + /* Por ahora no restringimos la fecha porque ellos si se equivocan no pueden editar la derivacion enviada*/ + //if (DateTime.Parse(txtFecha.Text) < DateTime.Parse(hidFechaEnvio.Value)) + //{ + // error = "La fecha de recepcion no puede ser menor a la fecha de envio " + DateTime.Parse(hidFechaEnvio.Value).ToString("dd/MM/yyyy"); + // args.IsValid = false; + //} + + + + this.cvValidacionInput.ErrorMessage = error ; + } } } \ No newline at end of file diff --git a/WebLab/Protocolos/DerivacionRecibirLote.aspx.designer.cs b/WebLab/Protocolos/DerivacionRecibirLote.aspx.designer.cs index 0705dca8..15e2ad4f 100644 --- a/WebLab/Protocolos/DerivacionRecibirLote.aspx.designer.cs +++ b/WebLab/Protocolos/DerivacionRecibirLote.aspx.designer.cs @@ -105,40 +105,22 @@ public partial class DerivacionRecibirLote protected global::System.Web.UI.HtmlControls.HtmlInputGenericControl txtHora; /// - /// rfvFecha control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvFecha; - - /// - /// rfvHora control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvHora; - - /// - /// rvFecha control. + /// txtObs control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RangeValidator rvFecha; + protected global::System.Web.UI.HtmlControls.HtmlTextArea txtObs; /// - /// txtObs control. + /// cvValidacionInput control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.HtmlControls.HtmlTextArea txtObs; + protected global::System.Web.UI.WebControls.CustomValidator cvValidacionInput; /// /// btnRecibirLote control. diff --git a/WebLab/Protocolos/MedicoSel.aspx b/WebLab/Protocolos/MedicoSel.aspx index 5d059d71..006ec74b 100644 --- a/WebLab/Protocolos/MedicoSel.aspx +++ b/WebLab/Protocolos/MedicoSel.aspx @@ -37,19 +37,21 @@
- +
+ + - + - - - - - - - - + + + + + + +
diff --git a/WebLab/Protocolos/MedicoSel.aspx.cs b/WebLab/Protocolos/MedicoSel.aspx.cs index 606e18c4..ddaeb4d6 100644 --- a/WebLab/Protocolos/MedicoSel.aspx.cs +++ b/WebLab/Protocolos/MedicoSel.aspx.cs @@ -1,5 +1,6 @@ using Business.Data; using Business.Data.Laboratorio; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; @@ -19,19 +20,20 @@ public partial class MedicoSel : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { - if (!Page.IsPostBack) - { - + if (!Page.IsPostBack) + { + Session["matricula"] = null; + Session["apellidoNombre"] = null; } - } - + protected void btnBuscar_Click(object sender, EventArgs e) { try { + lblErrorAPI.Text = ""; Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1); ///Buscar especilista @@ -39,32 +41,29 @@ protected void btnBuscar_Click(object sender, EventArgs e) string nombre = txtNombre.Text; string s_urlWFC = oCon.UrlMatriculacion; string s_url = s_urlWFC + "nombre=" + nombre + "&apellido=" + apellido;// + "&codigoProfesion=1 "; + System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(s_url); HttpWebResponse ws1 = (HttpWebResponse)request.GetResponse(); JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); - + Stream st = ws1.GetResponseStream(); StreamReader sr = new StreamReader(st); string s = sr.ReadToEnd(); if (s != "0") { - - //List pro = jsonSerializer.Deserialize>(s); - - DataTable t = GetJSONToDataTableUsingMethod(s); + DataTable t = GetDataTableMatriculaciones(s); //GetJSONToDataTableUsingMethod(s); gvMedico.DataSource = t; gvMedico.DataBind(); - - } } catch (Exception ex) { - + lblErrorAPI.Visible = true; + lblErrorAPI.Text = "Ha ocurrido un error: " + ex.Message.ToString() + ". Comuniquese con el administrador."; } - + } public static DataTable GetJSONToDataTableUsingMethod(string JSONData) @@ -119,13 +118,41 @@ public static DataTable GetJSONToDataTableUsingMethod(string JSONData) } return dtUsingMethodReturn; } + + private static DataTable GetDataTableMatriculaciones(string json) + { + //Pasa de JSON al tipo de objeto ProfesionalMatriculado + List personas = JsonConvert.DeserializeObject>(json); + DataTable dt = new DataTable(); + + if (personas.Count > 0) + { + //Guardo solo en la tabla aquellos datos que necesito + dt.Columns.Add("nombre"); + dt.Columns.Add("apellido"); + dt.Columns.Add("titulo"); + dt.Columns.Add("matriculaNumero"); + + foreach (Protocolos.ProtocoloEdit2.ProfesionalMatriculado persona in personas) + { + foreach (Protocolos.ProtocoloEdit2.Profesiones prof in persona.profesiones) + { + foreach (Protocolos.ProtocoloEdit2.Matricula mat in prof.matriculacion) + { + if (DateTime.Compare(mat.fin, DateTime.Now) > 0) //Solo agrega las matriculas no vencidas + { + dt.Rows.Add(persona.nombre, persona.apellido, prof.titulo, mat.matriculaNumero); + } + } + } + } + } + return dt; + } protected void gvMedico_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.Cells.Count > 1) { - - - if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton CmdModificar = (LinkButton)e.Row.Cells[3].Controls[1]; @@ -133,23 +160,27 @@ protected void gvMedico_RowDataBound(object sender, GridViewRowEventArgs e) CmdModificar.CommandName = "Seleccionar"; CmdModificar.ToolTip = "Seleccionar"; + // Valor adicional (Nombre y apellido) + DataRow rowData = ((DataRowView)e.Row.DataItem).Row; + CmdModificar.Attributes["nombre"] = rowData.ItemArray[0].ToString(); + CmdModificar.Attributes["apellido"] = rowData.ItemArray[1].ToString(); } - - } } protected void gvMedico_RowCommand(object sender, GridViewCommandEventArgs e) { - if (e.CommandName== "Seleccionar") + if (e.CommandName == "Seleccionar") { - - Session["matricula"] = e.CommandArgument.ToString(); - - - + Session["matricula"] = e.CommandArgument.ToString(); + LinkButton boton = (LinkButton)e.CommandSource; + Session["apellidoNombre"] = boton.Attributes["apellido"] + " " + boton.Attributes["nombre"]; } + } + + + } } \ No newline at end of file diff --git a/WebLab/Protocolos/MedicoSel.aspx.designer.cs b/WebLab/Protocolos/MedicoSel.aspx.designer.cs index a48b0927..a609d583 100644 --- a/WebLab/Protocolos/MedicoSel.aspx.designer.cs +++ b/WebLab/Protocolos/MedicoSel.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace WebLab.Protocolos { - - - public partial class MedicoSel { - +namespace WebLab.Protocolos +{ + + + public partial class MedicoSel + { + /// /// form1 control. /// @@ -20,7 +22,7 @@ public partial class MedicoSel { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// txtApellido control. /// @@ -29,7 +31,7 @@ public partial class MedicoSel { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtApellido; - + /// /// txtNombre control. /// @@ -38,7 +40,7 @@ public partial class MedicoSel { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtNombre; - + /// /// btnBuscar control. /// @@ -47,7 +49,16 @@ public partial class MedicoSel { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnBuscar; - + + /// + /// lblErrorAPI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblErrorAPI; + /// /// gvMedico control. /// diff --git a/WebLab/Protocolos/ProcesaRenaper.aspx.cs b/WebLab/Protocolos/ProcesaRenaper.aspx.cs index ca2083d8..b9031bc8 100644 --- a/WebLab/Protocolos/ProcesaRenaper.aspx.cs +++ b/WebLab/Protocolos/ProcesaRenaper.aspx.cs @@ -12,7 +12,7 @@ using System.Web.Script.Serialization; using Business.Data; using NHibernate; -using Business.Data.Laboratorio; +using Business.Data.Laboratorio; using NHibernate.Expression; using System.Collections; using System.Data; @@ -24,6 +24,7 @@ using System.Net.Http; using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography; +using Newtonsoft.Json; namespace WebLab.Protocolos { @@ -280,7 +281,8 @@ protected void Page_Load(object sender, EventArgs e) if (!conOK)// si no funcionó la conexion con renaper se fija se está activado MPI if (oCon.ConectaMPI) { - conOK = SolicitarServicioMPI(); + // conOK = SolicitarServicioMPI(); + conOK = ConectarMPIXRoad(); if (!conOK) HabilitaCargaManual(); } @@ -289,7 +291,8 @@ protected void Page_Load(object sender, EventArgs e) { if (oCon.ConectaMPI) { - conOK = SolicitarServicioMPI(); + conOK = ConectarMPIXRoad(); + ///conOK = SolicitarServicioMPI(); if (!conOK) HabilitaCargaManual(); } @@ -767,6 +770,158 @@ private bool SolicitarServicio() return ok; } + private bool ConectarMPIXRoad() + { + bool ok = false; + try + { + string tipo = "MPI"; + imgAndes.Visible = false; + imgRenaper.Visible = false; lblFechaDomicilio.Visible = false; + GrabarLogAcceso(tipo, Request["dni"].ToString()); + + long nrodocumento = long.Parse(Request["dni"].ToString()); + // string sexo = Request["sexo"].ToString(); + + string rutaCert = ConfigurationManager.AppSettings["RutaCert"].ToString(); + string BaseUrl = "https://xroadss.andes.gob.ar/r1/OPTIC/GOB/GOB00008/GP-SALUD/MPI";///ConfigurationManager.AppSettings["BaseUrlXroad"].ToString(); + string Serv = "?identifier=http://www.renaper.gob.ar;";// GP-RENAPER/WS_RENAPER_DOCUMENTO/"; + string clie = "OPTIC/GOB/GOB00008/GP-SALUD";//ConfigurationManager.AppSettings["ClienteXroad"].ToString();//"OPTIC/GOB/GOB00008/GP-SALUD/MPI";// + string param = nrodocumento.ToString(); ///+ "/" + sexo.ToUpper(); + string host = BaseUrl + Serv + param; + + ServicePointManager.Expect100Continue = true; + ServicePointManager.ServerCertificateValidationCallback = (snder, cert, chain, error) => true; + // ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(host); + + //certificado + X509Certificate certificate = new X509Certificate(rutaCert, "", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet + | X509KeyStorageFlags.PersistKeySet); + + req.ClientCertificates = new X509CertificateCollection() { certificate }; + req.ContentType = "application/json"; + req.AllowAutoRedirect = true; + req.Timeout = 10 * 1000; + req.Method = "GET"; + req.Headers.Add("X-Road-Client", clie); + + + + + using (WebResponse response = req.GetResponse()) + { + JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); + + using (Stream strReader = response.GetResponseStream()) + { + + using (StreamReader objReader = new StreamReader(strReader)) + { + + string responseBody = objReader.ReadToEnd(); + + var lista = JsonConvert.DeserializeObject>(responseBody); + var resultado2 = lista?.FirstOrDefault(); + + if (resultado2 != null) + { + lblValidador.Visible = true; + lblValidador.Text = "Paciente VALIDADO POR " + tipo; + ok = true; + + txtDNI.Text = Request["dni"]?.ToString(); + + // Nombre y apellido + var nombreData = resultado2.Name?.FirstOrDefault(); + txtApellido.Text = nombreData?.Family?.FirstOrDefault()?.ToUpper() ?? ""; + txtNombre.Text = string.Join(" ", nombreData?.Given ?? new List()).ToUpper(); + + // Fecha nacimiento + txtFechaNacimiento.Value = resultado2.BirthDate.ToString("dd/MM/yyyy"); + + // Domicilio (toma el primero) + var direccion = resultado2.Address?.FirstOrDefault(); + + txtCalle.Value = direccion?.Line?.FirstOrDefault() ?? "SIN DATOS"; + txtCiudad.Value = string.IsNullOrEmpty(direccion?.City) ? "SIN DATOS" : direccion.City; + txtProvincia.Value = string.IsNullOrEmpty(direccion?.State) ? "SIN DATOS" : direccion.State; + txtPais.Value = string.IsNullOrEmpty(direccion?.Country) ? "SIN DATOS" : direccion.Country; + txtCodigoPostal.Value = string.IsNullOrEmpty(direccion?.PostalCode) ? "SIN DATOS" : direccion.PostalCode; + + // CUIL + txtCuil.Value = resultado2.Identifier? + .FirstOrDefault(x => x.System.Contains("cuil"))?.Value ?? ""; + + // Campos que ya no existen en este JSON + txtBarrio.Value = "SIN DATOS"; + fallecimiento.Text = ""; + fechaDomicilio.Text = ""; + + txtTelefono.Value = resultado2.Telecom? + .Where(x => x.System == "phone") + .OrderBy(x => x.Rank) + .FirstOrDefault() + ?.Value ?? "SIN DATOS"; + + var sexo = resultado2.Gender?.ToLower(); + + if (sexo == "female") + { + txtSexo.Value = "FEMENINO"; + ddlSexo.SelectedValue = "2"; + } + else if (sexo == "male") + { + txtSexo.Value = "MASCULINO"; + ddlSexo.SelectedValue = "3"; + } + else if (sexo == "other") + { + txtSexo.Value = "X"; + ddlSexo.SelectedValue = "0"; + } + else + { + txtSexo.Value = "SIN DATOS"; + ddlSexo.SelectedValue = "0"; + } + /// traer al paciente si no es nuevo, es modificacion + int id = Convert.ToInt32(Request.QueryString["id"]); + //datos del Paciente + Paciente pac = new Paciente(); + if (id != 0) pac = (Paciente)pac.Get(typeof(Paciente), id); + txtTelefono.Value = pac.InformacionContacto; + + + } + else + ok = false; + + + + } + response.Close(); + } + + } + + + } + catch (WebException ex) + { + ok = false; + string mensaje = ex.ToString(); + + } + + + return ok; + + } + public void GrabarLogAcceso(string servicio, string dni) { try @@ -792,6 +947,83 @@ INSERT INTO LAB_LogAccesoServicio { } } + public class ResultadoMPIModel + { + [JsonProperty("resourceType")] + public string ResourceType { get; set; } + + [JsonProperty("identifier")] + public List Identifier { get; set; } + + [JsonProperty("active")] + public bool Active { get; set; } + + [JsonProperty("name")] + public List Name { get; set; } + + [JsonProperty("telecom")] + public List Telecom { get; set; } + + [JsonProperty("gender")] + public string Gender { get; set; } + + [JsonProperty("birthDate")] + public DateTime BirthDate { get; set; } + + [JsonProperty("address")] + public List Address { get; set; } + } + public class IdentifierRenaper + { + [JsonProperty("system")] + public string System { get; set; } + + [JsonProperty("value")] + public string Value { get; set; } + } + public class NameRenaper + { + [JsonProperty("use")] + public string Use { get; set; } + + [JsonProperty("text")] + public string Text { get; set; } + + [JsonProperty("family")] + public List Family { get; set; } + + [JsonProperty("given")] + public List Given { get; set; } + } + public class TelecomRenaper + { + [JsonProperty("system")] + public string System { get; set; } // phone, email + + [JsonProperty("value")] + public string Value { get; set; } + + [JsonProperty("rank")] + public int Rank { get; set; } + } + public class AddressRenaper + { + [JsonProperty("line")] + public List Line { get; set; } + + [JsonProperty("city")] + public string City { get; set; } + + [JsonProperty("state")] + public string State { get; set; } + + [JsonProperty("postalCode")] + public string PostalCode { get; set; } + + [JsonProperty("country")] + public string Country { get; set; } + } + protected void btnConfirmar_Click(object sender, EventArgs e) { if (validadatos()) @@ -799,15 +1031,10 @@ protected void btnConfirmar_Click(object sender, EventArgs e) { if (validamail()) { - //Configuracion oC = new Configuracion(); - - //oC = (Configuracion)oC.Get(typeof(Configuracion), 1); // "IdEfector", oUser.IdEfector); - + Utility oUtil = new Utility(); - ////instancio el usuario - //Usuario us = new Usuario(); - //us = (Usuario)us.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString())); + int id = Convert.ToInt32(Request.QueryString["id"]); //datos del Paciente diff --git a/WebLab/Protocolos/ProtocoloEdit2.aspx b/WebLab/Protocolos/ProtocoloEdit2.aspx index 12b331e0..d633a85c 100644 --- a/WebLab/Protocolos/ProtocoloEdit2.aspx +++ b/WebLab/Protocolos/ProtocoloEdit2.aspx @@ -235,6 +235,9 @@ + + + Cambiar Paciente  Datos del Paciente @@ -397,10 +400,10 @@ - - + + @@ -451,11 +454,11 @@ - + + ToolTip="Seleccione el caracter" TabIndex="14" Width="200px" class="form-control input-sm"> @@ -493,7 +496,7 @@ -
+
@@ -574,11 +577,7 @@
-
- - Impresora de Etiquetas: - -
+ @@ -644,7 +643,7 @@ Diagnósticos encontrados + class="form-control input-sm" Height="90px" Width="750px"> @@ -661,18 +660,11 @@ - - -

Diagnósticos del Paciente

- - -   - - + Diagnósticos del Paciente + Height="90px" Width="750px" SelectionMode="Multiple"> @@ -690,18 +682,32 @@   + onkeyup="mascara(this,'/',patron,true)" tabindex="1" class="form-control input-sm" title="Fecha de inicio de sintomas" />        + onkeyup="mascara(this,'/',patron,true)" tabindex="1" class="form-control input-sm" title="Fecha de Ultimo Control" />
  + + + + +
+ + + + + + +
+ + @@ -794,7 +800,13 @@ - +
+
+ + + +
+ @@ -857,597 +869,728 @@ + + + - - - + + + diff --git a/WebLab/Protocolos/ProtocoloEdit2.aspx.cs b/WebLab/Protocolos/ProtocoloEdit2.aspx.cs index 9b1513ac..26e0d81c 100644 --- a/WebLab/Protocolos/ProtocoloEdit2.aspx.cs +++ b/WebLab/Protocolos/ProtocoloEdit2.aspx.cs @@ -141,7 +141,9 @@ protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) - { + { + Session["matricula"] = ""; //para que lo borre de la sesion al entrar a un nuevo protocolo + Session["apellidoNombre"] = null; SetToken(); PreventingDoubleSubmit(btnGuardar); if (Session["idUsuario"] != null) @@ -178,6 +180,11 @@ protected void Page_Load(object sender, EventArgs e) pnlNavegacion.Visible = false; } + + if(Request["idPaciente"] != null) //Cambio de paciente + { + HFModificarPaciente.Value = "Si"; + } } else @@ -249,7 +256,6 @@ protected void Page_Load(object sender, EventArgs e) } if (Request["Operacion"].ToString() == "AltaDerivacionMultiEfector" ) { - int numeroProtocolo = int.Parse(Session["numeroProtocolo"].ToString()); Business.Data.Laboratorio.Protocolo oRegistro = new Business.Data.Laboratorio.Protocolo(); oRegistro = (Business.Data.Laboratorio.Protocolo)oRegistro.Get(typeof(Business.Data.Laboratorio.Protocolo), "Numero", numeroProtocolo); @@ -790,6 +796,9 @@ private void MuestraDatos() oRegistro = (Business.Data.Laboratorio.Protocolo)oRegistro.Get(typeof(Business.Data.Laboratorio.Protocolo), int.Parse(Request["idProtocolo"].ToString())); if (oRegistro != null) { + // si es modificacion no se recuerda analisis + chkRecordarPractica.Visible = false; + //fin si es modificacion no se recuerda analisis oRegistro.GrabarAuditoriaProtocolo("Consulta", int.Parse(Session["idUsuario"].ToString())); if (oRegistro.IdTipoServicio.IdTipoServicio == 6) { @@ -1025,7 +1034,8 @@ private void MuestraDatos() MostrarDiagnosticos(oRegistro); - + //muestra enfermedad base + MostrarEnfermedadBase(oRegistro); //chkRecordarConfiguracion.Checked = false; @@ -1049,9 +1059,9 @@ private void MostrarDiagnosticos(Protocolo oRegistro) { string m_strSQL = @"select c.id, c.codigo + ' -' + c.nombre -from sys_cie10 c (nolock) -inner join LAB_ProtocoloDiagnostico pd (nolock) on c.id = pd.idDiagnostico -where pd.idProtocolo=" + oRegistro.IdProtocolo.ToString(); +from sys_cie10 c with (nolock) +inner join LAB_ProtocoloDiagnostico pd with (nolock) on c.id = pd.idDiagnostico +where pd.tipo='D' and pd.idProtocolo=" + oRegistro.IdProtocolo.ToString(); DataSet Ds = new DataSet(); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString); ///Performance: conexion de solo lectura @@ -1105,12 +1115,16 @@ private void MostrarDeterminaciones(Protocolo oRegistro) crit.AddOrder(Order.Asc("IdDetalleProtocolo")); IList items = crit.List(); - string pivot = ""; + string pivot = ""; string sDatos = ""; - + HashSet pivote = new HashSet(); + foreach (DetalleProtocolo oDet in items) { - if (pivot != oDet.IdItem.Nombre) + //Debo cambiar la manera que verifica los repetidos, porque ahora cuando se regenera un subItem el IdDetalleProtocolo no es secuencial + //Y en la vista del protocolo se ve "duplicado" + //if (pivot != oDet.IdItem.Nombre) + if (pivote.Add(oDet.IdItem.Nombre)) // Si Add devuelve True es porque lo agrego porque no hay duplicados { /*if (sDatos == "") sDatos = oDet.IdItem.Codigo + "#" + oDet.TrajoMuestra + "#" + oDet.ConResultado; @@ -1143,8 +1157,40 @@ private void MostrarDeterminaciones(Protocolo oRegistro) } + private void MostrarEnfermedadBase(Protocolo oRegistro) + { + + Utility oUtil = new Utility(); + string m_strSQL = @"select top 1 c.id, c.codigo +from sys_cie10 c with (nolock) +inner join LAB_ProtocoloDiagnostico pd with (nolock) on c.id = pd.idDiagnostico +where pd.tipo='B' and pd.idProtocolo=" + oRegistro.IdProtocolo.ToString(); + + DataSet Ds = new DataSet(); + SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString); ///Performance: conexion de solo lectura + SqlDataAdapter adapter = new SqlDataAdapter(); + adapter.SelectCommand = new SqlCommand(m_strSQL, conn); + adapter.Fill(Ds); + + for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) + { + if (!oC.HabilitaEnfermedadBase) + { + CargarListaEnfermedadesBase(); + + } + string s_id=Ds.Tables[0].Rows[i][0].ToString(); + string s_codigo= Ds.Tables[0].Rows[i][1].ToString(); + ddlEnfermedadBase.SelectedValue = s_id; + txtCodigoEnfermedadBase.Text = s_codigo; + txtCodigoEnfermedadBase.UpdateAfterCallBack=true; + ddlEnfermedadBase.UpdateAfterCallBack = true; + + } + + } + - @@ -1284,30 +1330,7 @@ private void CargarListas() string connReady = ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString; ///Performance: conexion de solo lectura ddlMuestra.Items.Insert(0, new ListItem("--Seleccione Muestra--", "0")); - pnlMuestra.Visible = false; - - //if (int.Parse(Session["idServicio"].ToString()) == 1) - //{ - // pnlComprobantePaciente.Visible = oC.GeneraComprobanteProtocolo; - // lblImprimeComprobantePaciente.Enabled = oC.GeneraComprobanteProtocolo; - // chkImprimir.Enabled = oC.GeneraComprobanteProtocolo; - // ddlImpresora.Enabled = oC.GeneraComprobanteProtocolo; - // lnkReimprimirComprobante.Enabled = oC.GeneraComprobanteProtocolo; - // lnkReimprimirCodigoBarras.Enabled = oC.GeneraComprobanteProtocolo; - - //} - - //if (int.Parse(Session["idServicio"].ToString()) == 3) - //{ - // pnlComprobantePaciente.Visible = oC.GeneraComprobanteProtocoloMicrobiologia; - // lblImprimeComprobantePaciente.Enabled = oC.GeneraComprobanteProtocoloMicrobiologia; - // chkImprimir.Enabled = oC.GeneraComprobanteProtocoloMicrobiologia; - // ddlImpresora.Enabled = oC.GeneraComprobanteProtocoloMicrobiologia; - // lnkReimprimirComprobante.Enabled = oC.GeneraComprobanteProtocoloMicrobiologia; - // lnkReimprimirCodigoBarras.Enabled = oC.GeneraComprobanteProtocoloMicrobiologia; - //} - - + pnlMuestra.Visible = false; ///Carga de combos de tipos de servicios @@ -1317,15 +1340,33 @@ private void CargarListas() ///Carga de grupos de numeración solo si el tipo de numeración es 2: por Grupos - string m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio with (nolock) WHERE (baja = 0) order by nombre"; + //string m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio with (nolock) WHERE (baja = 0) order by nombre"; + + //oUtil.CargarCombo(ddlSectorServicio, m_ssql, "idSectorServicio", "nombre", connReady); + //ddlSectorServicio.Items.Insert(0, new ListItem("Seleccione", "0")); + //if (oC.IdSectorDefecto > 0) + //{ + // ddlSectorServicio.SelectedValue = oC.IdSectorDefecto.ToString(); + // // ddlSectorServicio.Visible = false; + //} + + ///Carga de grupos de numeración solo si el tipo de numeración es 2: por Grupos + string str_condicion = ")"; + if ((Request["Operacion"].ToString() == "Modifica") && (Request["idProtocolo"]!=null)) + str_condicion = " or exists (select 1 from LAB_Protocolo p WHERE p.idsector = s.idSectorServicio and idProtocolo = " + Request["idProtocolo"].ToString() + ")) "; + + + string m_ssql = @"SELECT s.idSectorServicio, s.prefijo + ' - ' + s.nombre as nombre FROM LAB_SectorServicio S with (nolock) + WHERE (baja = 0) + and ( exists (select 1 from Lab_SectorServicioEfector SE where SE.idSectorServicio=S.idSectorServicio and se.idefector="+oUser.IdEfector.IdEfector.ToString()+@" )" + str_condicion +@" order by nombre"; oUtil.CargarCombo(ddlSectorServicio, m_ssql, "idSectorServicio", "nombre", connReady); ddlSectorServicio.Items.Insert(0, new ListItem("Seleccione", "0")); - if (oC.IdSectorDefecto > 0) + /* if (oC.IdSectorDefecto > 0) { ddlSectorServicio.SelectedValue = oC.IdSectorDefecto.ToString(); - // ddlSectorServicio.Visible = false; - } + // ddlSectorServicio.Visible = false; + }*/ /////////////////////////////////////////////CODIGO DE BARRAS////////////////////////////////////////////////////////////////////// tab3Titulo.Visible = false; @@ -1445,7 +1486,14 @@ inner join lab_item P with (nolock) on dp.idsubitem = p.iditem m_ssql += " order by nombre "; oUtil.CargarCombo(ddlMuestra, m_ssql, "idMuestra", "nombre", connReady); ddlMuestra.Items.Insert(0, new ListItem("--Seleccione Muestra--", "0")); - + + ////Carga de combo de enfermedad base + if (oC.HabilitaEnfermedadBase) + { + CargarListaEnfermedadesBase(); + + } + else pnlEnfermedadBase.Visible = false; } @@ -1472,17 +1520,21 @@ inner join lab_item P with (nolock) on dp.idsubitem = p.iditem - - - m_ssql = "SELECT idCaracter, nombre FROM LAB_Caracter with (nolock) "; - oUtil.CargarCombo(ddlCaracter, m_ssql, "idCaracter", "nombre", connReady); - ddlCaracter.Items.Insert(0, new ListItem("--Seleccione Caracteristica--", "0")); - - if ((ddlCaracter.Items.Count > 1) && (oUser.IdEfector.IdEfector==228) )///Se agrega control exclusivo para Laboratorio Central + if (Session["idServicio"].ToString() == "3")///Se agrega para todos los efectores y solo para servicio microbiologia { - lblCaracterSisa.Visible = true; - ddlCaracter.Visible = true; + m_ssql = "SELECT idCaracter, nombre FROM LAB_Caracter with (nolock) "; + oUtil.CargarCombo(ddlCaracter, m_ssql, "idCaracter", "nombre", connReady); + ddlCaracter.Items.Insert(0, new ListItem("--Seleccione Caracteristica--", "0")); + + //if ((ddlCaracter.Items.Count > 1) && (oUser.IdEfector.IdEfector==228) )///Se agrega control exclusivo para Laboratorio Central + if (ddlCaracter.Items.Count > 1) ///Se agrega para todos los efectores y solo para servicio microbiologia + { + lblCaracterSisa.Visible = true; + ddlCaracter.Visible = true; + } } + else + ddlCaracter.Items.Insert(0, new ListItem("", "0")); ////////////////////////////Carga de combos de ObraSocial////////////////////////////////////////// //m_ssql = "SELECT idObraSocial, nombre AS nombre FROM Sys_ObraSocial order by idObraSocial "; //oUtil.CargarCombo(ddlObraSocial, m_ssql, "idObraSocial", "nombre"); @@ -1559,6 +1611,19 @@ inner join lab_item P with (nolock) on dp.idsubitem = p.iditem oUtil = null; } + private void CargarListaEnfermedadesBase() + { + Utility oUtil = new Utility(); + //Configuracion oC = new Configuracion(); oC = (Configuracion)oC.Get(typeof(Configuracion), "IdConfiguracion", 1); + + string connReady = ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString; ///Performance: conexion de solo lectura + + pnlEnfermedadBase.Visible = true; + string m_ssql = @"select id as idDiag, nombre + ' - ' + codigo as nombre from sys_cie10 with (nolock) where tipo='BASE' order by nombre "; + oUtil.CargarCombo(ddlEnfermedadBase, m_ssql, "idDiag", "nombre", connReady); + ddlEnfermedadBase.Items.Insert(0, new ListItem("--Seleccione Enfermedad Base--", "0")); + } + private void IniciarValores(Configuracion oC) { if (Session["ProtocoloLaboratorio"] != null) @@ -1654,8 +1719,8 @@ private void IniciarValores(Configuracion oC) chkRecordarPractica.Checked = true; } break; - case "prácticas": - TxtDatosCargados.Value = s_control[1].ToString(); break; + case "prácticas": if(Request["idServicio"] == "1") TxtDatosCargados.Value = s_control[1].ToString(); break; + case "prácticasMicro": if(Request["idServicio"] == "3") TxtDatosCargados.Value = s_control[1].ToString(); break; //case "ddlImpresora": // ddlImpresora.SelectedValue = s_control[1].ToString(); break; @@ -1743,9 +1808,11 @@ protected void btnGuardar_Click(object sender, EventArgs e) /// actualiza al paciente con la ultima obra social guardada: solo en las altas + /* No es necesario siempre se guarda -1 con el sil2 oRegistro.IdPaciente.IdObraSocial = oRegistro.IdObraSocial.IdObraSocial; oRegistro.IdPaciente.FechaUltimaActualizacion = DateTime.Now; oRegistro.IdPaciente.Save(); + */ if (ddlImpresoraEtiqueta.SelectedValue != "0") // oRegistro.ImprimirCodigoBarras(ddlImpresoraEtiqueta.SelectedItem.Text, int.Parse(Session["idUsuario"].ToString())); @@ -1765,9 +1832,7 @@ protected void btnGuardar_Click(object sender, EventArgs e) } - - ///////////////// - + EnviarEquipo(oRegistro); ///Imprimir codigo de barras. //string s_AreasCodigosBarras = getListaAreasCodigoBarras(); @@ -1883,10 +1948,54 @@ protected void btnGuardar_Click(object sender, EventArgs e) } + private void EnviarEquipo(Protocolo oRegistro) + { + /* + Caro: Primer version para enviar de forma automatica (sin intervencion del usuario) muestras el equipo. + En este caso para el equipo REAL: Si el servicio es micro solo para los efectores 205 y 221 (HPN y HEller) + Se debe mejorar para algo mas generico + Se agrega try/cath para que ante cualquier problema no haya inconvenientes con el ingreso de la muestra + */ + + try + { + if ((oRegistro.IdTipoServicio.IdTipoServicio == 3) && + (oRegistro.IdEfector.IdEfector == 205 || oRegistro.IdEfector.IdEfector == 221)) + { + using (SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection) + { + + using (SqlCommand cmd = new SqlCommand("dbo.LAB_GeneraProtocoloEnvioAutomaticoREAL", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + + // Parámetros del SP + cmd.Parameters.AddWithValue("@idEfector", oRegistro.IdEfector.IdEfector); + cmd.Parameters.AddWithValue("@idProtocolo", oRegistro.IdProtocolo); + + // Ejecuta sin devolver resultados + cmd.ExecuteNonQuery(); + } + } + } + } + catch (Exception ex) + { + string exception = ""; + exception = ex.Message + "
"; + } + } + private void ActualizarEstadoDerivacion(Protocolo oRegistro, Protocolo oRegistroAnterior) { - Business.Data.Laboratorio.Derivacion oDerivacion = new Business.Data.Laboratorio.Derivacion(); - oDerivacion.MarcarComoRecibidas(oRegistroAnterior,oRegistro, oUser, Convert.ToInt32(Request["idLote"])); + + DetalleProtocolo dp = new DetalleProtocolo(); + dp.ActualizarItemsDerivados(oRegistro, oRegistroAnterior, Convert.ToInt32(Request["idLote"]), oUser); + + //Business.Data.Laboratorio.Derivacion oDerivacion = new Business.Data.Laboratorio.Derivacion(); + //oDerivacion.MarcarComoRecibidas(oRegistroAnterior,oRegistro, oUser, Convert.ToInt32(Request["idLote"])); + //Business.Data.Laboratorio.DetalleProtocolo oDetalle = new Business.Data.Laboratorio.DetalleProtocolo(); + //oDetalle.ActualizoResultado(oRegistro, oRegistroAnterior,Convert.ToInt32(Request["idLote"])); } private string getListaAreasCodigoBarras() @@ -2317,6 +2426,8 @@ private bool Guardar(Business.Data.Laboratorio.Protocolo oRegistro) // if (Request["idSolicitudScreening"] != null) ActualizarSolicitudScreening(Request["idSolicitudScreening"].ToString(),oRegistro); GuardarDiagnosticos(oRegistro); + if (oRegistro.IdTipoServicio.IdTipoServicio==3) GuardarEnfermedadBase(oRegistro); + GuardarDetalle(oRegistro); //GuardarDiagnosticos(oRegistro); this.IncidenciaEdit1.GuardarProtocoloIncidencia(oRegistro); @@ -2423,6 +2534,63 @@ private bool Guardar(Business.Data.Laboratorio.Protocolo oRegistro) return guardo; } + + + + private void GuardarEnfermedadBase(Protocolo oRegistro) + { + if ((ddlEnfermedadBase.SelectedValue != "0")&& (ddlEnfermedadBase.SelectedValue != "")) + { + int nuevoIdDiagnostico = int.Parse(ddlEnfermedadBase.SelectedValue); + string nuevoNombre = ddlEnfermedadBase.SelectedItem.Text; + string accion = "Graba"; + + ISession m_session = NHibernateHttpModule.CurrentSession; + + // Buscar si ya existe un registro de enfermedad base + ICriteria crit = m_session.CreateCriteria(typeof(ProtocoloDiagnostico)); + crit.Add(Expression.Eq("IdProtocolo", oRegistro)); + crit.Add(Expression.Eq("Tipo", "B")); // enfermedad base + IList detalleExistente = crit.List(); + + if (detalleExistente.Count > 0) + { + ProtocoloDiagnostico existente = (ProtocoloDiagnostico)detalleExistente[0]; + + // Verificar si es distinto al seleccionado + if (existente.IdDiagnostico != nuevoIdDiagnostico) + { + // Eliminar el registro anterior + existente.Delete(); + + // Crear el nuevo registro + ProtocoloDiagnostico oDetalle = new ProtocoloDiagnostico(); + oDetalle.IdProtocolo = oRegistro; + oDetalle.IdEfector = oRegistro.IdEfector; + oDetalle.IdDiagnostico = nuevoIdDiagnostico; + oDetalle.Tipo = "B"; + oDetalle.Save(); + + accion = "Cambia"; + oDetalle.IdProtocolo.GrabarAuditoriaDetalleProtocolo(accion, int.Parse(Session["idUsuario"].ToString()), "Enfermedad Base", nuevoNombre); + } + // Si es igual, no hacer nada + } + else + { + // No existe registro previo, crear uno nuevo + ProtocoloDiagnostico oDetalle = new ProtocoloDiagnostico(); + oDetalle.IdProtocolo = oRegistro; + oDetalle.IdEfector = oRegistro.IdEfector; + oDetalle.IdDiagnostico = nuevoIdDiagnostico; + oDetalle.Tipo = "B"; + oDetalle.Save(); + + oDetalle.IdProtocolo.GrabarAuditoriaDetalleProtocolo(accion, int.Parse(Session["idUsuario"].ToString()), "Enfermedad Base", nuevoNombre); + } + } + } + //private void ActualizarSolicitudScreening(string p, Protocolo oProtocolo) //{ // SolicitudScreening oRegistro = new SolicitudScreening(); @@ -2478,13 +2646,42 @@ private void AlmacenarSesion(Configuracion oC) { s_valores += "@ddlSectorServicio:" + ddlSectorServicio.SelectedValue; } +///caro: ver si dejar + if (chkRecordarPractica.Checked) + {//guardo la sesion de general y microbiologia por si vuelvo a cargar esos tipos de labos, luego en GuardarDetalle se actualizan si el usuario lo cambio + if(Session["ProtocoloLaboratorio"] != null) + { + string[] arr = Session["ProtocoloLaboratorio"].ToString().Split(("@").ToCharArray()); + foreach (string item in arr) + { + string[] s_control = item.Split((":").ToCharArray()); + switch (s_control[0].ToString()) { + + case "prácticas": + string practicas = "@prácticas:" + s_control[1].ToString(); + if (Request["idServicio"] == "1") + s_valores = s_valores.Replace(practicas, ""); //si es laboratorio general lo borro y lo cargo en GuardarDetalle. + else + s_valores += practicas; //si no es laboratorio general no quiero perder su session "prácticas" + break; + case "prácticasMicro": + string practicasMicro = "@prácticasMicro:" + s_control[1].ToString(); + if (Request["idServicio"] != "3") //si no es microbiologia no quiero perder su session "prácticasMicro" + s_valores += "@prácticasMicro:" + s_control[1].ToString(); + else + s_valores = s_valores.Replace(practicasMicro, ""); //si es micro lo borro y lo cargo en GuardarDetalle. + break; + } + } + } + } Session["ProtocoloLaboratorio"] = s_valores; } - private void GuardarDiagnosticos(Business.Data.Laboratorio.Protocolo oRegistro) + private void GuardarDiagnosticos_ant(Business.Data.Laboratorio.Protocolo oRegistro) { string embarazada = ""; string accion = "Graba"; // dtDiagnosticos = (System.Data.DataTable)(Session["Tabla2"]); @@ -2549,7 +2746,80 @@ private void GuardarDiagnosticos(Business.Data.Laboratorio.Protocolo oRegistro) } - + private void GuardarDiagnosticos(Business.Data.Laboratorio.Protocolo oRegistro) + { + string embarazada = ""; + string accion = "Graba"; + + // Obtener lista de diagnósticos actuales + ISession m_session = NHibernateHttpModule.CurrentSession; + ICriteria crit = m_session.CreateCriteria(typeof(ProtocoloDiagnostico)); + crit.Add(Expression.Eq("IdProtocolo", oRegistro)); + crit.Add(Expression.Eq("Tipo", "D")); + IList detalleActual = crit.List(); + + // Crear lista de IDs de los diagnósticos nuevos + List listaNueva = new List(); + for (int i = 0; i < lstDiagnosticosFinal.Items.Count; i++) + { + listaNueva.Add(int.Parse(lstDiagnosticosFinal.Items[i].Value)); + } + + // Comparar si hay cambios + bool hayCambios = false; + + if (detalleActual.Count != listaNueva.Count) + hayCambios = true; + else + { + foreach (ProtocoloDiagnostico oDetalle in detalleActual) + { + if (!listaNueva.Contains(oDetalle.IdDiagnostico)) + { + hayCambios = true; + break; + } + } + } + + if (hayCambios) + { + // Eliminar diagnósticos antiguos + foreach (ProtocoloDiagnostico oDetalle in detalleActual) + { + oDetalle.Delete(); + } + accion = "Cambia"; + + // Guardar los nuevos diagnósticos + string listaDx = ""; + for (int i = 0; i < lstDiagnosticosFinal.Items.Count; i++) + { + ProtocoloDiagnostico oDetalle = new ProtocoloDiagnostico(); + oDetalle.IdProtocolo = oRegistro; + oDetalle.IdEfector = oRegistro.IdEfector; + oDetalle.IdDiagnostico = int.Parse(lstDiagnosticosFinal.Items[i].Value); + oDetalle.Tipo = "D"; + oDetalle.Save(); + + string s_diag = lstDiagnosticosFinal.Items[i].Text; + oDetalle.IdProtocolo.GrabarAuditoriaDetalleProtocolo( + accion, int.Parse(Session["idUsuario"].ToString()), "Diagnóstico", s_diag); + + embarazada = oDetalle.EsEmbarazada(); + + listaDx = listaDx == "" ? lstDiagnosticosFinal.Items[i].Value : listaDx + ";" + lstDiagnosticosFinal.Items[i].Value; + } + + if (embarazada == "E") + { + oRegistro.Embarazada = "S"; + oRegistro.Save(); + } + + Session["Dx"] = listaDx; + } + } private void GuardarDetalle(Business.Data.Laboratorio.Protocolo oRegistro) { @@ -2677,6 +2947,39 @@ private void GuardarDetalle(Business.Data.Laboratorio.Protocolo oRegistro) oDetalle.TrajoMuestra = "Si"; oDetalle.GrabarAuditoriaDetalleProtocolo("Con Muestra", oUser.IdUsuario); oDetalle.Save(); + + /* Bug sobre la edición de determinaciones con la marca “sin muestraâ€: + * Si se genero el protocolo con un analisis "S/muestra" de una practica no se generan los idItem del diagrama + * (porque GuardarDetallePractica solo actualizaba TrajoMuestra del codigo de la practica) + * Correcion: si en protocolo se cambia a "Con muestra",se regeneran los detalles faltantes de la practica + */ + + if (oDetalle.IdItem == oDetalle.IdSubItem) + { + /* Si ValidadoTotal (en ProtocoloEdit2) cargó idUsuarioValida por un caso de + * "sin muestra" se debe resetear idUsuarioValida para evitar inconsistencias + */ + + //Caso 1: el análisis aún no tiene resultados (simple o compuesto), + if (!oDetalle.ConResultado) + { + oDetalle.IdUsuarioValida = 0; + oDetalle.FechaValida = DateTime.Parse("01/01/1900"); + } + + //Caso 2: Es derivacion. + //Los analisis Derivados no tienen IdUsuarioValida, solo idUsuarioResultado + + if (oDetalle.ResultadoCar == "Pendiente de derivar") + { + oDetalle.IdUsuarioValida = 0; + oDetalle.FechaValida = DateTime.Parse("01/01/1900"); + } + if (oItem.IdCategoria == 1 ) + { + GuardarDetallePractica(oDetalle, true); //regenera=true --> se omite si es Derivacion para no generar una nueva Derivacion + } + } } } @@ -2690,7 +2993,17 @@ private void GuardarDetalle(Business.Data.Laboratorio.Protocolo oRegistro) if (Request["Operacion"].ToString() != "Modifica") { if (chkRecordarPractica.Checked) - Session["ProtocoloLaboratorio"] += "@prácticas:" + recordar_practicas; + { + //actualizo los analisis a recordar por IdTipoServicio + switch (oRegistro.IdTipoServicio.IdTipoServicio) + { + case 1: Session["ProtocoloLaboratorio"] += "@prácticas:" + recordar_practicas; /*labo general*/ break; + case 3: Session["ProtocoloLaboratorio"] += "@prácticasMicro:" + recordar_practicas; /*microbiologia*/ break; + } + + + + } } @@ -2857,11 +3170,11 @@ private void GuardarDetalle(Business.Data.Laboratorio.Protocolo oRegistro) - private void GuardarDetallePractica(DetalleProtocolo oDet) + private void GuardarDetallePractica(DetalleProtocolo oDet, bool regenera=false) { - - - if (oDet.VerificarSiEsDerivable(oUser.IdEfector)) //oDet.IdItem.IdEfector.IdEfector != oDet.IdItem.IdEfectorDerivacion.IdEfector) //Si es un item derivable no busca hijos y guarda directamente. + //Alta normal (regenera = false) --> el código funciona como antes + // Modificación con regeneración(regenera = true) --> se omite si es Derivacion para no generar una nueva Derivacion + if (!regenera && oDet.VerificarSiEsDerivable(oUser.IdEfector)) //oDet.IdItem.IdEfector.IdEfector != oDet.IdItem.IdEfectorDerivacion.IdEfector) //Si es un item derivable no busca hijos y guarda directamente. { oDet.IdSubItem = oDet.IdItem; oDet.Save(); @@ -3037,11 +3350,6 @@ protected void ddlSexo_SelectedIndexChanged(object sender, EventArgs e) - protected void txtCodigo_TextChanged(object sender, EventArgs e) - { - - } - protected void ddlItem_SelectedIndexChanged(object sender, EventArgs e) { ///////Con la selección del item se muestra el codigo @@ -3128,11 +3436,6 @@ private void SacarDiagnostico() - protected void txtCodigo_TextChanged1(object sender, EventArgs e) - { - - } - protected void btnCancelar_Click(object sender, EventArgs e) { if (Request["Operacion"].ToString() == "Modifica") @@ -3346,71 +3649,7 @@ private void SelectedEfector() } - //private void CargarSolicitantesInternos() - //{ - // Utility oUtil = new Utility(); - // ///Carga de combos de Medicos Solicitantes - // string m_ssql = "SELECT idProfesional, apellido + ' ' + nombre AS nombre FROM Sys_Profesional ORDER BY apellido, nombre "; - // oUtil.CargarCombo(ddlEspecialista, m_ssql, "idProfesional", "nombre"); - // ddlEspecialista.Items.Insert(0, new ListItem("No identificado", "0")); - // ddlEspecialista.UpdateAfterCallBack = true; - // //imgCrearSolicitante.Visible = false; - // //imgCrearSolicitante.UpdateAfterCallBack = true; - //} - - //private void CargarSolicitantesExternos(string m_solicitante) - //{ - // Utility oUtil = new Utility(); - - // ///Carga de combos de solicitantes expertos - // string m_ssql = "select idSolicitanteExterno, apellido + ', ' + nombre as nombre from Lab_SolicitanteExterno where baja=0 order by apellido, nombre"; - // oUtil.CargarCombo(ddlEspecialista, m_ssql, "idSolicitanteExterno", "nombre"); - // ddlEspecialista.Items.Insert(0, new ListItem("No identificado", "0")); - // if (m_solicitante != "") ddlEspecialista.SelectedValue = m_solicitante; - // ddlEspecialista.UpdateAfterCallBack = true; - // //imgCrearSolicitante.Visible = true; - // //imgCrearSolicitante.UpdateAfterCallBack = true; - //} - - //protected void btnGuardarSolicitante_Click(object sender, EventArgs e) - //{ - // if (Page.IsValid) - // { - // GuardarSolicitanteExterno(); - - // LimpiarDatosSolicitante(); - // //Panel1.Visible = false; - // //Panel1.UpdateAfterCallBack = true; - // } - //} - - //private void GuardarSolicitanteExterno() - //{ - // Usuario oUser = new Usuario(); - // SolicitanteExterno oRegistro = new SolicitanteExterno(); - // Configuracion oC = new Configuracion(); oC = (Configuracion)oC.Get(typeof(Configuracion), "IdConfiguracion", 1); - // oRegistro.IdEfector = oC.IdEfector; - // oRegistro.Matricula = txtMatricula.Text; - // oRegistro.Apellido = txtApellidoSolicitante.Text; - // oRegistro.Nombre = txtNombreSolicitante.Text; - // oRegistro.IdUsuarioRegistro = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString())); - // oRegistro.FechaRegistro = DateTime.Now; - // oRegistro.Save(); - // CargarSolicitantesExternos(oRegistro.IdSolicitanteExterno.ToString()); - //} - - //protected void btnCancelarSolicitante_Click(object sender, EventArgs e) - //{ - // LimpiarDatosSolicitante(); - - //} - - //private void LimpiarDatosSolicitante() - //{ - // txtMatricula.Text = ""; - // txtApellidoSolicitante.Text = ""; - // txtNombreSolicitante.Text = ""; - //} + protected void gvLista_SelectedIndexChanged(object sender, EventArgs e) { @@ -3423,7 +3662,10 @@ protected void txtCodigoDiagnostico_TextChanged(object sender, EventArgs e) //BuscarCodigoDiagnostico(); } - + private bool ExisteItem(ListControl lista, string value) + { + return lista.Items.FindByValue(value) != null; + } private void BuscarCodigoDiagnostico() { @@ -3435,7 +3677,7 @@ private void BuscarCodigoDiagnostico() if (oC.NomencladorDiagnostico == 0) /// Cie10 { - string m_strSQL = @"select id, codigo + ' -' + nombre from sys_cie10 with (nolock) where CODIGO like '%" + txtCodigoDiagnostico.Text.Trim() + "%'"; + string m_strSQL = @"select id, codigo + ' -' + nombre from sys_cie10 with (nolock) where tipo='DIAG' and CODIGO like '%" + txtCodigoDiagnostico.Text.Trim() + "%'"; DataSet Ds = new DataSet(); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString); ///Performance: conexion de solo lectura @@ -3443,7 +3685,8 @@ private void BuscarCodigoDiagnostico() adapter.SelectCommand = new SqlCommand(m_strSQL, conn); adapter.Fill(Ds); lstDiagnosticos.Items.Clear(); - for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) + int cantDiag = Ds.Tables[0].Rows.Count; + for (int i = 0; i < cantDiag; i++) { ListItem oDia = new ListItem(); @@ -3451,15 +3694,22 @@ private void BuscarCodigoDiagnostico() oDia.Value = Ds.Tables[0].Rows[i][0].ToString(); lstDiagnosticos.Items.Add(oDia); - + if (cantDiag == 1) //Si encuentra por codigo un unico diagnsotico se pasa automatico a diagnostico del paciente para evitar mas clic: sug. H. Plottier + { + // lstDiagnosticosFinal.Items.Clear(); + if (!ExisteItem(lstDiagnosticosFinal, oDia.Value)) + { + lstDiagnosticosFinal.Items.Add(oDia); + lstDiagnosticosFinal.UpdateAfterCallBack = true; + } + + + } } - - - - + } else /// diagnostico propio { @@ -3545,21 +3795,10 @@ private void BuscarNombreDiagnostico() ISession m_session = NHibernateHttpModule.CurrentSession; if (oC.NomencladorDiagnostico == 0) { - //ICriteria crit = m_session.CreateCriteria(typeof(Cie10)); - //crit.Add(Expression.Sql(" Nombre like '%" + txtNombreDiagnostico.Text + "%' order by Nombre")); - - //IList items = crit.List(); - - //foreach (Cie10 oDiagnostico in items) - //{ - // ListItem oDia = new ListItem(); - // oDia.Text = oDiagnostico.Codigo + " - " + oDiagnostico.Nombre; - // oDia.Value = oDiagnostico.Id.ToString(); - // lstDiagnosticos.Items.Add(oDia); - //} + - string m_strSQL = @"select id, codigo + ' -' + nombre from sys_cie10 (nolock) where Nombre like '%" + txtNombreDiagnostico.Text.Trim() + "%' order by Nombre"; + string m_strSQL = @"select id, codigo + ' -' + nombre from sys_cie10 (nolock) where tipo='DIAG' and Nombre like '%" + txtNombreDiagnostico.Text.Trim() + "%' order by Nombre"; DataSet Ds = new DataSet(); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SIL_ReadOnly"].ConnectionString); ///Performance: conexion de solo lectura @@ -3669,11 +3908,10 @@ protected void cvAnalisis_ServerValidate(object source, ServerValidateEventArgs } - protected void cvValidacionInput_ServerValidate_vane(object source, ServerValidateEventArgs args) + protected void cvValidacionInput_ServerValidate(object source, ServerValidateEventArgs args) { - string[] bk = TxtDatosCargados.Value.Split(';'); - + TxtDatosCargados.Value = TxtDatos.Value; string sDatos = ""; @@ -3683,20 +3921,19 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida for (int i = 0; i < tabla.Length - 1; i++) { string[] fila = tabla[i].Split('#'); - string codigo = fila[1].ToString(); - string muestra= fila[2].ToString(); - string conResultado = "false"; - //Cargo el valor del resultado para no perderlo si da error la validacion - if (i < bk.Length && bk.Length > 1) //TxtDatosCargados en Alta no tiene valores! - { - string[] filaBk = bk[i].Split('#'); - conResultado = filaBk[2].ToString(); - } + string codigo = fila[1].ToString(); + string tarea = fila[2].ToString(); + string muestra= fila[3].ToString(); + string estado = "false"; + + if (tabla.Length > 1) //TxtDatosCargados en Alta no tiene valores! + estado = fila[4].ToString(); + if (sDatos == "") - sDatos = codigo + "#" + muestra + "#" + conResultado; + sDatos = codigo + "#" + muestra + "#" + estado; else - sDatos += ";" + codigo + "#" + muestra + "#" + conResultado; + sDatos += ";" + codigo + "#" + muestra + "#" + estado; } @@ -3715,7 +3952,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida // } if (!VerificarAnalisisContenidos() ) - { TxtDatos.Value = ""; + { //TxtDatos.Value = ""; args.IsValid = false; return; @@ -3727,7 +3964,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida /// - if ((TxtDatos.Value == "") || (TxtDatos.Value == "1###on@")) + if ((TxtDatos.Value == "") || (TxtDatos.Value == "1###on@") || (TxtDatos.Value == "1###on#0@") || TxtDatos.Value == "1###false#0@") { args.IsValid = false; @@ -3741,7 +3978,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if (oC.DiagObligatorio) {if (lstDiagnosticosFinal.Items.Count == 0) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar al menos un diagnóstico presuntivo del paciente"; return; @@ -3751,7 +3988,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida ///Validacion de la fecha de protocolo if (txtFecha.Value == "") { - TxtDatos.Value = ""; + // TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar la fecha del protocolo"; return; @@ -3761,7 +3998,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if (DateTime.Parse(txtFecha.Value) > DateTime.Now) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La fecha del protocolo no puede ser superior a la fecha actual"; return; @@ -3773,7 +4010,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if ((ddlSectorServicio.SelectedValue == "0")) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar sector"; return; @@ -3781,7 +4018,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if ((ddlOrigen.SelectedValue == "0")) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar Origen"; return; @@ -3789,7 +4026,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if ((ddlPrioridad.SelectedValue == "0")) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar Prioridad"; return; @@ -3797,7 +4034,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if ((ddlMuestra.SelectedValue == "0") && (pnlMuestra.Visible)) { - TxtDatos.Value = ""; + // TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar Tipo de Muestra"; return; @@ -3809,7 +4046,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if ((VerificaRequiereCaracter(sDatos)) && (ddlCaracter.SelectedValue == "0")) //if ((sDatos.Contains(oC.CodigoCovid) && (ddlCaracter.SelectedValue=="0"))) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe seleccionar el caracter del protocolo"; return; @@ -3821,7 +4058,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if ((txtFechaFIS.Value == "") && (chkSinFIS.Checked==false)) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar fecha de inicio de síntomas"; return; @@ -3831,7 +4068,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if ((ddlCaracter.SelectedValue == "4") && (txtFechaFUC.Value=="") && (chkSinFUC.Checked==false)) { - TxtDatos.Value = ""; + // TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar fecha de último contacto"; return; @@ -3839,21 +4076,21 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida } if ((ddlEspecialista.SelectedValue=="-1") && (oC.MedicoObligatorio)) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar la mátricula del médico solicitante"; return; } if (ddlOrigen.SelectedValue == "0") { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar el origen"; return; } if ((oC.IdSectorDefecto== 0) && (ddlSectorServicio.SelectedValue == "0")) { - TxtDatos.Value = ""; + // TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar el Servicio"; return; @@ -3862,7 +4099,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if ((lblAlertaObraSocial.Visible) && (lblObraSocial.Text == "-")) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar la obra social/financiador"; return; @@ -3872,7 +4109,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if (txtFechaOrden.Value == "") { - TxtDatos.Value = ""; + // TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar la fecha de la orden"; return; @@ -3881,7 +4118,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaOrden.Value) > DateTime.Now) { - TxtDatos.Value = ""; + // TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La fecha de la orden no puede ser superior a la fecha actual"; return; @@ -3890,7 +4127,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaOrden.Value) > DateTime.Parse(txtFecha.Value)) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La fecha de la orden no puede ser superior a la fecha del protocolo"; return; @@ -3905,7 +4142,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida if (txtFechaTomaMuestra.Value == "") { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "Debe ingresar la fecha de toma de muestra"; return; @@ -3914,7 +4151,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaTomaMuestra.Value) > DateTime.Now) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La fecha de toma de muestra no puede ser superior a la fecha actual"; return; @@ -3923,7 +4160,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaTomaMuestra.Value) > DateTime.Parse(txtFecha.Value)) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La fecha de toma de muestra no puede ser superior a la fecha del protocolo"; return; @@ -3942,7 +4179,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaFIS.Value) > DateTime.Now) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La FIS no puede ser superior a la fecha actual"; return; @@ -3951,7 +4188,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaTomaMuestra.Value) < DateTime.Parse(txtFechaFIS.Value)) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La FIS no puede ser despues de la fecha de toma de muestra"; return; @@ -3971,7 +4208,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaFUC.Value) > DateTime.Now) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La FUC no puede ser superior a la fecha actual"; return; @@ -3980,7 +4217,7 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida { if (DateTime.Parse(txtFechaTomaMuestra.Value) < DateTime.Parse(txtFechaFUC.Value)) { - TxtDatos.Value = ""; + //TxtDatos.Value = ""; args.IsValid = false; this.cvValidacionInput.ErrorMessage = "La FUC no puede ser despues de la fecha de toma de muestra"; return; @@ -3990,324 +4227,279 @@ protected void cvValidacionInput_ServerValidate_vane(object source, ServerValida } }//fin control + if (txtEspecialista.Text != "0" && ddlEspecialista.SelectedValue == "0") + { + args.IsValid = false; + this.cvValidacionInput.ErrorMessage = "Debe seleccionar un medico del listado"; + return; + } } } - - protected void cvValidacionInput_ServerValidate(object source, ServerValidateEventArgs args) - { - - - TxtDatosCargados.Value = TxtDatos.Value; - string sDatos = ""; + private bool VerificarAnalisisContenidos() + { + bool devolver = true; + string[] tabla = TxtDatos.Value.Split('@'); + string listaCodigo = ""; - string[] tabla = TxtDatos.Value.Split('@'); - for (int i = 0; i < tabla.Length - 1; i++) + { string[] fila = tabla[i].Split('#'); string codigo = fila[1].ToString(); - string muestra= fila[2].ToString(); - - if (sDatos == "") - sDatos = codigo + "#" + muestra; - else - sDatos += ";" + codigo + "#" + muestra; + if (listaCodigo == "") + listaCodigo = "'" + codigo + "'"; + else + listaCodigo += ",'" + codigo + "'"; - } + int i_idItemPractica = 0; + if (codigo != "") + { - + Item oItem = new Item(); + oItem = (Item)oItem.Get(typeof(Item), "Codigo", codigo, "Baja", false); + if (oItem.VerificaMuestrasAsociadas(int.Parse(ddlMuestra.SelectedValue))) + { + i_idItemPractica = oItem.IdItem; + for (int j = 0; j < tabla.Length - 1; j++) - TxtDatosCargados.Value = sDatos; - //saco restriccion de forma temporal - //if (Request["Operacion"].ToString()!="Modifica") - // if (!VerificarFechaPacienteMuestra()) - // { - // TxtDatos.Value = ""; - // args.IsValid = false; - // this.cvValidacionInput.ErrorMessage = "No es posible ingresar para la misma fecha, muestra y paciente un nuevo protocolo."; - // return; - // } + { + string[] fila2 = tabla[j].Split('#'); + string codigo2 = fila2[1].ToString(); + if ((codigo2 != "") && (codigo != codigo2)) + { + Item oItem2 = new Item(); + oItem2 = (Item)oItem2.Get(typeof(Item), "Codigo", codigo2, "Baja", false); - if (!VerificarAnalisisContenidos() ) - { TxtDatos.Value = ""; - args.IsValid = false; - - return; - } - else - { + //MultiEfector: filtro por efector - - /// + ISession m_session = NHibernateHttpModule.CurrentSession; + ICriteria crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); + crit.Add(Expression.Eq("IdItemPractica", oItem)); + crit.Add(Expression.Eq("IdItemDeterminacion", oItem2.IdItem)); + crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); + PracticaDeterminacion oGrupo = (PracticaDeterminacion)crit.UniqueResult(); - if ((TxtDatos.Value == "") || (TxtDatos.Value == "1###on@")) - { - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe completar al menos un análisis"; - return; - } - else args.IsValid = true; + if (oGrupo != null) + { - //validacion Diagnostico - if (oC.DiagObligatorio) - {if (lstDiagnosticosFinal.Items.Count == 0) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar al menos un diagnóstico presuntivo del paciente"; - return; - } - } + this.cvValidacionInput.ErrorMessage = "Ha cargado análisis contenidos en otros. Verifique los códigos " + codigo + " y " + codigo2 + "!"; + devolver = false; break; - ///Validacion de la fecha de protocolo - if (txtFecha.Value == "") - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar la fecha del protocolo"; - return; - } - else - { + } - if (DateTime.Parse(txtFecha.Value) > DateTime.Now) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La fecha del protocolo no puede ser superior a la fecha actual"; - return; + } + + }////for } else - args.IsValid = true; - } + { + this.cvValidacionInput.ErrorMessage = "Ha ingresado tipo de muestra que no corresponde con el codigo " + codigo + ". Verifique configuracion."; + devolver = false; break; + } - if ((ddlSectorServicio.SelectedValue == "0")) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar sector"; - return; - } + }/// if codigo + if (!devolver) break; + } - if ((ddlOrigen.SelectedValue == "0")) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar Origen"; - return; - } - - if ((ddlPrioridad.SelectedValue == "0")) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar Prioridad"; - return; - } - - if ((ddlMuestra.SelectedValue == "0") && (pnlMuestra.Visible)) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar Tipo de Muestra"; - return; - } - /// Valida que debe seleccionar un caracter si es un caso notificable a SISA + if ((devolver) && (listaCodigo != "")) + { devolver = VerificarAnalisisComplejosContenidos(listaCodigo); } + return devolver; + } - if ((VerificaRequiereCaracter(sDatos)) && (ddlCaracter.SelectedValue == "0")) - //if ((sDatos.Contains(oC.CodigoCovid) && (ddlCaracter.SelectedValue=="0"))) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe seleccionar el caracter del protocolo"; - return; - } - // fin valida - // validacion si es sospechoso o detctar ingresar fecha de inicio de sintomas + //LAB-192: Bug análisis Repetidos en protocolos. No lo pasamos a produccion porque baja la perfomance del sistema. - if (VerificaObligatoriedadFIS()) - { - if ((txtFechaFIS.Value == "") && (chkSinFIS.Checked==false)) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar fecha de inicio de síntomas"; - return; - } - } - // validacion si es contacto ingresar fecha de ultimo contacto - if ((ddlCaracter.SelectedValue == "4") && (txtFechaFUC.Value=="") && (chkSinFUC.Checked==false)) - { - - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar fecha de último contacto"; - return; - - } - if ((ddlEspecialista.SelectedValue=="-1") && (oC.MedicoObligatorio)) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar la mátricula del médico solicitante"; - return; - } - if (ddlOrigen.SelectedValue == "0") - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar el origen"; - return; - } - if ((oC.IdSectorDefecto== 0) && (ddlSectorServicio.SelectedValue == "0")) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar el Servicio"; - return; - } - + //private bool VerificarAnalisisContenidos_LAB192() + //{ + // bool devolver = true; + // string[] tabla = TxtDatos.Value.Split('@'); + // string listaCodigo = ""; - if ((lblAlertaObraSocial.Visible) && (lblObraSocial.Text == "-")) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar la obra social/financiador"; - return; - } + // var subItemsEnBD = new Dictionary(); + // //List subItemsEnDB = new List(); - ///Validacion de la fecha de la orden - if (txtFechaOrden.Value == "") - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar la fecha de la orden"; - return; - } - else - { - if (DateTime.Parse(txtFechaOrden.Value) > DateTime.Now) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La fecha de la orden no puede ser superior a la fecha actual"; - return; - } - else - { - if (DateTime.Parse(txtFechaOrden.Value) > DateTime.Parse(txtFecha.Value)) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La fecha de la orden no puede ser superior a la fecha del protocolo"; - return; - } - else - args.IsValid = true; - } - } + // for (int i = 0; i < tabla.Length - 1; i++) - + // { + // string[] fila = tabla[i].Split('#'); + // string codigo = fila[1].ToString(); + // if (listaCodigo == "") + // listaCodigo = "'" + codigo + "'"; + // else + // listaCodigo += ",'" + codigo + "'"; + + // if (codigo != "") + // { + // Item oItem = new Item(); + // oItem = (Item)oItem.Get(typeof(Item), "Codigo", codigo, "Baja", false); + // //1- Si el idItem ya esta en DetalleProtocolo (para los casos de "Modifica" no verifico Analisis) + // // if (Request["Operacion"].ToString() == "Modifica") + // if (Request["idProtocolo"] != null)//Caro: unifco instanciacion de protocolo cuando es modificacion + // { + // Business.Data.Laboratorio.Protocolo oRegistro = new Business.Data.Laboratorio.Protocolo(); + // oRegistro = (Business.Data.Laboratorio.Protocolo)oRegistro.Get(typeof(Business.Data.Laboratorio.Protocolo), int.Parse(Request["idProtocolo"].ToString())); + // //try //Caro: saco try cath por errores silenciosos + // //{ + // if ((oRegistro != null) && (oItem != null)) + // { + // ISession m_session = NHibernateHttpModule.CurrentSession; + // ICriteria crit = m_session.CreateCriteria(typeof(DetalleProtocolo)); + // crit.Add(Expression.Eq("IdItem", oItem)); + // crit.Add(Expression.Eq("IdProtocolo", oRegistro)); + // IList lista = crit.List(); + + // if (lista.Count == 0)//no esta en la base + // { + // devolver = VerificaMuestrasAsociadas(codigo, oItem, tabla, subItemsEnBD); + + // } + // else + // { + // foreach (DetalleProtocolo oDetalle in lista) + // { + // subItemsEnBD[oDetalle.IdSubItem.IdItem] = oDetalle.IdItem.IdItem; + // } + + // } + // } + // //} + // //catch(Exception e) + // //{ + // // this.cvValidacionInput.ErrorMessage = e.Message; + // // devolver = false; break; + // //} - if (txtFechaTomaMuestra.Value == "") - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "Debe ingresar la fecha de toma de muestra"; - return; - } - else - { - if (DateTime.Parse(txtFechaTomaMuestra.Value) > DateTime.Now) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La fecha de toma de muestra no puede ser superior a la fecha actual"; - return; - } - else - { - if (DateTime.Parse(txtFechaTomaMuestra.Value) > DateTime.Parse(txtFecha.Value)) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La fecha de toma de muestra no puede ser superior a la fecha del protocolo"; - return; - } - else - args.IsValid = true; - } - } + // } + // else // no es modificacion + // { + // devolver = VerificaMuestrasAsociadas(codigo, oItem, tabla); + // } - /// control de fecha inicio de sintomas - /// - - if (txtFechaFIS.Value != "") - - { - if (DateTime.Parse(txtFechaFIS.Value) > DateTime.Now) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La FIS no puede ser superior a la fecha actual"; - return; - } - else - { - if (DateTime.Parse(txtFechaTomaMuestra.Value) < DateTime.Parse(txtFechaFIS.Value)) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La FIS no puede ser despues de la fecha de toma de muestra"; - return; - } - else - args.IsValid = true; - } - }//fin control + // }/// if codigo + // if (!devolver) break; + // } + // if ((devolver) && (listaCodigo != "")) + // { devolver = VerificarAnalisisComplejosContenidos(listaCodigo); } - /// control de fecha inicio de sintomas - /// - + // return devolver; - if (txtFechaFUC.Value != "") + //} - { - if (DateTime.Parse(txtFechaFUC.Value) > DateTime.Now) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La FUC no puede ser superior a la fecha actual"; - return; - } - else - { - if (DateTime.Parse(txtFechaTomaMuestra.Value) < DateTime.Parse(txtFechaFUC.Value)) - { - TxtDatos.Value = ""; - args.IsValid = false; - this.cvValidacionInput.ErrorMessage = "La FUC no puede ser despues de la fecha de toma de muestra"; - return; - } - else - args.IsValid = true; - } - }//fin control + //private bool VerificaMuestrasAsociadas(string codigo, Item oItem, string[] tabla, Dictionary itemsEnBD = null) + //{ + // bool devolver = true; - } - } + + // if (oItem.VerificaMuestrasAsociadas(int.Parse(ddlMuestra.SelectedValue))) + // { + + + // for (int j = 0; j < tabla.Length - 1; j++) + + // { + // string[] fila2 = tabla[j].Split('#'); + // string codigo2 = fila2[1].ToString(); + // if ((codigo2 != "") && (codigo != codigo2)) + // { + // Item oItem2 = new Item(); + // oItem2 = (Item)oItem2.Get(typeof(Item), "Codigo", codigo2, "Baja", false); + + // //MultiEfector: filtro por efector + // ISession m_session = NHibernateHttpModule.CurrentSession; + // ICriteria crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); + // crit.Add(Expression.Eq("IdItemPractica", oItem)); + // crit.Add(Expression.Eq("IdItemDeterminacion", oItem2.IdItem)); + // crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); + // PracticaDeterminacion oGrupo = (PracticaDeterminacion)crit.UniqueResult(); + + + + // if (oGrupo != null) + // { + + // this.cvValidacionInput.ErrorMessage = "Ha cargado análisis contenidos en otros. Verifique los códigos " + codigo + " y " + codigo2 + "!"; + // devolver = false; break; + + // } + + // //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + // //Verifico que el codigo cargado tampoco este en mi lista de subItems de la base de datos! + + // if (itemsEnBD != null) + // { + // Item oItemExistente = new Item(); + // bool hayConflicto = false; + // int itemExistente = 0; + + // m_session = NHibernateHttpModule.CurrentSession; + // crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); + // crit.Add(Expression.Eq("IdItemPractica", oItem)); + // crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); + // IList detalle = crit.List(); + + // if (detalle.Count > 0) //Es practica + // { + // foreach (PracticaDeterminacion item in detalle) + // { + // if (itemsEnBD.ContainsKey(item.IdItemDeterminacion)) + // { + // itemExistente = itemsEnBD[item.IdItemDeterminacion]; + // hayConflicto = true; break; + // } + // } + // } + // else //es determinacion simple idItem=idSubitem + // { + // if (itemsEnBD.ContainsKey(oItem.IdItem)) + // { + // itemExistente = itemsEnBD[oItem.IdItem]; + // hayConflicto = true; + // } + // } + + // if (hayConflicto) + // { + // string mensajeerror = ""; + // oItemExistente = (Item)oItemExistente.Get(typeof(Item), "IdItem", itemExistente);//, "Baja", false); //Caro: le saco la condicion de baja porque si fue grabado en la base y despues lo pusieron de baja no lo va a encontrar + // if (oItemExistente != null)///Caro agrego control de que exista si no va a dar error al usarlo + // { + // mensajeerror = + // "Ha cargado análisis contenidos en otros. Verifique los códigos " + + // codigo + " y " + oItemExistente.Codigo + "!"; + + // } + // else + // mensajeerror = "Ha cargado análisis contenidos en otros. Verifique los códigos "; + + // this.cvValidacionInput.ErrorMessage = mensajeerror; + // devolver = false; + // } + + // } + // } + + // }////for + // } + // else + // { + // this.cvValidacionInput.ErrorMessage = "Ha ingresado tipo de muestra que no corresponde con el codigo " + codigo + ". Verifique configuracion."; + // devolver = false; //break; + + // } + + // return devolver; + //} private bool VerificaRequiereCaracter(string sDatos) { @@ -4344,101 +4536,15 @@ private bool VerificaObligatoriedadFIS() string[] arrfis = oC.FISCaracter.Split((",").ToCharArray()); foreach (string item in arrfis) { - if (item == ddlCaracter.SelectedValue) + if ((item == ddlCaracter.SelectedValue) && (ddlCaracter.SelectedValue!="")) { obligafis = true; break; } } return obligafis; } - //private bool VerificarFechaPacienteMuestra() - //{ - // Paciente oPaciente = new Paciente(); - // oPaciente = (Paciente)oPaciente.Get(typeof(Paciente), int.Parse(HFIdPaciente.Value)); - - // string tieneingreso = oPaciente.GetFechaProtocolosReciente(Request["idServicio"].ToString(),ddlMuestra.SelectedValue); - // if (tieneingreso==txtFecha.Value) return false; - // else return true; - //} - - - private bool VerificarAnalisisContenidos() - { - bool devolver = true; - string[] tabla = TxtDatos.Value.Split('@'); - string listaCodigo = ""; - - for (int i = 0; i < tabla.Length - 1; i++) - - { - string[] fila = tabla[i].Split('#'); - string codigo = fila[1].ToString(); - if (listaCodigo == "") - listaCodigo = "'" + codigo + "'"; - else - listaCodigo += ",'" + codigo + "'"; - - int i_idItemPractica = 0; - if (codigo != "") - { - - Item oItem = new Item(); - oItem = (Item)oItem.Get(typeof(Item), "Codigo", codigo, "Baja", false); - if (oItem.VerificaMuestrasAsociadas(int.Parse(ddlMuestra.SelectedValue))) - { - - i_idItemPractica = oItem.IdItem; - for (int j = 0; j < tabla.Length - 1; j++) - - { - string[] fila2 = tabla[j].Split('#'); - string codigo2 = fila2[1].ToString(); - if ((codigo2 != "") && (codigo != codigo2)) - { - Item oItem2 = new Item(); - oItem2 = (Item)oItem2.Get(typeof(Item), "Codigo", codigo2, "Baja", false); - - //MultiEfector: filtro por efector - - - ISession m_session = NHibernateHttpModule.CurrentSession; - ICriteria crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); - crit.Add(Expression.Eq("IdItemPractica", oItem)); - crit.Add(Expression.Eq("IdItemDeterminacion", oItem2.IdItem)); - crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); - PracticaDeterminacion oGrupo = (PracticaDeterminacion)crit.UniqueResult(); - - - - if (oGrupo != null) - { - - this.cvValidacionInput.ErrorMessage = "Ha cargado análisis contenidos en otros. Verifique los códigos " + codigo + " y " + codigo2 + "!"; - devolver = false; break; - - } - - } - - }////for - } - else - { - this.cvValidacionInput.ErrorMessage = "Ha ingresado tipo de muestra que no corresponde con el codigo " + codigo + ". Verifique configuracion."; - devolver = false; break; - - } - - }/// if codigo - if (!devolver) break; - } - - if ((devolver) && (listaCodigo != "")) - { devolver = VerificarAnalisisComplejosContenidos(listaCodigo); } - - return devolver; - - } + + private bool VerificarAnalisisComplejosContenidos(string listaCodigo) { ///Este es un segundo nivel de validacion en donde los analisis contenidos no estan directamente sino en diagramas @@ -4475,17 +4581,6 @@ private bool VerificarAnalisisComplejosContenidos(string listaCodigo) - //protected void lnkReimprimirComprobante_Click(object sender, EventArgs e) - //{ - // Business.Data.Laboratorio.Protocolo oRegistro = new Business.Data.Laboratorio.Protocolo(); - // oRegistro = (Business.Data.Laboratorio.Protocolo)oRegistro.Get(typeof(Business.Data.Laboratorio.Protocolo), int.Parse(Request["idProtocolo"].ToString())); - - // ////Imprimir Comprobante para el paciente - // Imprimir(oRegistro); - - - - //} protected void lnkReimprimirCodigoBarras_Click(object sender, EventArgs e) { @@ -4561,15 +4656,7 @@ private void Avanzar(int avance) } } - } - //if (avance == 1) - //{ - // ProtocoloNuevo = ProtocoloActual+1; - //} - //else //retrocede - // ProtocoloNuevo = ProtocoloActual - 1; - - + } ISession m_session = NHibernateHttpModule.CurrentSession; ICriteria crit = m_session.CreateCriteria(typeof(Protocolo)); @@ -4634,7 +4721,8 @@ private void CargarDiagnosticosFrecuentes() string m_ssql = @"SELECT top 20 ID, Codigo + ' - ' + Nombre as nombre, count (*) cantidad FROM Sys_CIE10 c (nolock) inner join LAB_ProtocoloDiagnostico p (nolock) on c.id = p.idDiagnostico -where p.idEfector=" + oUser.IdEfector.IdEfector.ToString() + @" +where c.tipo='DIAG' and +p.idEfector=" + oUser.IdEfector.IdEfector.ToString() + @" group by id, codigo, nombre ORDER BY cantidad desc"; @@ -4764,9 +4852,42 @@ private void MostrarMedico() ddlEspecialista.Items.Insert(0, new ListItem(espe, matricula+ '#' + espe)); } if (pro.Count > 1) + { if (Request["idProtocolo"] == null) { ddlEspecialista.Items.Insert(0, new ListItem("--Seleccione--", "0")); } + #region SelecionProfesional + if (Session["apellidoNombre"] != null) + { + foreach (ListItem item in ddlEspecialista.Items) + { + + //EJEMPLO DE item.Value: + //1541#CAVIEZA NAIR AMANCAY - TÉCNICO SUPERIOR EN RADIOLOGIA# + int positionFinal = item.Value.IndexOf("-"); + if (positionFinal < 0) + continue; //Es el caso de "--Seleccione--", "0" + + string apellidoNombre = item.Value.Substring(0, positionFinal); + int posicion = apellidoNombre.IndexOf("#"); + + if (posicion < 0) + continue; + + apellidoNombre = apellidoNombre.Substring(posicion + 1).Trim(); + + + if (apellidoNombre.Equals(Session["apellidoNombre"].ToString())) + { + ddlEspecialista.SelectedValue = item.Value; + break; + } + } + } + #endregion + } + + lblErrorMedico.Visible = false; } @@ -4796,7 +4917,7 @@ private void MostrarMedico() } - + public class Profesiones { public List matriculacion { get; set; } @@ -4804,19 +4925,21 @@ public class Profesiones } public class Matricula - { public string matriculaNumero { get; set; } - + public DateTime fin { get; set; } + } - public class ProfesionalMatriculado + public class ProfesionalMatriculado { // public int documento { get; set; } public string nombre { get; set; } public string apellido { get; set; } + public string cuit { get; set; } public List profesiones { get; set; } + public string id { get; set; } //id que trae de ANDES //public string Nombre { get; set; } //public string FechaNacimiento { get; set; } //public string FechaNac { get; set; } @@ -4876,13 +4999,16 @@ public class ProfesionalMatriculado protected void Button1_Click(object sender, EventArgs e) { - if (Session["matricula"] != null) + if (Session["matricula"] != null && Session["matricula"].ToString() != "") + //Agregue que sea distinto de vacio porque al Cancelar sin traer matricula, + //deja un string vacio, que hacia que entrara al if y buscara nuevamente un medico + //haciendo que la ejecucion se extendiera innecesariamente { txtEspecialista.Text = Session["matricula"].ToString(); MostrarMedico(); - TxtDatos.Value = ""; + //TxtDatos.Value = ""; //No quiero pisar los datos cargados } } @@ -5335,6 +5461,42 @@ private void CargarProtocoloDerivadoLote() } } + protected void txtCodigoEnfermedadBase_TextChanged(object sender, EventArgs e) + { + + try + { + Cie10 oRegistro = new Cie10(); + oRegistro = (Cie10)oRegistro.Get(typeof(Cie10), "Codigo", txtCodigoEnfermedadBase.Text ); + if (oRegistro != null) ddlEnfermedadBase.SelectedValue = oRegistro.Id.ToString(); + ddlEnfermedadBase.UpdateAfterCallBack = true; + } + catch (Exception ex) + { + string exception = ""; + //while (ex != null) + //{ + exception = ex.Message + "
"; + + //} + } + } + + protected void ddlEnfermedadBase_SelectedIndexChanged(object sender, EventArgs e) + { + mostrarCodigoEnfermedadBase(); + } + + private void mostrarCodigoEnfermedadBase() + { + if ((ddlEnfermedadBase.SelectedValue != "0") && (ddlEnfermedadBase.SelectedValue != "")) + { + Cie10 oRegistro = new Cie10(); + oRegistro = (Cie10)oRegistro.Get(typeof(Cie10), int.Parse(ddlEnfermedadBase.SelectedValue.ToString())); + if (oRegistro != null) txtCodigoEnfermedadBase.Text = oRegistro.Codigo; + txtCodigoEnfermedadBase.UpdateAfterCallBack = true; + } + } } } diff --git a/WebLab/Protocolos/ProtocoloEdit2.aspx.designer.cs b/WebLab/Protocolos/ProtocoloEdit2.aspx.designer.cs index 8ff1ffc6..e144026b 100644 --- a/WebLab/Protocolos/ProtocoloEdit2.aspx.designer.cs +++ b/WebLab/Protocolos/ProtocoloEdit2.aspx.designer.cs @@ -138,6 +138,33 @@ public partial class ProtocoloEdit2 { /// protected global::System.Web.UI.WebControls.HiddenField HFSexo; + /// + /// HFSelMedico control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField HFSelMedico; + + /// + /// HFSelRenaper control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField HFSelRenaper; + + /// + /// HFModificarPaciente control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField HFModificarPaciente; + /// /// hplModificarPaciente control. /// @@ -633,24 +660,6 @@ public partial class ProtocoloEdit2 { /// protected global::Anthem.LinkButton lnkAgregarItem; - /// - /// pnlImpresoraAlta control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl pnlImpresoraAlta; - - /// - /// ddlImpresoraEtiqueta control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList ddlImpresoraEtiqueta; - /// /// TxtDatosCargados control. /// @@ -822,6 +831,42 @@ public partial class ProtocoloEdit2 { /// protected global::System.Web.UI.WebControls.CheckBox chkSinFUC; + /// + /// pnlEnfermedadBase control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pnlEnfermedadBase; + + /// + /// lblEB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Anthem.Label lblEB; + + /// + /// txtCodigoEnfermedadBase control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Anthem.TextBox txtCodigoEnfermedadBase; + + /// + /// ddlEnfermedadBase control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Anthem.DropDownList ddlEnfermedadBase; + /// /// pnlEtiquetas control. /// @@ -912,6 +957,24 @@ public partial class ProtocoloEdit2 { /// protected global::WebLab.Calidad.IncidenciaEdit IncidenciaEdit1; + /// + /// pnlImpresoraAlta control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl pnlImpresoraAlta; + + /// + /// ddlImpresoraEtiqueta control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlImpresoraEtiqueta; + /// /// txtObservacion control. /// diff --git a/WebLab/Protocolos/ProtocoloList.aspx.cs b/WebLab/Protocolos/ProtocoloList.aspx.cs index f73afc08..685b1c2a 100644 --- a/WebLab/Protocolos/ProtocoloList.aspx.cs +++ b/WebLab/Protocolos/ProtocoloList.aspx.cs @@ -242,23 +242,7 @@ private void CargarListas() m_ssql += " and idTipoServicio>0"; oUtil.CargarCombo(ddlServicio, m_ssql, "idTipoServicio", "nombre", connReady); - - - //if (oUser.Administrador) - //{ - // m_ssql = "select distinct E.idEfector, E.nombre from sys_efector E " + - // " INNER JOIN lab_Configuracion C on C.idEfector=E.idEfector " + - // "order by E.nombre"; - - // oUtil.CargarCombo(ddlEfector, m_ssql, "idEfector", "nombre"); - // ddlEfector.Items.Insert(0, new ListItem("Configuracion General", "227")); - //} - //else - //{ - // m_ssql = "select E.idEfector, E.nombre from sys_efector E where E.idEfector= " + oUser.IdEfector.IdEfector.ToString(); - // oUtil.CargarCombo(ddlEfector, m_ssql, "idEfector", "nombre"); - //} - + @@ -314,7 +298,8 @@ private void CargarListas() ddlPrioridad.Visible = false; } ///Carga de Sectores - m_ssql = "SELECT idSectorServicio, nombre + ' - ' + prefijo as nombre FROM LAB_SectorServicio with (nolock) WHERE (baja = 0) order by nombre"; + m_ssql = @"SELECT idSectorServicio, nombre + ' - ' + prefijo as nombre FROM LAB_SectorServicio S with (nolock) WHERE (baja = 0) + and exists(select 1 from Lab_SectorServicioEfector SE where SE.idSectorServicio = S.idSectorServicio and se.idefector = "+oUser.IdEfector.IdEfector.ToString()+@") order by nombre"; oUtil.CargarCombo(ddlSectorServicio, m_ssql, "idSectorServicio", "nombre", connReady); ddlSectorServicio.Items.Insert(0, new ListItem("-- Todos --", "0")); diff --git a/WebLab/Protocolos/ProtocoloProductoEdit.aspx.cs b/WebLab/Protocolos/ProtocoloProductoEdit.aspx.cs index 193a2389..c0b4d968 100644 --- a/WebLab/Protocolos/ProtocoloProductoEdit.aspx.cs +++ b/WebLab/Protocolos/ProtocoloProductoEdit.aspx.cs @@ -164,7 +164,7 @@ protected void Page_Load(object sender, EventArgs e) CargarProtocoloDerivadoLote(); } - + } } else @@ -472,11 +472,22 @@ private void CargarListas() ///Carga de grupos de numeración solo si el tipo de numeración es 2: por Grupos => obsoleto con sil2 - string m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio with (nolock) WHERE (baja = 0) order by nombre"; - oUtil.CargarCombo(ddlSectorServicio, m_ssql, "idSectorServicio", "nombre", connReady); - ddlSectorServicio.Items.Insert(0, new ListItem("Seleccione", "0")); + //string m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio with (nolock) WHERE (baja = 0) order by nombre"; + //oUtil.CargarCombo(ddlSectorServicio, m_ssql, "idSectorServicio", "nombre", connReady); + //ddlSectorServicio.Items.Insert(0, new ListItem("Seleccione", "0")); + + + string str_condicion = ")"; + if ((Request["Operacion"].ToString() == "Modifica") && (Request["idProtocolo"] != null)) + str_condicion = " or exists (select 1 from LAB_Protocolo p WHERE p.idsector = s.idSectorServicio and idProtocolo = " + Request["idProtocolo"].ToString() + ")) "; + string m_ssql = @"SELECT s.idSectorServicio, s.prefijo + ' - ' + s.nombre as nombre FROM LAB_SectorServicio S with (nolock) + WHERE (baja = 0) + and ( exists (select 1 from Lab_SectorServicioEfector SE where SE.idSectorServicio=S.idSectorServicio and se.idefector=" + oUser.IdEfector.IdEfector.ToString() + @" )" + str_condicion + @" order by nombre"; + + oUtil.CargarCombo(ddlSectorServicio, m_ssql, "idSectorServicio", "nombre", connReady); + ddlSectorServicio.Items.Insert(0, new ListItem("Seleccione", "0")); /////////////////////////////////////////////CODIGO DE BARRAS////////////////////////////////////////////////////////////////////// tab3Titulo.Visible = false; pnlEtiquetas.Visible = false; @@ -800,7 +811,7 @@ protected void btnGuardar_Click(object sender, EventArgs e) case "ProtocoloList": Response.Redirect("ProtocoloList.aspx?idServicio=" + Session["idServicio"].ToString() + "&Tipo=ListaProducto"); break; case "Control": Avanzar(1); break; } - } + } if (Request["Operacion"].ToString() == "AltaDerivacionMultiEfectorLote") { Business.Data.Laboratorio.Protocolo oRegistroAnterior = new Business.Data.Laboratorio.Protocolo(); @@ -1231,7 +1242,8 @@ private void GuardarDetalle(Business.Data.Laboratorio.Protocolo oRegistro) GuardarDetallePractica(oDetalle); - GuardarDerivacion(oDetalle); + //GuardarDerivacion(oDetalle); + oDetalle.GuardarDerivacion(oUser); } else //si ya esta actualizo si trajo muestra o no { @@ -1608,8 +1620,6 @@ protected void btnCancelar_Click(object sender, EventArgs e) case "Control": Response.Redirect("ProtocoloList.aspx?idServicio=" + Session["idServicio"].ToString() + "&Tipo=Control"); break; case "AltaDerivacionMultiEfectorLote": Response.Redirect("DerivacionMultiEfectorLote.aspx?idEfectorSolicitante=" + Request["idEfectorSolicitante"].ToString() + "&idServicio=1&idLote=" + Request["idLote"]); break; } - - } @@ -1720,6 +1730,8 @@ protected void cvAnalisis_ServerValidate(object source, ServerValidateEventArgs protected void cvValidacionInput_ServerValidate(object source, ServerValidateEventArgs args) { + string[] bk = TxtDatosCargados.Value.Split(';'); + TxtDatosCargados.Value = TxtDatos.Value; string sDatos = ""; @@ -1730,12 +1742,19 @@ protected void cvValidacionInput_ServerValidate(object source, ServerValidateEve { string[] fila = tabla[i].Split('#'); string codigo = fila[1].ToString(); - string muestra= fila[2].ToString(); - - if (sDatos == "") - sDatos = codigo + "#" + muestra; + string muestra= fila[2].ToString(); + string conResultado = "false"; + + //Cargo el valor del resultado para no perderlo si da error la validacion + if (i < bk.Length && bk.Length > 1) //TxtDatosCargados en Alta no tiene valores! + { + string[] filaBk = bk[i].Split('#'); + conResultado = filaBk[2].ToString(); + } + if (sDatos == "") + sDatos = codigo + "#" + muestra + "#" + conResultado; else - sDatos += ";" + codigo + "#" + muestra; + sDatos += ";" + codigo + "#" + muestra + "#" + conResultado; } @@ -1816,14 +1835,14 @@ protected void cvValidacionInput_ServerValidate(object source, ServerValidateEve } } - private bool VerificarAnalisisContenidos() { bool devolver = true; string[] tabla = TxtDatos.Value.Split('@'); string listaCodigo = ""; - + for (int i = 0; i < tabla.Length - 1; i++) + { string[] fila = tabla[i].Split('#'); string codigo = fila[1].ToString(); @@ -1837,52 +1856,245 @@ private bool VerificarAnalisisContenidos() { Item oItem = new Item(); - oItem = (Item)oItem.Get(typeof(Item), "Codigo", codigo, "Baja", false); + oItem = (Item)oItem.Get(typeof(Item), "Codigo", codigo, "Baja", false); + if (oItem.VerificaMuestrasAsociadas(int.Parse(ddlMuestra.SelectedValue))) + { + i_idItemPractica = oItem.IdItem; + for (int j = 0; j < tabla.Length - 1; j++) - i_idItemPractica = oItem.IdItem; - for (int j = 0; j < tabla.Length - 1; j++) - { - string[] fila2 = tabla[j].Split('#'); - string codigo2 = fila2[1].ToString(); - if ((codigo2 != "") && (codigo!=codigo2)) { - Item oItem2 = new Item(); - oItem2 = (Item)oItem2.Get(typeof(Item), "Codigo", codigo2, "Baja", false); + string[] fila2 = tabla[j].Split('#'); + string codigo2 = fila2[1].ToString(); + if ((codigo2 != "") && (codigo != codigo2)) + { + Item oItem2 = new Item(); + oItem2 = (Item)oItem2.Get(typeof(Item), "Codigo", codigo2, "Baja", false); - //PracticaDeterminacion oGrupo = new PracticaDeterminacion(); - //oGrupo = (PracticaDeterminacion)oGrupo.Get(typeof(PracticaDeterminacion), "IdItemPractica", oItem, "IdItemDeterminacion", oItem2.IdItem); + //MultiEfector: filtro por efector - ISession m_session = NHibernateHttpModule.CurrentSession; - ICriteria crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); - crit.Add(Expression.Eq("IdItemPractica", oItem)); - crit.Add(Expression.Eq("IdItemDeterminacion", oItem2.IdItem)); - crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); - PracticaDeterminacion oGrupo = (PracticaDeterminacion)crit.UniqueResult(); + ISession m_session = NHibernateHttpModule.CurrentSession; + ICriteria crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); + crit.Add(Expression.Eq("IdItemPractica", oItem)); + crit.Add(Expression.Eq("IdItemDeterminacion", oItem2.IdItem)); + crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); + PracticaDeterminacion oGrupo = (PracticaDeterminacion)crit.UniqueResult(); + + + + if (oGrupo != null) + { + + this.cvValidacionInput.ErrorMessage = "Ha cargado análisis contenidos en otros. Verifique los códigos " + codigo + " y " + codigo2 + "!"; + devolver = false; break; + + } - if (oGrupo != null) - { - - this.cvValidacionInput.ErrorMessage = "Ha cargado análisis contenidos en otros. Verifique los códigos " + codigo + " y " + codigo2 + "!"; - devolver = false; break; - } - - } - }////for + + }////for + } + else + { + this.cvValidacionInput.ErrorMessage = "Ha ingresado tipo de muestra que no corresponde con el codigo " + codigo + ". Verifique configuracion."; + devolver = false; break; + + } + }/// if codigo if (!devolver) break; } if ((devolver) && (listaCodigo != "")) { devolver = VerificarAnalisisComplejosContenidos(listaCodigo); } - + return devolver; - - } - private bool VerificarAnalisisComplejosContenidos(string listaCodigo) + } + + //LAB-192: Bug análisis Repetidos en protocolos. No lo pasamos a produccion porque baja la perfomance del sistema. + + // private bool VerificarAnalisisContenidos_LAB192() + // { + // bool devolver = true; + // string[] tabla = TxtDatos.Value.Split('@'); + // string listaCodigo = ""; + // var subItemsEnBD = new Dictionary(); + // for (int i = 0; i < tabla.Length - 1; i++) + // { + // string[] fila = tabla[i].Split('#'); + // string codigo = fila[1].ToString(); + // if (listaCodigo == "") + // listaCodigo = "'" + codigo + "'"; + // else + // listaCodigo += ",'" + codigo + "'"; + + // if (codigo != "") + // { + + // Item oItem = new Item(); + // oItem = (Item)oItem.Get(typeof(Item), "Codigo", codigo, "Baja", false); + + // //1- Si el idItem ya esta en DetalleProtocolo (para los casos de "Modifica" no verifico Analisis) + // // if (Request["Operacion"].ToString() == "Modifica") + // if (Request["idProtocolo"] != null)//Caro: unifco instanciacion de protocolo cuando es modificacion + // { + // Business.Data.Laboratorio.Protocolo oRegistro = new Business.Data.Laboratorio.Protocolo(); + // oRegistro = (Business.Data.Laboratorio.Protocolo)oRegistro.Get(typeof(Business.Data.Laboratorio.Protocolo), int.Parse(Request["idProtocolo"].ToString())); + // //try //Caro: saco try cath por errores silenciosos + // //{ + // if ((oRegistro != null) && (oItem != null)) + // { + // ISession m_session = NHibernateHttpModule.CurrentSession; + // ICriteria crit = m_session.CreateCriteria(typeof(DetalleProtocolo)); + // crit.Add(Expression.Eq("IdItem", oItem)); + // crit.Add(Expression.Eq("IdProtocolo", oRegistro)); + // IList lista = crit.List(); + + // if (lista.Count == 0)//no esta en la base + // { + // devolver = VerificaMuestrasAsociadas(codigo, oItem, tabla, subItemsEnBD); + + // } + // else + // { + // foreach (DetalleProtocolo oDetalle in lista) + // { + // subItemsEnBD[oDetalle.IdSubItem.IdItem] = oDetalle.IdItem.IdItem; + // } + + // } + // } + // //} + // //catch(Exception e) + // //{ + // // this.cvValidacionInput.ErrorMessage = e.Message; + // // devolver = false; break; + // //} + + // } + // else // no es modificacion + // { + // devolver = VerificaMuestrasAsociadas(codigo, oItem, tabla); + // } + + // }/// if codigo + // if (!devolver) break; + // } + + // if ((devolver) && (listaCodigo != "")) + // { devolver = VerificarAnalisisComplejosContenidos(listaCodigo); } + + // return devolver; + + // } + // private bool VerificaMuestrasAsociadas(string codigo, Item oItem, string[] tabla, Dictionary itemsEnBD = null) + //{ + // bool devolver = true; + + + // if (oItem.VerificaMuestrasAsociadas(int.Parse(ddlMuestra.SelectedValue))) + // { + + + // for (int j = 0; j < tabla.Length - 1; j++) + + // { + // string[] fila2 = tabla[j].Split('#'); + // string codigo2 = fila2[1].ToString(); + // if ((codigo2 != "") && (codigo != codigo2)) + // { + // Item oItem2 = new Item(); + // oItem2 = (Item)oItem2.Get(typeof(Item), "Codigo", codigo2, "Baja", false); + + // //MultiEfector: filtro por efector + // ISession m_session = NHibernateHttpModule.CurrentSession; + // ICriteria crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); + // crit.Add(Expression.Eq("IdItemPractica", oItem)); + // crit.Add(Expression.Eq("IdItemDeterminacion", oItem2.IdItem)); + // crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); + // PracticaDeterminacion oGrupo = (PracticaDeterminacion)crit.UniqueResult(); + + + + // if (oGrupo != null) + // { + + // this.cvValidacionInput.ErrorMessage = "Ha cargado análisis contenidos en otros. Verifique los códigos " + codigo + " y " + codigo2 + "!"; + // devolver = false; break; + + // } + + // // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + // //Verifico que el codigo cargado tampoco este en mi lista de subItems de la base de datos! + + // if (itemsEnBD != null) + // { + // Item oItemExistente = new Item(); + // bool hayConflicto = false; + // int itemExistente = 0; + + // m_session = NHibernateHttpModule.CurrentSession; + // crit = m_session.CreateCriteria(typeof(PracticaDeterminacion)); + // crit.Add(Expression.Eq("IdItemPractica", oItem)); + // crit.Add(Expression.Eq("IdEfector", oUser.IdEfector)); + // IList detalle = crit.List(); + + // if (detalle.Count > 0) //Es practica + // { + // foreach (PracticaDeterminacion item in detalle) + // { + // if (itemsEnBD.ContainsKey(item.IdItemDeterminacion)) + // { + // itemExistente = itemsEnBD[item.IdItemDeterminacion]; + // hayConflicto = true; break; + // } + // } + // } + // else //es determinacion simple idItem=idSubitem + // { + // if (itemsEnBD.ContainsKey(oItem.IdItem)) + // { + // itemExistente = itemsEnBD[oItem.IdItem]; + // hayConflicto = true; + // } + // } + + // if (hayConflicto) + // { + // string mensajeerror = ""; + // oItemExistente = (Item)oItemExistente.Get(typeof(Item), "IdItem", itemExistente);//, "Baja", false); //Caro: le saco la condicion de baja porque si fue grabado en la base y despues lo pusieron de baja no lo va a encontrar + // if (oItemExistente != null)///Caro agrego control de que exista si no va a dar error al usarlo + // { + // mensajeerror = + // "Ha cargado análisis contenidos en otros. Verifique los códigos " + + // codigo + " y " + oItemExistente.Codigo + "!"; + + // } + // else + // mensajeerror = "Ha cargado análisis contenidos en otros. Verifique los códigos "; + + // this.cvValidacionInput.ErrorMessage = mensajeerror; + // devolver = false; + // } + + // } + // } + + // }////for + // } + // else + // { + // this.cvValidacionInput.ErrorMessage = "Ha ingresado tipo de muestra que no corresponde con el codigo " + codigo + ". Verifique configuracion."; + // devolver = false; //break; + + // } + + // return devolver; + //} + + private bool VerificarAnalisisComplejosContenidos(string listaCodigo) { ///Este es un segundo nivel de validacion en donde los analisis contenidos no estan directamente sino en diagramas bool devolver = true; string m_ssql = "SELECT PD.idItemDeterminacion, I.codigo" + @@ -2136,8 +2348,10 @@ private void CargarProtocoloDerivadoLote() private void ActualizarEstadoDerivacion(Protocolo oRegistro, Protocolo oAnterior) { - Business.Data.Laboratorio.Derivacion oDerivacion = new Business.Data.Laboratorio.Derivacion(); - oDerivacion.MarcarComoRecibidas(oAnterior, oRegistro, oUser, Convert.ToInt32(Request["idLote"])); + //Business.Data.Laboratorio.Derivacion oDerivacion = new Business.Data.Laboratorio.Derivacion(); + //oDerivacion.MarcarComoRecibidas(oAnterior, oRegistro, oUser, Convert.ToInt32(Request["idLote"])); + DetalleProtocolo dp = new DetalleProtocolo(); + dp.ActualizarItemsDerivados(oRegistro, oAnterior, Convert.ToInt32(Request["idLote"]), oUser); } private void VerificacionEstadoLote(Protocolo oRegistro, Protocolo oAnterior) diff --git a/WebLab/Resultados/ATBEdit.aspx b/WebLab/Resultados/ATBEdit.aspx index 3896bb4e..6ea62d6d 100644 --- a/WebLab/Resultados/ATBEdit.aspx +++ b/WebLab/Resultados/ATBEdit.aspx @@ -50,7 +50,7 @@
- +
@@ -99,7 +99,7 @@
@@ -91,7 +91,7 @@ + Width="200px" >
Antibiótico: - + @@ -143,7 +143,7 @@
-
+
+ diff --git a/WebLab/Resultados/ATBEdit.aspx.cs b/WebLab/Resultados/ATBEdit.aspx.cs index d98ef937..58caff84 100644 --- a/WebLab/Resultados/ATBEdit.aspx.cs +++ b/WebLab/Resultados/ATBEdit.aspx.cs @@ -49,7 +49,7 @@ protected void Page_Load(object sender, EventArgs e) lblGermen.Text = s_numeroAislamiento + " " + oGermen.Nombre; lblPractica.Text = oItem.Nombre; - CargarMecanismos(oProtocolo, oGermen, oItem, int.Parse(s_idMetodo)); + CargarMecanismos(oProtocolo, oGermen, oItem, int.Parse(s_idMetodo), int.Parse(s_numeroAislamiento)); CargarPerfilAntibiotico(); CargarListaAntibiotico(); @@ -74,7 +74,7 @@ LAB_Antibiotico AS A with (nolock) ON DPA.idAntibiotico = A.idAntibiotico ////////////////////////////// } - private void CargarMecanismos(Protocolo oProtocolo, Germen oGermen, Item oItem, int v) + private void CargarMecanismos(Protocolo oProtocolo, Germen oGermen, Item oItem, int v, int n) { Utility oUtil = new Utility(); string m_ssql = @"SELECT idMecanismoResistencia, sigla as nombre FROM LAB_MecanismoResistencia with (nolock) order by nombre"; @@ -93,6 +93,7 @@ private void CargarMecanismos(Protocolo oProtocolo, Germen oGermen, Item oItem, ICriteria crit = m_session.CreateCriteria(typeof(ProtocoloAtbMecanismo)); crit.Add(Expression.Eq("IdProtocolo", oProtocolo)); crit.Add(Expression.Eq("IdMetodologia", v)); + crit.Add(Expression.Eq("NumeroAislamiento", n)); crit.Add(Expression.Eq("IdGermen", oGermen)); crit.Add(Expression.Eq("IdItem", oItem.IdItem)); @@ -130,8 +131,16 @@ private void ActualizarVistaAntibiograma() //lblCantidadAntibiograma.Text = " *" + cantidadAntibiogramas.ToString(); string m_ssql = @" SELECT ATB.idAntibiograma, A.descripcion, ATB.resultado, ATB.valor, ATB.idMetodologia +,ATB.idUsuarioRegistro, +ATB.idUsuarioValida, +ATB.fechaRegistro, +UR.apellido + ' ' + UR.nombre as UsuarioRegistro, +UV.apellido + ' ' + UV.nombre as UsuarioValida + FROM LAB_Antibiograma AS ATB with (nolock) INNER JOIN LAB_Antibiotico AS A with (nolock) ON ATB.idAntibiotico = A.idAntibiotico +LEFT JOIN Sys_Usuario UR ON UR.idUsuario = ATB.idUsuarioRegistro + LEFT JOIN Sys_Usuario UV ON UV.idUsuario = ATB.idUsuarioValida WHERE ATB.numeroAislamiento=" + s_numeroAislamiento +" and ATB.idMetodologia=" + s_idMetodo + " AND (ATB.idProtocolo = " + s_idProtocolo + ") AND (ATB.idItem = " + s_iditem + ") AND (ATB.idGermen = " + s_idGermen + ") order by A.descripcion"; @@ -284,47 +293,97 @@ private void EliminarAntibiotico(string anti) protected void gvAntiobiograma_RowDataBound(object sender, GridViewRowEventArgs e) { - if (e.Row.RowType == DataControlRowType.DataRow) + /* if (e.Row.RowType == DataControlRowType.DataRow) + { + ImageButton CmdModificar = (ImageButton)e.Row.Cells[4].Controls[1]; + CmdModificar.CommandArgument = this.gvAntiobiograma.DataKeys[e.Row.RowIndex].Value.ToString(); + CmdModificar.CommandName = "Eliminar"; + CmdModificar.ToolTip = "Eliminar"; + + // si esta validado no se puede eliminar + Antibiograma oRegistro = new Antibiograma(); + oRegistro = (Antibiograma)oRegistro.Get(typeof(Antibiograma), int.Parse(this.gvAntiobiograma.DataKeys[e.Row.RowIndex].Value.ToString())); + if ((oRegistro.IdUsuarioValida > 0) && (Request["Operacion"] == "Carga")) + CmdModificar.Visible = false; + ///// + Label lbl = (e.Row.Cells[3].FindControl("lblEstado") as Label); + if (oRegistro.IdUsuarioRegistro == 0) //enviado por el equipo + { + //lblPersona.Text = "AUTOMÃTICO: " + oDetalle.FechaResultado.ToShortDateString() + " - " + oDetalle.FechaResultado.ToShortTimeString(); + lbl.Text = "AUTOMATICO " + oRegistro.FechaRegistro.ToShortDateString() + " - " + oRegistro.FechaRegistro.ToShortTimeString(); + lbl.ForeColor = Color.Red; + } + else + { + Usuario oUser = new Usuario(); + + oUser = (Usuario)oUser.Get(typeof(Usuario), oRegistro.IdUsuarioRegistro); + lbl.Text = "Carg.: " + oUser.Apellido + " " + oUser.Nombre; + lbl.ForeColor = Color.Black; + + } + if (oRegistro.IdUsuarioValida > 0) //enviado por el equipo + { + Usuario oUser = new Usuario(); + + oUser = (Usuario)oUser.Get(typeof(Usuario), oRegistro.IdUsuarioValida); + lbl.Text = "Val.: " + oUser.Apellido + " " + oUser.Nombre; + lbl.ForeColor = Color.Blue; + } + lbl.Font.Size = FontUnit.Point(7); + lbl.Font.Italic = true; + + + } + */ + if (e.Row.RowType != DataControlRowType.DataRow) + return; + + DataRowView drv = (DataRowView)e.Row.DataItem; + + + ImageButton CmdModificar = e.Row.FindControl("Eliminar") as ImageButton; + CmdModificar.CommandArgument = this.gvAntiobiograma.DataKeys[e.Row.RowIndex].Value.ToString(); + CmdModificar.CommandName = "Eliminar"; + CmdModificar.ToolTip = "Eliminar"; + + + if (CmdModificar != null) { - ImageButton CmdModificar = (ImageButton)e.Row.Cells[4].Controls[1]; - CmdModificar.CommandArgument = this.gvAntiobiograma.DataKeys[e.Row.RowIndex].Value.ToString(); - CmdModificar.CommandName = "Eliminar"; - CmdModificar.ToolTip = "Eliminar"; - - // si esta validado no se puede eliminar - Antibiograma oRegistro = new Antibiograma(); - oRegistro = (Antibiograma)oRegistro.Get(typeof(Antibiograma), int.Parse(this.gvAntiobiograma.DataKeys[e.Row.RowIndex].Value.ToString())); - if ((oRegistro.IdUsuarioValida > 0) && (Request["Operacion"] == "Carga")) + int idUsuarioValida = drv["idUsuarioValida"] != DBNull.Value ? Convert.ToInt32(drv["idUsuarioValida"]) : 0; + + if (idUsuarioValida > 0 && Request["Operacion"]?.ToString() == "Carga") CmdModificar.Visible = false; - ///// - Label lbl = (e.Row.Cells[3].FindControl("lblEstado") as Label); - if (oRegistro.IdUsuarioRegistro == 0) //enviado por el equipo + } + + + Label lbl = e.Row.FindControl("lblEstado") as Label; + + if (lbl != null) + { + int idUsuarioRegistro = drv["idUsuarioRegistro"] != DBNull.Value ? Convert.ToInt32(drv["idUsuarioRegistro"]) : 0; + int idUsuarioValida = drv["idUsuarioValida"] != DBNull.Value ? Convert.ToInt32(drv["idUsuarioValida"]) : 0; + + if (idUsuarioRegistro == 0) { - //lblPersona.Text = "AUTOMÃTICO: " + oDetalle.FechaResultado.ToShortDateString() + " - " + oDetalle.FechaResultado.ToShortTimeString(); - lbl.Text = "AUTOMATICO " + oRegistro.FechaRegistro.ToShortDateString() + " - " + oRegistro.FechaRegistro.ToShortTimeString(); + DateTime fecha = Convert.ToDateTime(drv["fechaRegistro"]); + lbl.Text = "AUTOMATICO " + fecha.ToString("dd/MM/yyyy HH:mm"); lbl.ForeColor = Color.Red; } else { - Usuario oUser = new Usuario(); - - oUser = (Usuario)oUser.Get(typeof(Usuario), oRegistro.IdUsuarioRegistro); - lbl.Text = "Carg.: " + oUser.Apellido + " " + oUser.Nombre; + lbl.Text = "Carg.: " + drv["UsuarioRegistro"].ToString(); lbl.ForeColor = Color.Black; - } - if (oRegistro.IdUsuarioValida > 0) //enviado por el equipo - { - Usuario oUser = new Usuario(); - oUser = (Usuario)oUser.Get(typeof(Usuario), oRegistro.IdUsuarioValida); - lbl.Text = "Val.: " + oUser.Apellido + " " + oUser.Nombre; + if (idUsuarioValida > 0) + { + lbl.Text = "Val.: " + drv["UsuarioValida"].ToString(); lbl.ForeColor = Color.Blue; } + lbl.Font.Size = FontUnit.Point(7); lbl.Font.Italic = true; - - } } @@ -395,7 +454,7 @@ protected void btnGuardarMecanismo_Click(object sender, EventArgs e) Germen oGermen = new Germen(); oGermen = (Germen)oGermen.Get(typeof(Germen), int.Parse(s_idGermen)); if ((oProtocolo != null) && (oGermen != null)) - GuardarMecanismo(oProtocolo, oGermen, int.Parse(s_idMetodo), int.Parse(s_iditem)); + GuardarMecanismo(oProtocolo, oGermen, int.Parse(s_idMetodo), int.Parse(s_iditem), int.Parse(s_numeroAislamiento)); lblMensajeMecanismo.Visible = true; lblMensajeMecanismo.Text = "Mecanismos actualizados"; @@ -407,7 +466,7 @@ protected void btnGuardarMecanismo_Click(object sender, EventArgs e) } } - private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodologia, int iditem) + private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodologia, int iditem, int n) { try { @@ -430,6 +489,7 @@ private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodo crit2.Add(Expression.Eq("IdGermen", oGermen)); crit2.Add(Expression.Eq("IdItem", iditem)); crit2.Add(Expression.Eq("IdMetodologia", idmetodologia)); + crit2.Add(Expression.Eq("NumeroAislamiento", n)); crit2.Add(Expression.Eq("IdMecanismoResistencia", oM)); IList lista2 = crit2.List(); @@ -442,6 +502,7 @@ private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodo oRegistro.IdMetodologia = idmetodologia; oRegistro.IdItem = iditem; oRegistro.IdMecanismoResistencia = oM; + oRegistro.NumeroAislamiento = n; oRegistro.Save(); oProtocolo.GrabarAuditoriaDetalleProtocolo("Graba", oUser.IdUsuario, "ATB: " + oGermen.Nombre + "- Mecanismo", oM.Nombre); } diff --git a/WebLab/Resultados/ATBValida.aspx b/WebLab/Resultados/ATBValida.aspx index 7277b894..9afa8ac4 100644 --- a/WebLab/Resultados/ATBValida.aspx +++ b/WebLab/Resultados/ATBValida.aspx @@ -218,7 +218,14 @@ - + + + + + + diff --git a/WebLab/Resultados/ATBValida.aspx.cs b/WebLab/Resultados/ATBValida.aspx.cs index aac9d58f..d8c3237e 100644 --- a/WebLab/Resultados/ATBValida.aspx.cs +++ b/WebLab/Resultados/ATBValida.aspx.cs @@ -54,14 +54,14 @@ protected void Page_Load(object sender, EventArgs e) CargarPerfilAntibiotico(); CargarListaAntibiotico(); - CargarMecanismos(oProtocolo, oGermen, oItem, int.Parse(s_idMetodo)); + CargarMecanismos(oProtocolo, oGermen, oItem, int.Parse(s_idMetodo), int.Parse(s_numeroAislamiento)); ActualizarVistaAntibiograma(); } } - private void CargarMecanismos(Protocolo oProtocolo, Germen oGermen, Item oItem, int v) + private void CargarMecanismos(Protocolo oProtocolo, Germen oGermen, Item oItem, int v, int n) { Utility oUtil = new Utility(); string m_ssql = @"SELECT idMecanismoResistencia, sigla as nombre FROM LAB_MecanismoResistencia with (nolock) order by nombre"; @@ -79,6 +79,7 @@ private void CargarMecanismos(Protocolo oProtocolo, Germen oGermen, Item oItem, ISession m_session = NHibernateHttpModule.CurrentSession; ICriteria crit = m_session.CreateCriteria(typeof(ProtocoloAtbMecanismo)); crit.Add(Expression.Eq("IdProtocolo", oProtocolo)); + crit.Add(Expression.Eq("NumeroAislamiento", n)); crit.Add(Expression.Eq("IdMetodologia", v)); crit.Add(Expression.Eq("IdGermen", oGermen)); crit.Add(Expression.Eq("IdItem", oItem.IdItem)); @@ -141,6 +142,7 @@ private void ActualizarVistaAntibiograma() /* * store nuevo: parametros int grupo, int subgrupo, int etiologia, int anio, string semana, string codigo, string sexo, int id_establecimiento, string usuario_sivila + El store trae todos los datos que se necesita para la grilla */ cmd.Parameters.Add("@idItem", SqlDbType.Int); cmd.Parameters["@idItem"].Value = s_iditem; @@ -155,49 +157,7 @@ private void ActualizarVistaAntibiograma() da.Fill(Ds); gvAntiobiograma.DataSource = Ds.Tables[0]; - gvAntiobiograma.DataBind(); - - - foreach (GridViewRow row in gvAntiobiograma.Rows) - { - if (row.RowType == DataControlRowType.DataRow) - { - Label lbl = (row.Cells[6].FindControl("lblEstado") as Label); - if (lbl!=null) - { - Antibiograma oAtb = new Antibiograma(); - oAtb = (Antibiograma)oAtb.Get(typeof(Antibiograma), int.Parse(gvAntiobiograma.DataKeys[row.RowIndex].Value.ToString())); - - if (oAtb.IdUsuarioRegistro == 0) //enviado por el equipo - { - //lblPersona.Text = "AUTOMÃTICO: " + oDetalle.FechaResultado.ToShortDateString() + " - " + oDetalle.FechaResultado.ToShortTimeString(); - lbl.Text = "AUTOMATICO " + oAtb.FechaRegistro.ToShortDateString() + " - " + oAtb.FechaRegistro.ToShortTimeString(); - lbl.ForeColor = Color.Red; - } - else - { - Usuario oUser = new Usuario(); - - oUser = (Usuario)oUser.Get(typeof(Usuario), oAtb.IdUsuarioRegistro); - lbl.Text = "Carg.: " + oUser.Apellido + " " + oUser.Nombre + " " + oAtb.FechaRegistro.ToShortDateString() + " " + oAtb.FechaRegistro.ToShortTimeString(); ; - lbl.ForeColor = Color.Black; - - } - if (oAtb.IdUsuarioValida > 0) //enviado por el equipo - { - Usuario oUser = new Usuario(); - - oUser = (Usuario)oUser.Get(typeof(Usuario), oAtb.IdUsuarioValida); - lbl.Text = "Val.: "+ oUser.FirmaValidacion + " " + oAtb.FechaValida.ToShortDateString() + " " + oAtb.FechaValida.ToShortTimeString(); - lbl.ForeColor = Color.Blue; - } - lbl.Font.Size = FontUnit.Point(7); - lbl.Font.Italic = true; - - } - } - } - + gvAntiobiograma.DataBind(); @@ -284,11 +244,11 @@ private void GuardarAntibiograma() oRegistro.Resultado = ddlResultado.SelectedValue; oRegistro.Valor = txtValor.Text; - + oRegistro.IdUsuarioRegistro = oUser.IdUsuario; oRegistro.FechaRegistro = DateTime.Now; - oRegistro.IdUsuarioValida = oUser.IdUsuario; + oRegistro.IdUsuarioValida = 0;// oUser.IdUsuario; ///en el alta no se graba como validado, se valida cuando se marca la validacion. oRegistro.FechaValida = DateTime.Parse("01/01/1900"); oRegistro.Save(); @@ -333,15 +293,48 @@ private void EliminarAntibiotico(string anti) protected void gvAntiobiograma_RowDataBound(object sender, GridViewRowEventArgs e) { - if (e.Row.RowType == DataControlRowType.DataRow) + + if (e.Row.RowType != DataControlRowType.DataRow) + return; + + DataRowView drv = (DataRowView)e.Row.DataItem; + + string estadoTexto = drv["EstadoTexto"] != DBNull.Value ? drv["EstadoTexto"].ToString() : ""; + string estadoColor = drv["EstadoColor"] != DBNull.Value ? drv["EstadoColor"].ToString() : ""; + + // 🔹 Label estado + Label lbl = e.Row.FindControl("lblEstado") as Label; + if (lbl != null) { - ImageButton CmdModificar = (ImageButton)e.Row.Cells[7].Controls[1]; - CmdModificar.CommandArgument = this.gvAntiobiograma.DataKeys[e.Row.RowIndex].Value.ToString(); + lbl.Text = estadoTexto; + + switch (estadoColor) + { + case "Red": + lbl.ForeColor = Color.Red; + break; + case "Blue": + lbl.ForeColor = Color.Blue; + break; + default: + lbl.ForeColor = Color.Black; + break; + } + + lbl.Font.Size = FontUnit.Point(7); + lbl.Font.Italic = true; + } + + + ImageButton CmdModificar = e.Row.FindControl("Eliminar") as ImageButton; + + if (CmdModificar != null) + { + CmdModificar.CommandArgument = gvAntiobiograma.DataKeys[e.Row.RowIndex].Value.ToString(); CmdModificar.CommandName = "Eliminar"; CmdModificar.ToolTip = "Eliminar"; - - } + } protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) @@ -428,7 +421,7 @@ private void ValidarATB(bool accion) /// graba auditoria - oProtocolo.GrabarAuditoriaDetalleProtocolo(operacion, oAtb.IdUsuarioValida, "ATB " + oAtb.NumeroAislamiento.ToString() + " " + oAtb.IdGermen.Nombre + " (" + oAtb.IdMetodologia.ToString() + ") - " + oAtb.IdAntibiotico.Descripcion, oAtb.Resultado); + oProtocolo.GrabarAuditoriaDetalleProtocolo(operacion, oAtb.IdUsuarioValida, "ATB " + oAtb.NumeroAislamiento.ToString() + " " + oAtb.IdGermen.Nombre + " (" + lblMetodo.Text + ") - " + oAtb.IdAntibiotico.Descripcion, oAtb.Resultado); /// fin de grabar auditoria } @@ -498,7 +491,7 @@ protected void btnValidarMecanismo_Click(object sender, EventArgs e) Germen oGermen = new Germen(); oGermen = (Germen)oGermen.Get(typeof(Germen), int.Parse(s_idGermen)); if ((oProtocolo!=null) && (oGermen!= null)) - GuardarMecanismo(oProtocolo, oGermen, int.Parse(s_idMetodo), int.Parse(s_iditem)); + GuardarMecanismo(oProtocolo, oGermen, int.Parse(s_idMetodo), int.Parse(s_iditem), int.Parse(s_numeroAislamiento)); lblMensajeMecanismo.Visible = true; lblMensajeMecanismo.Text = "Mecanismos actualizados"; @@ -510,7 +503,7 @@ protected void btnValidarMecanismo_Click(object sender, EventArgs e) } } - private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodologia, int iditem) + private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodologia, int iditem, int n) { try { @@ -533,6 +526,7 @@ private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodo crit2.Add(Expression.Eq("IdGermen", oGermen)); crit2.Add(Expression.Eq("IdItem", iditem)); crit2.Add(Expression.Eq("IdMetodologia", idmetodologia)); + crit2.Add(Expression.Eq("NumeroAislamiento", n)); crit2.Add(Expression.Eq("IdMecanismoResistencia", oM)); IList lista2 = crit2.List(); @@ -543,6 +537,7 @@ private void GuardarMecanismo(Protocolo oProtocolo, Germen oGermen, int idmetodo oRegistro.IdProtocolo = oProtocolo; oRegistro.IdGermen = oGermen; oRegistro.IdMetodologia = idmetodologia; + oRegistro.NumeroAislamiento = n; oRegistro.IdItem = iditem; oRegistro.IdMecanismoResistencia = oM; oRegistro.Save(); diff --git a/WebLab/Resultados/AnalisisEdit.aspx b/WebLab/Resultados/AnalisisEdit.aspx index e0baedda..25ced2f4 100644 --- a/WebLab/Resultados/AnalisisEdit.aspx +++ b/WebLab/Resultados/AnalisisEdit.aspx @@ -66,9 +66,10 @@
- + Muestra:     @@ -91,7 +92,7 @@ -
+
@@ -126,10 +127,10 @@ - + >--%> @@ -219,7 +220,9 @@
-

+


diff --git a/WebLab/Resultados/ResultadoBusqueda.aspx.cs b/WebLab/Resultados/ResultadoBusqueda.aspx.cs index fd170256..a1663042 100644 --- a/WebLab/Resultados/ResultadoBusqueda.aspx.cs +++ b/WebLab/Resultados/ResultadoBusqueda.aspx.cs @@ -528,7 +528,8 @@ private void CargarListas() lblServicio.Text = ddlServicio.SelectedItem.Text; ///Carga de Sectores - m_ssql = "SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio (nolock) WHERE (baja = 0) order by nombre"; + m_ssql = @"SELECT idSectorServicio, prefijo + ' - ' + nombre as nombre FROM LAB_SectorServicio S with (nolock) WHERE (baja = 0) + and exists(select 1 from Lab_SectorServicioEfector SE where SE.idSectorServicio = S.idSectorServicio and se.idefector = "+oUser.IdEfector.IdEfector.ToString()+@") order by nombre"; oUtil.CargarListBox(lstSector, m_ssql, "idSectorServicio", "nombre"); for (int i = 0; i < lstSector.Items.Count; i++) { diff --git a/WebLab/Resultados/ResultadoEdit2.aspx b/WebLab/Resultados/ResultadoEdit2.aspx index 94584fc9..dbeda29e 100644 --- a/WebLab/Resultados/ResultadoEdit2.aspx +++ b/WebLab/Resultados/ResultadoEdit2.aspx @@ -645,8 +645,7 @@ onclick="btnValidarPendiente_Click" Visible="false" ValidationGroup="0" Width="150px" TabIndex="600" />   - -  Descargar PDF + @@ -729,7 +728,7 @@ - + @@ -1233,8 +1232,8 @@ $('