Esempio n. 1
0
        private void CargarDatosEnDGVOrden()
        {
            LogicaOrden    enlaceOrden    = new LogicaOrden();
            LogicaPaciente enlacePaciente = new LogicaPaciente();

            ordenes = enlaceOrden.ObtenerOrdenesByFechaByEstado(PickerInit.Value, PickerEnd.Value, (EstadoOrden)ComboEstado.SelectedIndex);
            tabla.Clear();
            this.SuspendLayout();
            DGVOrden.SuspendLayout();
            foreach (Orden orden in ordenes.Values)
            {
                DataRow  row = tabla.NewRow();
                Paciente pac = enlacePaciente.ObtenerPerfilPorId(orden.IdPaciente);
                row[0] = orden.IdData;                                                                                                                            //Orden Detalle
                row[1] = pac.Dni;
                row[2] = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(pac.Nombre + " " + pac.PrimerApellido + " " + pac.SegundoApellido); //Examen
                row[3] = enlaceOrden.ObtenerDescripcion(orden);
                row[4] = orden.FechaRegistro;
                row[5] = orden.Boleta;
                row[6] = DiccionarioGeneral.GetInstance().EstadoOrden[Convert.ToInt32(orden.Estado)];
                tabla.Rows.Add(row);
            }
            this.DGVOrden.ClearSelection();
            DGVOrden.ResumeLayout(false);
            this.ResumeLayout(false);
        }
Esempio n. 2
0
        private void RellenarOrdenes()
        {
            LogicaOrden enlaceOrden = new LogicaOrden();

            ordenes = enlaceOrden.ObtenerOrdenesByPacienteByFechaByEstado(perfil, PickerInit.Value, PickerEnd.Value, (EstadoOrden)ComboEstado.SelectedIndex);
            if (ordenes.Count > 0)
            {
                Dictionary <int, string> listOrden = new Dictionary <int, string>();
                foreach (Orden or in ordenes.Values)
                {
                    listOrden.Add(or.IdData, or.IdData + "-" + (or.Boleta == "" ? "Sin Boleta" : or.Boleta) + " (" + or.FechaRegistro + ")");
                }

                ComboBoxOrden.DataSource    = new BindingSource(listOrden, null);
                ComboBoxOrden.DisplayMember = "Value";
                ComboBoxOrden.ValueMember   = "Key";

                foreach (int k in listOrden.Keys)
                {
                    ComboBoxOrden.SelectedValue = k;
                }
            }
            ComboBoxOrden.Visible = ordenes.Count > 0;
            LabelOrden.Visible    = ordenes.Count > 0;
        }
