private void thismonth_Click(object sender, EventArgs e) { CrystalReport1 reporte = new CrystalReport1(); reporte.SetParameterValue("@Fecha1", new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).ToString("MM/dd/yyyy")); reporte.SetParameterValue("@Fecha2", DateTime.Today.ToString("MM/dd/yyyy")); crystalReportViewer1.ReportSource = reporte; }
private void lastmonth_Click(object sender, EventArgs e) { CrystalReport1 reporte = new CrystalReport1(); reporte.SetParameterValue("@Fecha1", DateTime.Today.AddDays(-30).ToString("MM/dd/yyyy")); reporte.SetParameterValue("@Fecha2", DateTime.Today.ToString("MM/dd/yyyy")); crystalReportViewer1.ReportSource = reporte; }
private void button1_Click(object sender, EventArgs e) { CrystalReport1 reporte = new CrystalReport1(); reporte.SetParameterValue("@Fecha1", Fecha1.Value.ToString("MM/dd/yyyy")); reporte.SetParameterValue("@Fecha2", Fecha2.Value.ToString("MM/dd/yyyy")); crystalReportViewer1.ReportSource = reporte; Fecha1.Enabled = false; Fecha2.Enabled = false; button1.Enabled = false; }
public ActionResult PrintOrder(int OrderID) { //Response.Buffer = false; //Response.ClearContent(); //Response.ClearHeaders(); //rp.SetDatabaseLogon("Diem", "", "DESKTOP-HA2TCUF", "CoffeeShopDB", false); Order order = info.GetOrderByOrderID(OrderID).SingleOrDefault(); CrystalReport1 rp = new CrystalReport1(); if (order.Desc == "ServeAtCafe" || order.Desc == "TakeAway") { string status = "Paid"; info.UpdateOrderStatus(OrderID, status); } else { string Status1 = "Closed", Status2 = "Delivery"; info.UpdateOrderStatus(OrderID, Status1); info.UpdateShipDetailStatus(OrderID, Status2); } if (order.PosID != 0) { int PosID = Convert.ToInt32(order.PosID); info.UpdateStatusPostion(PosID, "Available"); //rp.SetParameterValue("@orderid", OrderID); } rp.SetParameterValue("@OrderID", OrderID); Stream stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "OrderCustomer.pdf")); }
private void frmReport_Load(object sender, EventArgs e) { CrystalReport1 rep = new CrystalReport1(); rep.SetDatabaseLogon("sa", "sa2012"); crystalReportViewer1.ReportSource = rep; crystalReportViewer1.Refresh(); rep.SetParameterValue("MaHDB", _maHD); }
private void FrmReporteEtiqueta_Load(object sender, EventArgs e) { //DataTable datos = new DataTable("CodigoDeBarra"); //datos.Columns.Add("Nombre", typeof(int)); //datos.Columns.Add("CodigoBarra", typeof(string)); //datos.Rows.Add(codigoBarra); CrystalReport1 barra = new CrystalReport1(); barra.SetParameterValue(0, codigoBarra); //reporte.Load(""); //reporte.SetDataSource(datos); rvImprimirEtiqueta.ReportSource = barra; }
private void Window_Loaded(object sender, RoutedEventArgs e) { CrystalReport1 rpt = new CrystalReport1(); //login rpt.SetDatabaseLogon("proyekpcs", "proyekpcs"); ParameterDiscreteValue paramKode = new ParameterDiscreteValue(); paramKode.Value = kodeht; rpt.SetParameterValue("kodehtrans", paramKode); //sambungkan ke crystal report invoice.ViewerCore.ReportSource = rpt; }
private void PnlCertificado_Click(object sender, EventArgs e) { DataTable TablaPaciente = new DataTable(); ClsSqlServer NuevoSql = new ClsSqlServer(); NuevoSql.CadenaCnn = Historia_Clinica.Conexion.CadenaConexion.cadena(); NuevoSql.Conectar(); string Documento = DocumentoP; //SE REALIZAN LAS RESPECTIVAS COLUMNAS Y SE LLENAN LAS TABLAS CON LA INFORMACIÓN QUE SE REQUIERE PARA EL REPORTE string Query = "SELECT dbo.Paciente.Pac_Nombre1+ ' ' + isnull(dbo.Paciente.Pac_Nombre2,'') "+ " +' '+dbo.Paciente.Pac_Apellido1+ ' '+isnull(dbo.Paciente.Pac_Apellido2,'') As Nombres, "+ " dbo.Paciente.Pac_TipoIdentificacion, dbo.Paciente.Pac_TipoIdentificacion+' '+dbo.Paciente.Pac_Identificacion As Pac_Identificacion, "+ " dbo.Paciente.Pac_FechaNacimiento, dbo.Genero.Gen_Descripcion, "+ " dbo.Paciente.Pac_CodCiudad, dbo.Paciente.Pac_Direccion, "+ " dbo.Paciente.Pac_CodNivelEducativo, dbo.Paciente.Pac_CodProfesion,Profesion.Prof_Descripcion, "+ " dbo.TipoSangre.TipSan_Descripcion, dbo.Paciente.Pac_EstadoCivil, "+ " dbo.EstadoCivil.EstCivil_Descripcion,Pac_Telefono "+ "FROM dbo.Paciente LEFT OUTER JOIN "+ " dbo.EstadoCivil ON dbo.Paciente.Pac_EstadoCivil = "+ " dbo.EstadoCivil.EstCivil_Codigo LEFT OUTER JOIN "+ " dbo.TipoSangre ON dbo.Paciente.Pac_TipoSangre = "+ " dbo.TipoSangre.TipSan_Codigo LEFT OUTER JOIN "+ " dbo.Genero ON dbo.Paciente.Pac_CodGenero = dbo.Genero.Gen_Codigo inner join Profesion on Profesion.Prof_Codigo = dbo.Paciente.Pac_CodProfesion "+ "WHERE Pac_Identificacion='"+ Documento + "'"; TablaPaciente = NuevoSql.LlenarTabla(Query); //FIN PACIENTE string NumeroEntrada = NumEntradaP; string Enfasis = EnfasisP; string Fecha = FechaP; string ConceptoTarea = ConceptoP; string examenes = ""; string query = "SELECT dbo.Examen.Exam_Descripcion, dbo.EntradaHistoria.Entr_Numero, dbo.TipResultado.TipRes_Descripcion " + "FROM dbo.ExamenPracticado INNER JOIN " + "dbo.Examen ON dbo.ExamenPracticado.ExaPrac_Examen_Codigo = dbo.Examen.Exam_Codigo INNER JOIN " + "dbo.EntradaHistoria ON dbo.ExamenPracticado.ExaPrac_Entrada_Numero = dbo.EntradaHistoria.Entr_Numero INNER JOIN " + "dbo.TipResultado ON dbo.ExamenPracticado.ExaPrac_Resultado = dbo.TipResultado.TipRes_Codigo INNER JOIN " + "dbo.TipResultado AS TipResultado_1 ON dbo.ExamenPracticado.ExaPrac_Resultado = TipResultado_1.TipRes_Codigo WHERE dbo.EntradaHistoria.Entr_Numero=" + NumeroEntrada; DataTable TablaExamenes = new DataTable(); TablaExamenes = NuevoSql.LlenarTabla(query); for (int i = 0; i < TablaExamenes.Rows.Count; i++) { string x = TablaExamenes.Rows[i]["Exam_Descripcion"].ToString() + " (" + TablaExamenes.Rows[i]["TipRes_Descripcion"].ToString() + ")"; if (i == 0) { examenes = x; } else { examenes = examenes + " " + x; } } //ENVIÓ DE PARAMETROS AL REPORTE string edad = Convert.ToString(CalcularEdad(Convert.ToDateTime(TablaPaciente.Rows[0]["Pac_FechaNacimiento"]))) + " " + "Años"; FrmVisualizarReporte f = new FrmVisualizarReporte(); if (RdbCarta.Checked) { CrystalReport1 cry = new CrystalReport1(); cry.SetParameterValue("NombreCompleto", TablaPaciente.Rows[0]["Nombres"]); cry.SetParameterValue("Documento", TablaPaciente.Rows[0]["Pac_Identificacion"]); cry.SetParameterValue("Edad", edad); cry.SetParameterValue("Genero", TablaPaciente.Rows[0]["Gen_Descripcion"]); cry.SetParameterValue("Telefono", TablaPaciente.Rows[0]["Pac_Telefono"].ToString()); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); if (examenes.Trim() == "") { cry.SetParameterValue("ExamenesPracticados", "NO APLICA"); } else { cry.SetParameterValue("ExamenesPracticados", examenes); } cry.SetParameterValue("@NumeroEntrada", Convert.ToInt32(NumeroEntrada)); cry.SetParameterValue("Enfasis", Enfasis); cry.SetParameterValue("FechaExamen", Fecha); if (ConceptoTarea == "") { cry.SetParameterValue("DesAptitud", ""); } else { cry.SetParameterValue("DesAptitud", "CONCEPTO DE APTITUD PARA LA TAREA:"); } cry.SetParameterValue("ConceptoTarea", ConceptoTarea); //PARA EL TIPO DE EXAMEN Query = "SELECT dbo.TipoExamen.TipoExam_Descripcion, " + "dbo.Concepto.Conc_Descripcion " + "FROM dbo.TipoExamen INNER JOIN " + "dbo.EntradaHistoria ON dbo.TipoExamen.TipoExam_Codigo = " + "dbo.EntradaHistoria.Entr_TipoExamenCodigo INNER JOIN " + "dbo.Concepto ON dbo.EntradaHistoria.Entr_Concepto_Codigo = " + "dbo.Concepto.Conc_Codigo where dbo.EntradaHistoria.Entr_Numero= " + NumeroEntrada; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("TipoExamen", TablaPaciente.Rows[0]["TipoExam_Descripcion"].ToString()); cry.SetParameterValue("Concepto", TablaPaciente.Rows[0]["Conc_Descripcion"].ToString()); TablaPaciente = null; //PARA EL NOMBRE DE LA EMPRESA Query = "SELECT Empresa.Empre_RazonSocial,Empresa.Empre_Nit, cargo.Carg_Descripcion as Ocup_Descripcion, InfOcu_Entrada_Numero FROM dbo.InformacionOcupacional inner join Empresa on InfOcu_CodEmpresa=Empresa.Empr_Codigo inner join cargo on cargo.Carg_Codigo = InformacionOcupacional.InfOcu_CodOcupacion WHERE InfOcu_Entrada_Numero=" + NumeroEntrada; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("NombreEmpresa", TablaPaciente.Rows[0]["Empre_RazonSocial"].ToString()); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); cry.SetParameterValue("nit", Configuracion.Nit); cry.SetParameterValue("tel", Configuracion.Telefono); cry.SetParameterValue("direccion", Configuracion.Direccion); cry.SetParameterValue("piepagina", Configuracion.PiePagina); cry.SetParameterValue("nitempresa", TablaPaciente.Rows[0]["Empre_Nit"].ToString()); cry.SetParameterValue("Cargo", TablaPaciente.Rows[0]["Ocup_Descripcion"]); Query = "SELECT dbo.ARL.Arl_Codigo, dbo.ARL.Arl_Descripcion, " + "dbo.EPS.Eps_Codigo, dbo.EPS.Eps_Descripcion, " + "dbo.Paciente.Pac_Identificacion, dbo.Paciente.Pac_Nombre1, " + "dbo.Paciente.Pac_Nombre2, dbo.Paciente.Pac_Apellido1, " + "dbo.Paciente.Pac_Apellido2, dbo.EntradaHistoria.Entr_IdPaciente, " + "dbo.EntradaHistoria.Entr_FechaEntrada, dbo.EntradaHistoria.Entr_Numero " + "FROM dbo.EntradaHistoria RIGHT OUTER JOIN "+ "dbo.EPS INNER JOIN " + "dbo.Paciente ON dbo.EPS.Eps_Codigo = dbo.Paciente.Pac_CodEPS INNER JOIN " + "dbo.ARL ON dbo.Paciente.Pac_CodARL = dbo.ARL.Arl_Codigo ON " + "dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "AND dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "WHERE Pac_Identificacion='" + Documento + "'"; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); if (TablaPaciente.Rows.Count > 0) { cry.SetParameterValue("EPS", TablaPaciente.Rows[0]["Eps_Descripcion"]); cry.SetParameterValue("ARL", TablaPaciente.Rows[0]["Arl_Descripcion"]); } else { cry.SetParameterValue("EPS", ""); cry.SetParameterValue("ARL", ""); } TablaPaciente = null; TablaExamenes = null; //SE VISUALIZA EL REPORTE f.crystalReportViewer1.ReportSource = cry; f.Show(); } else { CrystalReport1Oficio cry = new CrystalReport1Oficio(); cry.SetParameterValue("NombreCompleto", TablaPaciente.Rows[0]["Nombres"]); cry.SetParameterValue("Documento", TablaPaciente.Rows[0]["Pac_Identificacion"]); cry.SetParameterValue("Edad", edad); cry.SetParameterValue("Genero", TablaPaciente.Rows[0]["Gen_Descripcion"]); cry.SetParameterValue("Telefono", TablaPaciente.Rows[0]["Pac_Telefono"].ToString()); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); cry.SetParameterValue("nit", Configuracion.Nit); cry.SetParameterValue("piepagina", Configuracion.PiePagina); if (examenes.Trim() == "") { cry.SetParameterValue("ExamenesPracticados", "NO APLICA"); } else { cry.SetParameterValue("ExamenesPracticados", examenes); } cry.SetParameterValue("@NumeroEntrada", Convert.ToInt32(NumeroEntrada)); cry.SetParameterValue("Enfasis", Enfasis); cry.SetParameterValue("FechaExamen", Fecha); if (ConceptoTarea == "") { cry.SetParameterValue("DesAptitud", ""); } else { cry.SetParameterValue("DesAptitud", "CONCEPTO DE APTITUD PARA LA TAREA:"); } cry.SetParameterValue("ConceptoTarea", ConceptoTarea); //PARA EL TIPO DE EXAMEN Query = "SELECT dbo.TipoExamen.TipoExam_Descripcion, " + "dbo.Concepto.Conc_Descripcion " + "FROM dbo.TipoExamen INNER JOIN " + "dbo.EntradaHistoria ON dbo.TipoExamen.TipoExam_Codigo = " + "dbo.EntradaHistoria.Entr_TipoExamenCodigo INNER JOIN " + "dbo.Concepto ON dbo.EntradaHistoria.Entr_Concepto_Codigo = " + "dbo.Concepto.Conc_Codigo where dbo.EntradaHistoria.Entr_Numero= " + NumeroEntrada; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("TipoExamen", TablaPaciente.Rows[0]["TipoExam_Descripcion"].ToString()); cry.SetParameterValue("Concepto", TablaPaciente.Rows[0]["Conc_Descripcion"].ToString()); TablaPaciente = null; //PARA EL NOMBRE DE LA EMPRESA Query = "SELECT Empresa.Empre_RazonSocial, Empresa.Empre_Nit, cargo.Carg_Descripcion as Ocup_Descripcion, InfOcu_Entrada_Numero FROM dbo.InformacionOcupacional inner join Empresa on InfOcu_CodEmpresa=Empresa.Empr_Codigo inner join cargo on cargo.Carg_Codigo = InformacionOcupacional.InfOcu_CodOcupacion WHERE InfOcu_Entrada_Numero=" + NumeroEntrada; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("NombreEmpresa", TablaPaciente.Rows[0]["Empre_RazonSocial"].ToString()); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); cry.SetParameterValue("nit", Configuracion.Nit); cry.SetParameterValue("tel", Configuracion.Telefono); cry.SetParameterValue("direccion", Configuracion.Direccion); cry.SetParameterValue("piepagina", Configuracion.PiePagina); cry.SetParameterValue("nitempresa", TablaPaciente.Rows[0]["Empre_Nit"].ToString()); cry.SetParameterValue("Cargo", TablaPaciente.Rows[0]["Ocup_Descripcion"]); Query = "SELECT dbo.ARL.Arl_Codigo, dbo.ARL.Arl_Descripcion, " + "dbo.EPS.Eps_Codigo, dbo.EPS.Eps_Descripcion, " + "dbo.Paciente.Pac_Identificacion, dbo.Paciente.Pac_Nombre1, " + "dbo.Paciente.Pac_Nombre2, dbo.Paciente.Pac_Apellido1, " + "dbo.Paciente.Pac_Apellido2, dbo.EntradaHistoria.Entr_IdPaciente, " + "dbo.EntradaHistoria.Entr_FechaEntrada, dbo.EntradaHistoria.Entr_Numero " + "FROM dbo.EntradaHistoria RIGHT OUTER JOIN "+ "dbo.EPS INNER JOIN " + "dbo.Paciente ON dbo.EPS.Eps_Codigo = dbo.Paciente.Pac_CodEPS INNER JOIN " + "dbo.ARL ON dbo.Paciente.Pac_CodARL = dbo.ARL.Arl_Codigo ON " + "dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "AND dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "WHERE Pac_Identificacion='" + Documento + "'"; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); if (TablaPaciente.Rows.Count > 0) { cry.SetParameterValue("EPS", TablaPaciente.Rows[0]["Eps_Descripcion"]); cry.SetParameterValue("ARL", TablaPaciente.Rows[0]["Arl_Descripcion"]); } else { cry.SetParameterValue("EPS", ""); cry.SetParameterValue("ARL", ""); } TablaPaciente = null; TablaExamenes = null; //SE VISUALIZA EL REPORTE f.crystalReportViewer1.ReportSource = cry; f.Show(); } //} //} }
private void DgvDatos_CellClick(object sender, DataGridViewCellEventArgs e) { if (RdbSinAtender.Checked) { //ABIRI FORMULADO DE HISTORIA CLINICA if (e.RowIndex > -1 && e.ColumnIndex == 3) { FrnHistoriaClinica f = new FrnHistoriaClinica(); #region VARIABLES string documento = DgvDatos.CurrentRow.Cells["DgvDatosColDocumento"].Value.ToString(); string edad = DgvDatos.CurrentRow.Cells["DgvDatosColedad"].Value.ToString(); string sexo = DgvDatos.CurrentRow.Cells["DgvDatosColSexo"].Value.ToString(); string fecha = DgvDatos.CurrentRow.Cells["DgvDatosColFecha"].Value.ToString(); string entrada = DgvDatos.CurrentRow.Cells["DgvDatosColEntrada"].Value.ToString(); string efasis = DgvDatos.CurrentRow.Cells["DgvDatosColEnfasis"].Value.ToString(); string Nombres = DgvDatos.CurrentRow.Cells["DgvDatosColNombres"].Value.ToString(); #endregion IdPacientenAtencion = documento; if (ConsultarPaciente()) { #region PASAMOS LOS VALORES A LOS OBJETOS DEL FORMULARIO //ConsultarPaciente(); f.LblDatos.Text = "Tipo de Examen: " + entrada; f.LblDatos1.Text = "Enfasis: " + efasis; f.LblDatos2.Text = "Fecha : " + fecha.Substring(0, 10); f.LblDatos3.Text = "Sexo: " + sexo; f.LblDatos4.Text = "Edad: " + edad; f.TxtNombre.Text = Nombres; f.TxtDocumento.Text = documento; f.SooloVer = false; #endregion f.ShowDialog(); } else { MessageBox.Show("El paciente ya fue atendido", "", MessageBoxButtons.OK); } } } else { #region PARA ABRIR EL REPORTE Y EL FORMULARIO PARA VISUALIZAR LA INFORMACIÓN if (e.RowIndex > -1) { if (e.ColumnIndex == DgvDatosColImprimir.Index) { string Documento = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColDocumento"].Value.ToString(); //SE REALIZAN LAS RESPECTIVAS COLUMNAS Y SE LLENAN LAS TABLAS CON LA INFORMACIÓN QUE SE REQUIERE PARA EL REPORTE string Query = "SELECT dbo.Paciente.Pac_Nombre1+ ' ' + isnull(dbo.Paciente.Pac_Nombre2,'') "+ " +' '+dbo.Paciente.Pac_Apellido1+ ' '+isnull(dbo.Paciente.Pac_Apellido2,'') As Nombres, "+ " dbo.Paciente.Pac_TipoIdentificacion, dbo.Paciente.Pac_TipoIdentificacion+' '+dbo.Paciente.Pac_Identificacion As Pac_Identificacion, "+ " dbo.Paciente.Pac_FechaNacimiento, dbo.Genero.Gen_Descripcion, "+ " dbo.Paciente.Pac_CodCiudad, dbo.Paciente.Pac_Direccion, "+ " dbo.Paciente.Pac_CodNivelEducativo, dbo.Paciente.Pac_CodProfesion,Profesion.Prof_Descripcion, "+ " dbo.TipoSangre.TipSan_Descripcion, dbo.Paciente.Pac_EstadoCivil, "+ " dbo.EstadoCivil.EstCivil_Descripcion,Pac_Telefono "+ "FROM dbo.Paciente LEFT OUTER JOIN "+ " dbo.EstadoCivil ON dbo.Paciente.Pac_EstadoCivil = "+ " dbo.EstadoCivil.EstCivil_Codigo LEFT OUTER JOIN "+ " dbo.TipoSangre ON dbo.Paciente.Pac_TipoSangre = "+ " dbo.TipoSangre.TipSan_Codigo LEFT OUTER JOIN "+ " dbo.Genero ON dbo.Paciente.Pac_CodGenero = dbo.Genero.Gen_Codigo inner join Profesion on Profesion.Prof_Codigo = dbo.Paciente.Pac_CodProfesion "+ "WHERE Pac_Identificacion='"+ Documento + "'"; TablaPaciente = NuevoSql.LlenarTabla(Query); //FIN PACIENTE string NumeroEntrada = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColNumeroHistoria"].Value.ToString(); string Enfasis = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColEnfasis"].Value.ToString(); string Fecha = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColFecha1"].Value.ToString(); string ConceptoTarea = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosconceptoAptitud"].Value.ToString(); string examenes = ""; string query = "SELECT dbo.Examen.Exam_Descripcion, dbo.EntradaHistoria.Entr_Numero, dbo.TipResultado.TipRes_Descripcion " + "FROM dbo.ExamenPracticado INNER JOIN " + "dbo.Examen ON dbo.ExamenPracticado.ExaPrac_Examen_Codigo = dbo.Examen.Exam_Codigo INNER JOIN " + "dbo.EntradaHistoria ON dbo.ExamenPracticado.ExaPrac_Entrada_Numero = dbo.EntradaHistoria.Entr_Numero INNER JOIN " + "dbo.TipResultado ON dbo.ExamenPracticado.ExaPrac_Resultado = dbo.TipResultado.TipRes_Codigo INNER JOIN " + "dbo.TipResultado AS TipResultado_1 ON dbo.ExamenPracticado.ExaPrac_Resultado = TipResultado_1.TipRes_Codigo WHERE dbo.EntradaHistoria.Entr_Numero=" + NumeroEntrada; DataTable TablaExamenes = new DataTable(); TablaExamenes = NuevoSql.LlenarTabla(query); for (int i = 0; i < TablaExamenes.Rows.Count; i++) { string x = TablaExamenes.Rows[i]["Exam_Descripcion"].ToString() + " (" + TablaExamenes.Rows[i]["TipRes_Descripcion"].ToString() + ")"; if (i == 0) { examenes = x; } else { examenes = examenes + " " + x; } } //ENVIÓ DE PARAMETROS AL REPORTE string edad = Convert.ToString(CalcularEdad(Convert.ToDateTime(TablaPaciente.Rows[0]["Pac_FechaNacimiento"]))) + " " + "Años"; FrmVisualizarReporte f = new FrmVisualizarReporte(); CrystalReport1 cry = new CrystalReport1(); string documento = TablaPaciente.Rows[0]["Pac_Identificacion"].ToString(); cry.SetParameterValue("NombreCompleto", TablaPaciente.Rows[0]["Nombres"]); cry.SetParameterValue("Documento", TablaPaciente.Rows[0]["Pac_Identificacion"]); cry.SetParameterValue("Edad", edad); cry.SetParameterValue("Genero", TablaPaciente.Rows[0]["Gen_Descripcion"]); cry.SetParameterValue("Telefono", TablaPaciente.Rows[0]["Pac_Telefono"].ToString()); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); cry.SetParameterValue("nit", Configuracion.Nit); cry.SetParameterValue("piepagina", Configuracion.PiePagina); if (examenes.Trim() == "") { cry.SetParameterValue("ExamenesPracticados", "NO APLICA"); } else { cry.SetParameterValue("ExamenesPracticados", examenes); } cry.SetParameterValue("@NumeroEntrada", Convert.ToInt32(NumeroEntrada)); cry.SetParameterValue("Enfasis", Enfasis); cry.SetParameterValue("FechaExamen", Fecha); if (ConceptoTarea == "") { cry.SetParameterValue("DesAptitud", ""); } else { cry.SetParameterValue("DesAptitud", "CONCEPTO DE APTITUD PARA LA TAREA:"); } cry.SetParameterValue("ConceptoTarea", ConceptoTarea); //PARA EL TIPO DE EXAMEN Query = "SELECT dbo.TipoExamen.TipoExam_Descripcion, " + "dbo.Concepto.Conc_Descripcion " + "FROM dbo.TipoExamen INNER JOIN " + "dbo.EntradaHistoria ON dbo.TipoExamen.TipoExam_Codigo = " + "dbo.EntradaHistoria.Entr_TipoExamenCodigo INNER JOIN " + "dbo.Concepto ON dbo.EntradaHistoria.Entr_Concepto_Codigo = " + "dbo.Concepto.Conc_Codigo where dbo.EntradaHistoria.Entr_Numero= " + NumeroEntrada; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("TipoExamen", TablaPaciente.Rows[0]["TipoExam_Descripcion"].ToString()); cry.SetParameterValue("Concepto", TablaPaciente.Rows[0]["Conc_Descripcion"].ToString()); TablaPaciente = null; //PARA EL NOMBRE DE LA EMPRESA Query = "SELECT Empresa.Empre_RazonSocial,Empresa.Empre_Nit, cargo.Carg_Descripcion as Ocup_Descripcion, InfOcu_Entrada_Numero FROM dbo.InformacionOcupacional inner join Empresa on InfOcu_CodEmpresa=Empresa.Empr_Codigo inner join cargo on cargo.Carg_Codigo = InformacionOcupacional.InfOcu_CodOcupacion WHERE InfOcu_Entrada_Numero=" + NumeroEntrada; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("NombreEmpresa", TablaPaciente.Rows[0]["Empre_RazonSocial"].ToString()); cry.SetParameterValue("nitempresa", TablaPaciente.Rows[0]["Empre_Nit"].ToString()); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); cry.SetParameterValue("nit", Configuracion.Nit); cry.SetParameterValue("tel", Configuracion.Telefono); cry.SetParameterValue("direccion", Configuracion.Direccion); cry.SetParameterValue("piepagina", Configuracion.PiePagina); cry.SetParameterValue("Cargo", TablaPaciente.Rows[0]["Ocup_Descripcion"]); Query = "SELECT dbo.ARL.Arl_Codigo, dbo.ARL.Arl_Descripcion, " + "dbo.EPS.Eps_Codigo, dbo.EPS.Eps_Descripcion, " + "dbo.Paciente.Pac_Identificacion, dbo.Paciente.Pac_Nombre1, " + "dbo.Paciente.Pac_Nombre2, dbo.Paciente.Pac_Apellido1, " + "dbo.Paciente.Pac_Apellido2, dbo.EntradaHistoria.Entr_IdPaciente, " + "dbo.EntradaHistoria.Entr_FechaEntrada, dbo.EntradaHistoria.Entr_Numero " + "FROM dbo.EntradaHistoria RIGHT OUTER JOIN "+ "dbo.EPS INNER JOIN " + "dbo.Paciente ON dbo.EPS.Eps_Codigo = dbo.Paciente.Pac_CodEPS INNER JOIN " + "dbo.ARL ON dbo.Paciente.Pac_CodARL = dbo.ARL.Arl_Codigo ON " + "dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "AND dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "WHERE Pac_Identificacion='" + Documento + "'"; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); if (TablaPaciente.Rows.Count > 0) { cry.SetParameterValue("EPS", TablaPaciente.Rows[0]["Eps_Descripcion"]); cry.SetParameterValue("ARL", TablaPaciente.Rows[0]["Arl_Descripcion"]); } else { cry.SetParameterValue("EPS", ""); cry.SetParameterValue("ARL", ""); } TablaPaciente = null; TablaExamenes = null; //SE VISUALIZA EL REPORTE f.crystalReportViewer1.ReportSource = cry; f.Show(); } } #endregion #region PARA ARIR FORMULARIO DE HISTORIA PARA VER LA HISTORIA DEL PACIENTE if (e.RowIndex > -1) { if (e.ColumnIndex == DgvDatosColatendido.Index) { string documento = DgvDatos.CurrentRow.Cells["DgvDatosColDocumento"].Value.ToString(); string NumeroEntrada = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColNumeroHistoria"].Value.ToString(); string Enfasis = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColEnfasis"].Value.ToString(); string Fecha = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColFecha1"].Value.ToString(); string ConceptoTarea = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosconceptoAptitud"].Value.ToString(); FrmOpcionesImprimir f = new FrmOpcionesImprimir(); f.NumeroAtencion = Convert.ToInt32(DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColNumeroHistoria"].Value.ToString()); string Nombres = DgvDatos.CurrentRow.Cells["DgvDatosColNombres"].Value.ToString(); f.LblNombre.Text = Nombres; f.DocumentoP = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColDocumento"].Value.ToString(); f.NumEntradaP = NumeroEntrada; f.EnfasisP = Enfasis; f.FechaP = Fecha; f.documento = documento; f.ConceptoP = ConceptoTarea; f.ShowDialog(); } if (e.ColumnIndex == DgvDatosColDocumento.Index || e.ColumnIndex == DgvDatosColNombres.Index) { if (LblMensaje.Text == "HISTORIA MÉDICA") { string paciente = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColDocumento"].Value.ToString(); FrnHistoriaClinica f = new FrnHistoriaClinica(); f.LblEntrada.Visible = true; f.LblEntrada.Text = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColNumeroHistoria"].Value.ToString(); f.TxtDocumento.Text = paciente; if (DgvDatos.Rows[e.RowIndex].Cells["Column1"].Value.ToString() == "False") { f.SooloVer = true; //f.BuscarTodo(); f.BtnCerrarHistoria.Visible = true; f.BtnGuardarHistoria.Visible = true; f.BtnCerrarHistoria.Visible = true; f.LblGuardarCerra.Visible = true; f.LblGuardar.Visible = true; f.TxtDocumento.BackColor = Color.SteelBlue; } else { f.SooloVer = true; //f.BuscarTodo(); f.TxtDocumento.ReadOnly = true; f.BtnGuardarHistoria.Visible = false; f.BtnCerrarHistoria.Visible = false; f.LblGuardarCerra.Visible = false; f.LblGuardar.Visible = false; } if (LblMensaje.Text == "CETIFICADOS Y HISTORIAS") { f.TxtDocumento.ReadOnly = true; f.BtnGuardarHistoria.Visible = false; f.BtnCerrarHistoria.Visible = false; f.LblGuardarCerra.Visible = false; f.LblGuardar.Visible = false; } string documento = DgvDatos.CurrentRow.Cells["DgvDatosColDocumento"].Value.ToString(); string edad = DgvDatos.CurrentRow.Cells["DgvDatosColedad"].Value.ToString(); string sexo = DgvDatos.CurrentRow.Cells["DgvDatosColSexo"].Value.ToString(); string fecha = DgvDatos.CurrentRow.Cells["DgvDatosColFecha"].Value.ToString(); string entrada = DgvDatos.CurrentRow.Cells["DgvDatosColEntrada"].Value.ToString(); string efasis = DgvDatos.CurrentRow.Cells["DgvDatosColEnfasis"].Value.ToString(); f.LblDatos.Text = "Tipo de Examen: " + entrada; f.LblDatos1.Text = "Enfasis: " + efasis; f.LblDatos2.Text = "Fecha : " + fecha.Substring(0, 10); f.LblDatos3.Text = "Sexo: " + sexo; f.LblDatos4.Text = "Edad: " + edad; f.ShowDialog(); } else { if (DgvDatos.Rows[e.RowIndex].DefaultCellStyle.BackColor == Color.SteelBlue) { if (MessageBox.Show("¿Desea ver y adjuntar examenes?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string documento = DgvDatos.CurrentRow.Cells["DgvDatosColDocumento"].Value.ToString(); string Nombres = DgvDatos.CurrentRow.Cells["DgvDatosColNombres"].Value.ToString(); string NumeroAtencion = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColNumeroHistoria"].Value.ToString(); FrmVerPacientes f = new FrmVerPacientes(); f.LblNombrePaciente.Text = Nombres; f.LblNumeroAtencion.Text = NumeroAtencion; f.txtidentificacion.Text = documento; f.ShowDialog(); } } } } } #endregion } }
private void DgvDatos_CellClick(object sender, DataGridViewCellEventArgs e) { //try //{ DataTable TablaPaciente = new DataTable(); //SE VERIFIVA QUE SE HAYA SELECCIONADO UNA COLUMNA if (e.ColumnIndex > 0) { //PREGUNTAMOS QUE SERA LA COLUMNA DE IMPRIMIR if (DgvDatos.Columns[e.ColumnIndex].HeaderText == "********") { string Documento = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColDocumento"].Value.ToString(); //SE REALIZAN LAS RESPECTIVAS COLUMNAS Y SE LLENAN LAS TABLAS CON LA INFORMACIÓN QUE SE REQUIERE PARA EL REPORTE string Query = "SELECT dbo.Paciente.Pac_Nombre1+ ' ' + isnull(dbo.Paciente.Pac_Nombre2,'') "+ " +' '+dbo.Paciente.Pac_Apellido1+ ' '+isnull(dbo.Paciente.Pac_Apellido2,'') As Nombres, "+ " dbo.Paciente.Pac_TipoIdentificacion, dbo.Paciente.Pac_TipoIdentificacion+' '+dbo.Paciente.Pac_Identificacion As Pac_Identificacion, "+ " dbo.Paciente.Pac_FechaNacimiento, dbo.Genero.Gen_Descripcion, "+ " dbo.Paciente.Pac_LugarNacimiento, dbo.Paciente.Pac_Direccion, "+ " dbo.Paciente.Pac_NivelEducacion, dbo.Paciente.Pac_Profesion_Codigo, "+ " dbo.TipoSangre.TipSan_Descripcion, dbo.Paciente.Pac_EstadoCivil, "+ " dbo.EstadoCivil.EstCivil_Descripcion,Pac_Telefono "+ "FROM dbo.Paciente LEFT OUTER JOIN "+ " dbo.EstadoCivil ON dbo.Paciente.Pac_EstadoCivil = "+ " dbo.EstadoCivil.EstCivil_Codigo LEFT OUTER JOIN "+ " dbo.TipoSangre ON dbo.Paciente.Pac_TipoSangre = "+ " dbo.TipoSangre.TipSan_Codigo LEFT OUTER JOIN "+ " dbo.Genero ON dbo.Paciente.Pac_Genero_Codigo = dbo.Genero.Gen_Codigo "+ "WHERE Pac_Identificacion='"+ Documento + "'"; TablaPaciente = NuevoSql.LlenarTabla(Query); //FIN PACIENTE string NumeroEntrada = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColNumeroHistoria"].Value.ToString(); string Enfasis = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColEnfasis"].Value.ToString(); string Fecha = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColFecha"].Value.ToString(); string examenes = ""; string query = "SELECT dbo.Examen.Exam_Descripcion, dbo.EntradaHistoria.Entr_Numero, dbo.TipResultado.TipRes_Descripcion " + "FROM dbo.ExamenPracticado INNER JOIN " + "dbo.Examen ON dbo.ExamenPracticado.ExaPrac_Examen_Codigo = dbo.Examen.Exam_Codigo INNER JOIN " + "dbo.EntradaHistoria ON dbo.ExamenPracticado.ExaPrac_Entrada_Numero = dbo.EntradaHistoria.Entr_Numero INNER JOIN " + "dbo.TipResultado ON dbo.ExamenPracticado.ExaPrac_Resultado = dbo.TipResultado.TipRes_Codigo INNER JOIN " + "dbo.TipResultado AS TipResultado_1 ON dbo.ExamenPracticado.ExaPrac_Resultado = TipResultado_1.TipRes_Codigo WHERE dbo.EntradaHistoria.Entr_Numero=" + NumeroEntrada; DataTable TablaExamenes = new DataTable(); TablaExamenes = NuevoSql.LlenarTabla(query); for (int i = 0; i < TablaExamenes.Rows.Count; i++) { string x = TablaExamenes.Rows[i]["Exam_Descripcion"].ToString() + " (" + TablaExamenes.Rows[i]["TipRes_Descripcion"].ToString() + ")"; if (i == 0) { examenes = x; } else { examenes = examenes + " " + x; } } //ENVIÓ DE PARAMETROS AL REPORTE string edad = Convert.ToString(CalcularEdad(Convert.ToDateTime(TablaPaciente.Rows[0]["Pac_FechaNacimiento"]))) + " " + "Años"; FrmVisualizarReporte f = new FrmVisualizarReporte(); CrystalReport1 cry = new CrystalReport1(); cry.SetParameterValue("NombreCompleto", TablaPaciente.Rows[0]["Nombres"]); cry.SetParameterValue("Cargo", TablaPaciente.Rows[0]["Pac_Profesion_Codigo"]); cry.SetParameterValue("Documento", TablaPaciente.Rows[0]["Pac_Identificacion"]); cry.SetParameterValue("Edad", edad); cry.SetParameterValue("Genero", TablaPaciente.Rows[0]["Gen_Descripcion"]); cry.SetParameterValue("Telefono", TablaPaciente.Rows[0]["Pac_Telefono"].ToString()); cry.SetParameterValue("EPS", "NOMBRE DE LA EPS"); cry.SetParameterValue("ARL", "NOMBRE DE LA ARL"); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); cry.SetParameterValue("nit", Configuracion.Nit); cry.SetParameterValue("piepagina", Configuracion.PiePagina); if (examenes.Trim() == "") { cry.SetParameterValue("ExamenesPracticados", "NO APLICA"); } else { cry.SetParameterValue("ExamenesPracticados", examenes); } cry.SetParameterValue("@NumeroEntrada", Convert.ToInt32(NumeroEntrada)); cry.SetParameterValue("Enfasis", Enfasis); cry.SetParameterValue("FechaExamen", Fecha); //cry.DataSourceConnections = NuevoSql.conexion; //PARA EL TIPO DE EXAMEN Query = "SELECT dbo.TipoExamen.TipoExam_Descripcion, " + "dbo.Concepto.Conc_Descripcion " + "FROM dbo.TipoExamen INNER JOIN " + "dbo.EntradaHistoria ON dbo.TipoExamen.TipoExam_Codigo = " + "dbo.EntradaHistoria.Entr_TipoExamenCodigo INNER JOIN " + "dbo.Concepto ON dbo.EntradaHistoria.Entr_Concepto_Codigo = " + "dbo.Concepto.Conc_Codigo where dbo.EntradaHistoria.Entr_Numero= " + NumeroEntrada; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("TipoExamen", TablaPaciente.Rows[0]["TipoExam_Descripcion"].ToString()); cry.SetParameterValue("Concepto", TablaPaciente.Rows[0]["Conc_Descripcion"].ToString()); TablaPaciente = null; //PARA EL NOMBRE DE LA EMPRESA Query = "SELECT InfOcu_Empresa, InfOcu_Entrada_Numero FROM dbo.InformacionOcupacional WHERE InfOcu_Entrada_Numero=" + NumeroEntrada; TablaPaciente = NuevoSql.LlenarTabla(Query); cry.SetParameterValue("NombreEmpresa", TablaPaciente.Rows[0]["InfOcu_Empresa"].ToString()); //cry.SetParameterValue("nitempresa", TablaPaciente.Rows[0]["InfOcu_Nit"].ToString()); cry.SetParameterValue("Ciudad", Configuracion.LugarExamen); cry.SetParameterValue("nit", Configuracion.Nit); cry.SetParameterValue("tel", Configuracion.Telefono); cry.SetParameterValue("direccion", Configuracion.Direccion); cry.SetParameterValue("piepagina", Configuracion.PiePagina); Query = "SELECT dbo.ARL.Arl_Codigo, dbo.ARL.Arl_Descripcion, " + "dbo.EPS.Eps_Codigo, dbo.EPS.Eps_Descripcion, " + "dbo.Paciente.Pac_Identificacion, dbo.Paciente.Pac_Nombre1, " + "dbo.Paciente.Pac_Nombre2, dbo.Paciente.Pac_Apellido1, " + "dbo.Paciente.Pac_Apellido2, dbo.EntradaHistoria.Entr_IdPaciente, " + "dbo.EntradaHistoria.Entr_FechaEntrada, dbo.EntradaHistoria.Entr_Numero " + "FROM dbo.EntradaHistoria RIGHT OUTER JOIN "+ "dbo.EPS INNER JOIN " + "dbo.Paciente ON dbo.EPS.Eps_Codigo = dbo.Paciente.Pac_CodEPS INNER JOIN " + "dbo.ARL ON dbo.Paciente.Pac_CodARL = dbo.ARL.Arl_Codigo ON " + "dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "AND dbo.EntradaHistoria.Entr_IdPaciente = dbo.Paciente.Pac_Identificacion " + "WHERE Pac_Identificacion='" + Documento + "'"; TablaPaciente = null; TablaPaciente = NuevoSql.LlenarTabla(Query); if (TablaPaciente.Rows.Count > 0) { cry.SetParameterValue("EPS", TablaPaciente.Rows[0]["Eps_Descripcion"]); cry.SetParameterValue("ARL", TablaPaciente.Rows[0]["Arl_Descripcion"]); } else { cry.SetParameterValue("EPS", ""); cry.SetParameterValue("ARL", ""); } //cry.DataSourceConnections[0].SetConnection("192.168.1.10", "2019"; //cry.Load() TablaPaciente = null; TablaExamenes = null; //SE VISUALIZA EL REPORTE f.crystalReportViewer1.ReportSource = cry; f.Show(); } } //} //catch (Exception) //{ // MessageBox.Show("No se puede generar el reporte","Error",MessageBoxButtons.OK,MessageBoxIcon.Warning); //} try { if (DgvDatos.Columns[e.ColumnIndex].HeaderText == "-----") { HistoriaPaciente f = new HistoriaPaciente(); f.Nhistoria = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColNumeroHistoria"].Value.ToString(); f.TxtDocumento.Text = DgvDatos.Rows[e.RowIndex].Cells["DgvDatosColDocumento"].Value.ToString(); f.Show(); } } catch (Exception) { } }
private void crystalReportViewer1_Load(object sender, EventArgs e) { try { //if (cn.State == ConnectionState.Closed) { cn.Open(); } //cmd = new SqlCommand("select id_plainte,date_creation,signe_plainte,type_plainte from plainte where id_plainte like '" + id_plainte + "'", cn); //da = new SqlDataAdapter(cmd); //da.Fill(ds, "plainte"); //cmd1 = new SqlCommand("select top(1)*from avocat", cn); //da1 = new SqlDataAdapter(cmd1); //da1.Fill(ds, "avocat"); //cmd2 = new SqlCommand("select plaignant.* from plaignant,plainte where plainte.id_plainte like '" + id_plainte + "' and plainte.id_plaignant=plaignant.id_plaignant", cn); //da2 = new SqlDataAdapter(cmd2); //da2.Fill(ds, "plaignant"); //cmd3 = new SqlCommand("select par_plaignant.* from par_plaignant,plainte,plainte_par_plaignant where plainte.id_plainte like '"+id_plainte+"' and plainte_par_plaignant.id_plainte=plainte.id_plainte and plainte_par_plaignant.id_par_plaignant=par_plaignant.id_par_plaignant", cn); //da3 = new SqlDataAdapter(cmd3); //da3.Fill(ds, "par_plaignant"); //cmd4 = new SqlCommand("select * from decision_plainte where id_plainte like '"+id_plainte+"'", cn); //da4 = new SqlDataAdapter(cmd4); //da4.Fill(ds1, "decision_plainte"); ////SubReportDecisionCrystalReport s = new SubReportDecisionCrystalReport(); ////s.SetDataSource(ds1); //PrintOnePlainteCrystalReport i = new PrintOnePlainteCrystalReport(); //i.SetDataSource(ds); //i.Subreports["SubReportDecisionCrystalReport.rpt"].SetDataSource(ds1); //i.OpenSubreport("SubReportDecisionCrystalReport.rpt"); //i.Refresh(); //crystalReportViewer1.ReportSource = i; CrystalReport1 i = new CrystalReport1(); //cnx.ConnectionString=ConfigurationManager.ConnectionStrings[] strServer = Properties.Settings.Default.Server; strDatabase = Properties.Settings.Default.DataBase; strUserID = Properties.Settings.Default.ID; strPwd = Properties.Settings.Default.PassWord; if (Properties.Settings.Default.Mode == "SQL") { i.DataSourceConnections[0].IntegratedSecurity = false; i.DataSourceConnections[0].SetConnection(strServer, strDatabase, strUserID, strPwd); } else { i.DataSourceConnections[0].SetConnection(strServer, strDatabase, true); } i.SetParameterValue("id_plainte", id_plainte); crystalReportViewer1.ReportSource = i; crystalReportViewer1.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.StackTrace); } }