private void dgAtencionesMPA_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1 && e.RowIndex >= 0) { atencion = atenciones[e.RowIndex]; } }
private void CargarAtencionesSinMuestra() { dgAtencionesMPA.Rows.Clear(); atenciones = acciones.listaAtencionesPagadasDeMedico(FrmLogin.usuarioLogeado.Personal.PERS_MEDICO.FirstOrDefault().ID_PERSONAL_MEDICO); if (atenciones != null) { if (atenciones.Count > 0) { foreach (ATENCION_AGEN x in atenciones) { dgAtencionesMPA.Rows.Add(x.PACIENTE.NOMBRES_PACIENTE + " " + x.PACIENTE.APELLIDOS_PACIENTE, x.FECHOR.Value.ToString()); } atencion = atenciones[0]; btnMuestraLista.Enabled = true; } else { btnMuestraLista.Enabled = false; } } else { btnMuestraLista.Enabled = false; } }
private void btnAnular_Click(object sender, EventArgs e) { string mensajeCorrecto = "Atención anulada correctamente"; string mensajeError = string.Empty; bool res1 = false, res2 = false; bool necesitaDevolucion = false; try { ATENCION_AGEN atencion = new ATENCION_AGEN(); using (var context = new CMHEntities()) { atencion = context.ATENCION_AGEN.Find(((ComboboxItem)lstAtenciones.SelectedItem).Value); atencion.ESTADO_ATEN = context.ESTADO_ATEN.Find(atencion.ID_ESTADO_ATEN); if (atencion.ESTADO_ATEN.NOM_ESTADO_ATEN.ToUpper() == "PAGADO") { txtRazon.Enabled = true; necesitaDevolucion = true; } else { txtRazon.Enabled = false; } } res1 = at.anularAtencion(atencion); if (atencion.ESTADO_ATEN.NOM_ESTADO_ATEN.ToUpper() == "PAGADO") { res2 = at.devolverPago(pago, txtRazon.Text); } ActualizarLista(); } catch (Exception ex) { mensajeError = "Error al anular atención"; } if (!necesitaDevolucion && res1) { MessageBox.Show(mensajeCorrecto, "Creada", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { if (res1 && res2) { MessageBox.Show(mensajeCorrecto, "Creada", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show(mensajeError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void lstAtenciones_SelectedIndexChanged(object sender, EventArgs e) { lblError.Visible = true; lblError.Text = "Consultando aseguradora..."; lblError.ForeColor = System.Drawing.Color.Violet; mostrarLabelDescuento(); try { ATENCION_AGEN atencion = new ATENCION_AGEN(); PACIENTE paciente = new PACIENTE(); PRESTACION prestacion = new PRESTACION(); ResultadoVerificacionSeguro seguro = new ResultadoVerificacionSeguro(); using (var context = new CMHEntities()) { atencion = context.ATENCION_AGEN.Find(((ComboboxItem)lstAtenciones.SelectedItem).Value); paciente = context.PACIENTE.Find(atencion.ID_PACIENTE); prestacion = context.PRESTACION.Find(atencion.ID_PRESTACION); } seguro = at.verificarSeguro(prestacion, paciente); lblSubtotal.Text = atencion.PRESTACION.PRECIO_PRESTACION.ToString(); lblTotal.Text = seguro.Descuento.ToString(); if (seguro.Aseguradora == "No tiene seguro") { lblTotal.Text = atencion.PRESTACION.PRECIO_PRESTACION.ToString(); lblDescuento.Text = "0"; } else { lblTotal.Text = seguro.Descuento.ToString(); lblDescuento.Text = (int.Parse(lblSubtotal.Text) - int.Parse(lblTotal.Text)).ToString(); } lblAseguradora.Text = seguro.Aseguradora; btnIngresar.Enabled = true; lblError.Visible = false; } catch (Exception ex) { lblError.Visible = true; lblError.Text = "Error al buscar descuento"; lblError.ForeColor = System.Drawing.Color.Red; lblSubtotal.Text = string.Empty; lblTotal.Text = string.Empty; lblDescuento.Text = string.Empty; btnIngresar.Enabled = false; } }
private void btnCrearResultado_CAM_Click(object sender, EventArgs e) { bool res; try { AccionesTerminal at = new AccionesTerminal(); ConversorBase64 conversor = new ConversorBase64(); RES_ATENCION resultadoAtencion = new RES_ATENCION(); resultadoAtencion.ATENCION_ABIERTA = false; resultadoAtencion.COMENTARIO = rtComentario_CAM.Text; resultadoAtencion.ID_ATENCION_AGEN = ((ComboboxItem)lstAtenciones_CAM.SelectedItem).Value; string clob = conversor.convertirABase64(file); resultadoAtencion.ARCHIVO_B64 = clob; string extension = Path.GetExtension(file).ToString().Substring(1, 3); resultadoAtencion.EXT_ARCHIVO = extension; //Busque atención ATENCION_AGEN atencionAg = at.buscarAtencionAgendadaID(((ComboboxItem)lstAtenciones_CAM.SelectedItem).Value); //Actualice atención res = at.cerrarOrdenDeAnalisis(atencionAg, file); if (res) { res = at.nuevoResultadoAtencion(resultadoAtencion); } actualizarBloquesMisticos(); } catch (Exception ex) { res = false; } if (res == true) { MessageBox.Show("Creado el resultado de atención", "Creada", MessageBoxButtons.OK, MessageBoxIcon.None); } else { MessageBox.Show("Error al crear resultado de atención", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnIngresar_Click(object sender, EventArgs e) { string mensajeCorrecto = "Paciente ingresado correctamente"; string mensajeError = string.Empty; bool res1 = false, res2 = false; try { UsuarioLogeado usuario = FrmLogin.usuarioLogeado; ATENCION_AGEN atencion = new ATENCION_AGEN(); PAGO pago = new PAGO(); CAJA caja = new CAJA(); using (var context = new CMHEntities()) { atencion = context.ATENCION_AGEN.Find(((ComboboxItem)lstAtenciones.SelectedItem).Value); } caja = at.buscarCajaAbierta(usuario.Personal.FUNCIONARIO.FirstOrDefault()); pago.ID_ATENCION_AGEN = atencion.ID_ATENCION_AGEN; pago.MONTO_PAGO = int.Parse(lblTotal.Text); pago.ID_CAJA = caja.ID_CAJA; res1 = at.ingresarPaciente(atencion); res2 = at.registrarPago(pago, lblAseguradora.Text, int.Parse(lblDescuento.Text)); ActualizarLista(); } catch (Exception ex) { mensajeError = "Error al ingresar paciente"; } if (res1 && res2) { MessageBox.Show(mensajeCorrecto, "Creada", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show(mensajeError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAgendar_Click(object sender, EventArgs e) { string mensajeCorrecto = "Atención agendada correctamente"; string mensajeError = string.Empty; lblError_ACM.Visible = false; try { AccionesTerminal at = new AccionesTerminal(); ATENCION_AGEN atencion = new ATENCION_AGEN(); PACIENTE paciente = new PACIENTE(); PRESTACION prestacion = new PRESTACION(); ESTADO_ATEN estado = new ESTADO_ATEN(); PERS_MEDICO personalMedico = new PERS_MEDICO(); BLOQUE bloque = new BLOQUE(); if (dtFecha_ACM.Value < DateTime.Today) { mensajeError = "La fecha de atención ha expirado"; } else { using (var context = new CMHEntities()) { estado = context.ESTADO_ATEN.Where(d => d.NOM_ESTADO_ATEN.ToUpper() == "VIGENTE").FirstOrDefault(); personalMedico = context.PERS_MEDICO.Find((int)cmbPersonal_ACM.SelectedValue); } if (txtRut_ACM.Text == string.Empty || txtDv_ACM.Text == string.Empty) { mensajeError = "Complete los campos de RUT"; } else { paciente = at.buscarPaciente(int.Parse(txtRut_ACM.Text), txtDv_ACM.Text.ToUpper()); if (!Util.isObjetoNulo(paciente)) { atencion.FECHOR = dtFecha_ACM.Value; atencion.ID_PACIENTE = paciente.ID_PACIENTE; atencion.ID_PRESTACION = (int)cmbPrestacion_ACM.SelectedValue; atencion.ID_ESTADO_ATEN = estado.ID_ESTADO_ATEN; atencion.ID_PERS_ATIENDE = (int)cmbPersonal_ACM.SelectedValue; atencion.ID_BLOQUE = ((ComboboxItem)cmbHora_ACM.SelectedItem).Value; atencion.OBSERVACIONES = rtObservacion.Text; atencion.ID_PERS_SOLICITA = FrmLogin.usuarioLogeado.Personal.ID_PERSONAL; if (!at.agendarAtencion(atencion)) { mensajeError = "Error al agendar atención"; } actualizarBloques(); } else { mensajeError = "Paciente no encontrado"; } } } } catch (Exception ex) { mensajeError = "Error al agendar atención"; } if (mensajeError == string.Empty) { MessageBox.Show(mensajeCorrecto, "Creada", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show(mensajeError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void lstAtenciones_SelectedIndexChanged(object sender, EventArgs e) { mostrarLabelDescuento(); try { ATENCION_AGEN atencion = new ATENCION_AGEN(); PACIENTE paciente = new PACIENTE(); PRESTACION prestacion = new PRESTACION(); BONO bono = new BONO(); ASEGURADORA aseguradora = new ASEGURADORA(); ResultadoVerificacionSeguro seguro = new ResultadoVerificacionSeguro(); bool necesitaDevolucion = false; using (var context = new CMHEntities()) { atencion = context.ATENCION_AGEN.Find(((ComboboxItem)lstAtenciones.SelectedItem).Value); atencion.ESTADO_ATEN = context.ESTADO_ATEN.Find(atencion.ID_ESTADO_ATEN); if (atencion.ESTADO_ATEN.NOM_ESTADO_ATEN.ToUpper() == "PAGADO") { necesitaDevolucion = true; } if (necesitaDevolucion) { paciente = context.PACIENTE.Find(atencion.ID_PACIENTE); prestacion = context.PRESTACION.Find(atencion.ID_PRESTACION); pago = context.PAGO.Where(d => d.ID_ATENCION_AGEN == atencion.ID_ATENCION_AGEN).FirstOrDefault(); if (pago.ID_BONO != null) { bono = context.BONO.Find(pago.ID_BONO); aseguradora = context.ASEGURADORA.Find(bono.ID_ASEGURADORA); } } } if (necesitaDevolucion) { lblSubtotal.Text = atencion.PRESTACION.PRECIO_PRESTACION.ToString(); lblTotal.Text = pago.MONTO_PAGO.ToString(); if (pago.ID_BONO != null) { lblDescuento.Text = pago.BONO.CANT_BONO.ToString(); lblAseguradora.Text = aseguradora.NOM_ASEGURADORA; } else { lblDescuento.Text = "0"; lblAseguradora.Text = "No tiene seguro"; } btnAnular.Enabled = true; lblError.Visible = false; txtRazon.Enabled = true; } else { txtRazon.Enabled = false; btnAnular.Enabled = true; } } catch (Exception ex) { lblError.Visible = true; lblError.Text = "Error al buscar pago"; lblError.ForeColor = System.Drawing.Color.Red; lblSubtotal.Text = string.Empty; lblTotal.Text = string.Empty; lblDescuento.Text = string.Empty; btnAnular.Enabled = false; } }