Esempio n. 3
0
        private System.Data.DataTable ObtenerTablaFormatoDatosReporteEconomicoMedico(int ano, int mes, int idMedico)
        {
            BLTarifario enlace = new BLTarifario();
            Tarifario   tar    = enlace.ObtenerTarifario();

            System.Data.DataTable tablaInterna = new System.Data.DataTable();
            try
            {
                LogicaOrden enlaceOrden   = new LogicaOrden();
                List <int>  codigosExamen = new List <int>();


                Dictionary <int, Dictionary <int, int> > reporteAcumulado = enlaceOrden.ObtenerReporteAcumuladoMensual(ano, mes, idMedico);

                Dictionary <int, Dictionary <int, int> > reporteCantidad = enlaceOrden.ObtenerReporteCantidadMensual(ano, mes, idMedico);

                tablaInterna.Columns.Add("id", typeof(int));
                tablaInterna.Columns.Add("nombre", typeof(string));
                tablaInterna.Columns.Add("nroP", typeof(int));
                tablaInterna.Columns.Add("acuP", typeof(int));
                tablaInterna.Columns.Add("nroS", typeof(int));
                tablaInterna.Columns.Add("acuS", typeof(int));
                tablaInterna.Columns.Add("nroE", typeof(int));
                tablaInterna.Columns.Add("acuE", typeof(int));
                tablaInterna.Columns.Add("precioUn", typeof(double));
                tablaInterna.Columns.Add("totalMes", typeof(double));
                tablaInterna.Columns.Add("cob", typeof(int));

                foreach (int idAnalisis in ListaAnalisis.GetInstance().Coleccion.Keys)
                {
                    DataRow row = tablaInterna.NewRow();

                    row[0] = idAnalisis;
                    row[1] = ListaAnalisis.GetInstance().Analisis[idAnalisis].Nombre;

                    row[2] = (existDataInDictionary(idAnalisis, reporteCantidad[0]) ? reporteCantidad[0][idAnalisis] : 0);   //contador P
                    row[3] = (existDataInDictionary(idAnalisis, reporteAcumulado[0]) ? reporteAcumulado[0][idAnalisis] : 0); //acumulador P

                    row[4] = (existDataInDictionary(idAnalisis, reporteCantidad[1]) ? reporteCantidad[1][idAnalisis] : 0);   // Contador S
                    row[5] = (existDataInDictionary(idAnalisis, reporteAcumulado[1]) ? reporteAcumulado[1][idAnalisis] : 0); //acumulador S

                    row[6] = (existDataInDictionary(idAnalisis, reporteCantidad[2]) ? reporteCantidad[2][idAnalisis] : 0);   //Contador Ex
                    row[7] = (existDataInDictionary(idAnalisis, reporteAcumulado[2]) ? reporteAcumulado[2][idAnalisis] : 0); //acumulador Ex

                    row[8] = enlace.ObtenerTarifarioDetalle(tar, idAnalisis).Precio;
                    row[9] = (int)row[2] * enlace.ObtenerTarifarioDetalle(tar, idAnalisis).Precio;


                    row[10] = (int)row[2] + (int)row[4] + (int)row[6] + (int)row[3] + (int)row[5] + (int)row[7];

                    tablaInterna.Rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(tablaInterna);
        }
Esempio n. 4
0
        private void BtnAnular_Click(object sender, EventArgs e)
        {
            LogicaOrden enlaceLogicaOrden = new LogicaOrden();

            enlaceLogicaOrden.EliminarOrden(orden);
            ((ControlOrden)this.Parent.Parent).ModeBtnFuncion(true);
            this.Dispose();
        }
Esempio n. 5
0
        private void BtnRegistrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (tabla.Rows.Count == 0)
                {
                    throw new Exception("Listado de Examenes: La lista esta vacia.");
                }
                if (Perfil == null)
                {
                    throw new Exception("Perfil: Se necesita un perfil de paciente.");
                }

                orden                    = new Orden();
                orden.Boleta             = CampBoleta.Text;
                orden.FechaRegistro      = PickerTime.Value;
                orden.IdPaciente         = Perfil.IdData;
                orden.UltimaModificacion = PickerTime.Value;
                orden.IdConsultorio      = (int)ComboBoxConsultorio.SelectedValue;
                orden.IdMedico           = (int)ComboBoxMedico.SelectedValue;
                if (Perfil.Sexo == Sexo.Mujer)
                {
                    orden.EstadoPaciente = (CheckBoxGestante.Checked ? PacienteEstado.Gestante:PacienteEstado.Normal);
                }
                else
                {
                    orden.EstadoPaciente = PacienteEstado.Normal;
                }

                Dictionary <int, OrdenDetalle> detalles = new Dictionary <int, OrdenDetalle>();
                OrdenDetalle detalle = null;
                int          i       = 0;

                foreach (DataRow r in tabla.Rows)
                {
                    detalle = new OrdenDetalle();
                    detalle.IdDataPaquete = (int)r[0];
                    detalle.Cobertura     = (int)r[3];
                    detalles.Add(i, detalle);
                    i++;
                }

                orden.Detalle = detalles;

                LogicaOrden enlaceOrden = new LogicaOrden();
                enlaceOrden.AgregarOrden(orden);
                MessageBox.Show("Orden: Se han registrado correctamente los datos.", "Confirmación");
                DeshabilitarFormulario();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Advertencia");
            }
        }
Esempio n. 6
0
        private void BtnModificar_Click(object sender, EventArgs e)
        {
            FormModificarOrden formModificarOrden = new FormModificarOrden();

            formModificarOrden.Perfil = Perfil;
            formModificarOrden.Orden  = Orden;
            formModificarOrden.InicializarDatosFormulario();
            formModificarOrden.ShowDialog();
            LogicaOrden enlaceOrden = new LogicaOrden();

            Orden = enlaceOrden.ObtenerOrden(orden.IdData);
            CargarDatos();
        }
Esempio n. 7
0
        private System.Data.DataTable ObtenerTablaFormatoDatosReporteResultado(int ano, int mes)
        {
            BLTarifario enlace = new BLTarifario();
            Tarifario   tar    = enlace.ObtenerTarifario();

            System.Data.DataTable tablaInterna = new System.Data.DataTable();
            try
            {
                LogicaOrden     enlaceOrden = new LogicaOrden();
                List <object[]> resultados  = enlaceOrden.ObtenerReporteResultado(ano, mes);

                tablaInterna.Columns.Add("dni", typeof(string));
                tablaInterna.Columns.Add("nombre", typeof(string));
                tablaInterna.Columns.Add("apellido1", typeof(string));
                tablaInterna.Columns.Add("apellido2", typeof(string));
                tablaInterna.Columns.Add("edad", typeof(double));
                tablaInterna.Columns.Add("sexo", typeof(string));
                tablaInterna.Columns.Add("gestante", typeof(string));
                tablaInterna.Columns.Add("Examen", typeof(string));
                tablaInterna.Columns.Add("respuesta", typeof(string));
                tablaInterna.Columns.Add("nota", typeof(string));
                tablaInterna.Columns.Add("cobertura", typeof(string));
                tablaInterna.Columns.Add("estado", typeof(string));

                foreach (object[] obt in resultados)
                {
                    DataRow row = tablaInterna.NewRow();
                    row[0]  = obt[1].ToString();
                    row[1]  = obt[2].ToString();
                    row[2]  = obt[3].ToString();
                    row[3]  = obt[4].ToString();
                    row[4]  = obt[5];
                    row[5]  = DiccionarioGeneral.GetInstance().TipoSexo[(int)obt[6]];
                    row[6]  = Convert.ToBoolean(obt[7])?"SI":"NO";
                    row[7]  = Plantillas.GetInstance().GetPlantilla((int)obt[0]).Nombre;
                    row[8]  = obt[8].ToString().Replace('.', ',');
                    row[9]  = obt[9];
                    row[10] = DiccionarioGeneral.GetInstance().TipoCobertura[(int)obt[10]];
                    row[11] = DiccionarioGeneral.GetInstance().EstadoExamen[(int)obt[11]];

                    tablaInterna.Rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(tablaInterna);
        }
Esempio n. 8
0
        private void BtnPrint_Click(object sender, EventArgs e)
        {
            LogicaOrden enlace = new LogicaOrden();

            Dictionary <int, Examen> examenes = new Dictionary <int, Examen>();
            Orden orden = ordenes[(int)ComboBoxOrden.SelectedValue];

            foreach (DataGridViewRow r in DGVExamen.SelectedRows)
            {
                examenes.Add((int)r.Cells[1].Value, examenesGeneral[(int)r.Cells[1].Value]);
            }
            Impresora printer = new Impresora();

            printer.ContruirVistaPreviaExamenPaciente(orden, examenes);
        }
Esempio n. 9
0
        private void LlenarTablaOrdenes()
        {
            LogicaOrden enlaceOrden = new LogicaOrden();

            tablaOrden.Clear();
            diccionarioOrden = enlaceOrden.ObtenerOrdenesByPacienteByFechaByEstado(Perfil, PickerInit.Value, PickerEnd.Value, (EstadoOrden)ComboEstado.SelectedIndex);
            this.SuspendLayout();
            foreach (Orden ord in diccionarioOrden.Values)
            {
                DataRow row = tablaOrden.NewRow();
                row[0] = ord.IdData;
                row[1] = ord.IdData;
                row[2] = ord.FechaRegistro.ToShortDateString();
                tablaOrden.Rows.Add(row);
            }
            this.ResumeLayout(false);
        }
Esempio n. 10
0
        private System.Data.DataTable ObtenerTablaFormatoReporteEdad(int year, int month, int cobertura)
        {
            System.Data.DataTable tablaInterna = new System.Data.DataTable();
            // Configuracion de Tablas
            tablaInterna.Columns.Add("id", typeof(int));
            tablaInterna.Columns.Add("examen", typeof(string));

            for (int i = 0; i <= 19; i++)
            {
                tablaInterna.Columns.Add("c" + i, typeof(int));
            }
            for (int i = 20; i < 76; i += 5)
            {
                tablaInterna.Columns.Add("c" + i, typeof(int));
            }
            tablaInterna.Columns.Add("c80", typeof(int));

            try
            {
                LogicaOrden enlaceOrden = new LogicaOrden();

                List <int[]> general = enlaceOrden.ObtenerReporteEdad(cobertura, year, month);

                foreach (int[] fila in general)
                {
                    DataRow row = tablaInterna.NewRow();
                    row[0] = fila[0];
                    row[1] = ListaAnalisis.GetInstance().Analisis[fila[0]].Nombre;
                    for (int j = 1; j < fila.Length; j++)
                    {
                        row[j + 1] = fila[j];
                    }

                    tablaInterna.Rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(tablaInterna);
        }
Esempio n. 11
0
        private void CargarDatosEnDGVExamen(Orden orden)
        {
            LogicaOrden  enlaceOrden  = new LogicaOrden();
            LogicaExamen enlaceExamen = new LogicaExamen();

            DGVExamen.SuspendLayout();
            tabla.Clear();
            examenes = enlaceExamen.RecuperarExamenes(orden);

            foreach (Examen ex in examenes.Values)
            {
                DataRow row             = tabla.NewRow();
                String  nombrePaquete   = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToLower(ControlSistemaInterno.ListaAnalisis.GetInstance().GetAnalisisById(orden.Detalle[ex.IdOrdenDetalle].IdDataPaquete).Nombre));
                String  nombrePlantilla = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToLower(Plantillas.GetInstance().GetPlantilla(ex.IdPlantilla).Nombre));
                row[0] = (nombrePaquete == nombrePlantilla) ? nombrePaquete : (nombrePaquete + ":" + nombrePlantilla);
                row[1] = DiccionarioGeneral.GetInstance().EstadoExamen[(int)ex.Estado];
                row[2] = ex.IdData;//Examen
                tabla.Rows.Add(row);
            }
            DGVExamen.ResumeLayout(false);
        }
Esempio n. 12
0
        private void BtnAutorizacion_Click(object sender, EventArgs e)
        {
            LogicControlSistema logicaSistema = new LogicControlSistema();
            LogicaExamen        enlaceExamen  = new LogicaExamen();
            LogicaOrden         enlaceOrden   = new LogicaOrden();

            ConfiguracionExamen.GetInstance().Loading = true;
            if (!logicaSistema.GetPase())
            {
                ValidarAutorizacion();
                CheckEstado.Checked = false;
            }
            if (logicaSistema.GetPase())
            {
                examenes[idExamenSelected].Estado = EstadoExamen.EnProceso;
                CheckEstado.Checked = false;
                enlaceExamen.GuardarExamen(examenes[idExamenSelected]);
                enlaceOrden.ActualizarOrden(examenes, orden);
                ActualizarDGVEstadoExamen();
                HabilitarTools();
                UnblockPanelExamen();
            }
            ConfiguracionExamen.GetInstance().Loading = false;
        }
Esempio n. 13
0
        private void FormExamenGeneral_FormClosing(object sender, FormClosingEventArgs e)
        {
            LogicaOrden logica = new LogicaOrden();

            logica.ActualizarOrden(examenes, orden);
        }
Esempio n. 14
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (tabla.Rows.Count == 0)
                {
                    throw new Exception("Listado de Examenes: La lista esta vacia.");
                }

                Orden ordenTemp = new Orden();
                ordenTemp.IdData             = orden.IdData;
                ordenTemp.Estado             = orden.Estado;
                ordenTemp.Boleta             = CampBoleta.Text;
                ordenTemp.FechaRegistro      = PickerTime.Value;
                ordenTemp.IdPaciente         = Perfil.IdData;
                ordenTemp.UltimaModificacion = DateTime.Now;
                ordenTemp.IdConsultorio      = (int)ComboBoxConsultorio.SelectedValue;
                ordenTemp.IdMedico           = (int)ComboBoxMedico.SelectedValue;
                if (Perfil.Sexo == Sexo.Mujer)
                {
                    ordenTemp.EnGestacion = CheckBoxGestante.Checked;
                }


                OrdenDetalle detalle = null;

                //CREANDO DETALLE UPDATE
                foreach (int idUnique in IndexExist)
                {
                    foreach (DataRow r in tabla.Rows)
                    {
                        if ((int)r[4] == idUnique)
                        {
                            detalle               = new OrdenDetalle();
                            detalle.IdData        = (int)r[4];
                            detalle.IdDataPaquete = (int)r[0];
                            detalle.Cobertura     = (int)r[3];
                            detalleUpdate.Add(detalle.IdData, detalle);
                        }
                    }
                }

                //CREANDO DETALLE INSERT
                foreach (int idUnique in IndexInsert)
                {
                    foreach (DataRow r in tabla.Rows)
                    {
                        if ((int)r[4] == idUnique)
                        {
                            detalle               = new OrdenDetalle();
                            detalle.IdData        = (int)r[4];
                            detalle.IdDataPaquete = (int)r[0];
                            detalle.Cobertura     = (int)r[3];
                            detalleInsert.Add(detalle.IdData, detalle);
                        }
                    }
                }

                LogicaOrden enlaceOrden = new LogicaOrden();
                enlaceOrden.ActualizarOrden(ordenTemp);

                ordenTemp.Detalle = detalleUpdate;
                enlaceOrden.ActualizarOrdenDetalle(ordenTemp);

                ordenTemp.Detalle = detalleInsert;
                enlaceOrden.AgregarOrdenDetalle(ordenTemp);

                ordenTemp.Detalle = detalleDeleted;
                enlaceOrden.EliminarOrdenDetalle(ordenTemp);

                MessageBox.Show("Orden: Se han actualizado correctamente los datos.", "Confirmación");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Advertencia");
            }
        }