private void ImprimirHistorico() { try { if (SelectIngreso == null) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar un ingreso"); return; } if (AreaTecnica == -1) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar un área técnica"); return; } var v = new ReporteView(); PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); v.Owner = PopUpsViewModels.MainWindow; v.Closed += (s, e) => { PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); }; #region Historial var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault(); var reporte = new List <cReporte>(); reporte.Add(new cReporte() { Encabezado1 = Parametro.ENCABEZADO1, Encabezado2 = Parametro.ENCABEZADO2, Encabezado3 = centro.DESCR.Trim(), Encabezado4 = "Historial de Atención de Citas del Área " + SelectedAreaTecnica.DESCR.Trim(), Logo1 = Parametro.REPORTE_LOGO1, Logo2 = Parametro.REPORTE_LOGO2 }); var generales = new List <cHistorialAtencionCitasGenerales>(); generales.Add(new cHistorialAtencionCitasGenerales() { Expediente = string.Format("{0}/{1}", SelectIngreso.ID_ANIO, SelectIngreso.ID_IMPUTADO), Nombre = string.Format("{0} {1} {2}", SelectIngreso.IMPUTADO.NOMBRE.Trim(), !string.IsNullOrEmpty(SelectIngreso.IMPUTADO.PATERNO) ? SelectIngreso.IMPUTADO.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(SelectIngreso.IMPUTADO.MATERNO) ? SelectIngreso.IMPUTADO.MATERNO.Trim() : string.Empty), }); var historial = new List <cHistorialAtencionCitas>(); var historico = new cAtencionRecibida().ObtenerTodoHistorico( SelectIngreso.ID_CENTRO, SelectIngreso.ID_ANIO, SelectIngreso.ID_IMPUTADO, AreaTecnica).OrderBy(w => w.ATENCION_FEC); if (historico != null) { foreach (var h in historico) { historial.Add(new cHistorialAtencionCitas() { Fecha = h.ATENCION_FEC.Value.ToString("dd/MM/yyyy"), Atencion = h.ATENCION_RECIBIDA_TXT }); } } Microsoft.Reporting.WinForms.ReportDataSource rds1 = new Microsoft.Reporting.WinForms.ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = historial; v.ReporteViewer.LocalReport.DataSources.Add(rds1); Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource(); rds2.Name = "DataSet2"; rds2.Value = reporte; v.ReporteViewer.LocalReport.DataSources.Add(rds2); Microsoft.Reporting.WinForms.ReportDataSource rds3 = new Microsoft.Reporting.WinForms.ReportDataSource(); rds3.Name = "DataSet3"; rds3.Value = generales; v.ReporteViewer.LocalReport.DataSources.Add(rds3); v.ReporteViewer.LocalReport.ReportPath = "Reportes/rAtencionCitaHistorial.rdlc"; v.ReporteViewer.RefreshReport(); #endregion v.Show(); } catch (Exception ex) { PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al imprimir historico", ex); } }
private void GeneraReporte() { try { if (SelectedEscalaRiesgo == null) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar una escala de riesgo"); return; } //Header var datosReporte = new List <cReporteDatos>(); datosReporte.Add(new cReporteDatos() { Encabezado1 = Parametro.ENCABEZADO1, Encabezado2 = "ESCALA DE RIESGO", Logo1 = Parametro.REPORTE_LOGO1, Logo2 = Parametro.REPORTE_LOGO2 }); //Generales var er = new List <cReporteEscalaRiesgo>(); string nombre_evaluador = string.Empty; var evaluador = new cUsuario().Obtener(SelectedEscalaRiesgo.EVALUADOR.Trim()); if (evaluador != null) { if (evaluador.EMPLEADO != null) { if (evaluador.EMPLEADO.PERSONA != null) { nombre_evaluador = string.Format("{0} {1} {2}", !string.IsNullOrEmpty(evaluador.EMPLEADO.PERSONA.NOMBRE) ? evaluador.EMPLEADO.PERSONA.NOMBRE.Trim() : string.Empty, !string.IsNullOrEmpty(evaluador.EMPLEADO.PERSONA.PATERNO) ? evaluador.EMPLEADO.PERSONA.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(evaluador.EMPLEADO.PERSONA.MATERNO) ? evaluador.EMPLEADO.PERSONA.MATERNO.Trim() : string.Empty); } } } er.Add(new cReporteEscalaRiesgo() { FECHA_LUGAR = string.Format("{0:dd/MM/yyyy} {1}", SelectedEscalaRiesgo.FECHA, SelectedEscalaRiesgo.LUGAR), NOMBRE = string.Format("{0} {1} {2}", SelectedEscalaRiesgo.NOMBRE, SelectedEscalaRiesgo.PATERNO, SelectedEscalaRiesgo.MATERNO), NUC = SelectedEscalaRiesgo.NUC, EVALUADOR = nombre_evaluador, FECHA = SelectedEscalaRiesgo.FECHA.Value.ToString("dd/MM/yyyy") }); //Detalle var erd = new List <cReporteEscalaRiesgoDetalle>(); //Datos Familiares erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "A. DATOS FAMILIARES", DESCRIPCION = "Vive con su familia consanguínea en linea recta(padres o hijos) y/o pareja", VALOR = 6, SELECCION = (short)(SelectedEscalaRiesgo.DATOS_FAMILIARES == 6 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "A. DATOS FAMILIARES", DESCRIPCION = "Vive con otro familiar o amigo/a", VALOR = 4, SELECCION = (short)(SelectedEscalaRiesgo.DATOS_FAMILIARES == 4 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "A. DATOS FAMILIARES", DESCRIPCION = "Vive solo/a", VALOR = 1, SELECCION = (short)(SelectedEscalaRiesgo.DATOS_FAMILIARES == 1 ? 1 : 0) }); //Aportacion Familiar erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "B. APORTACION ECONOMICA FAMILIAR", DESCRIPCION = "Tiene dependientes económicos", VALOR = 6, SELECCION = (short)(SelectedEscalaRiesgo.APORTACION_ECONOMICA == 6 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "B. APORTACION ECONOMICA FAMILIAR", DESCRIPCION = "No tiene dependientes económicos", VALOR = -2, SELECCION = (short)(SelectedEscalaRiesgo.APORTACION_ECONOMICA == -2 ? 1 : 0) }); //Arraigo en la localidad erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "C. ARRAIGO EN LA LOCALIDAD", DESCRIPCION = "Tiene por lomenos dos años viviendo dentro dela localidad", VALOR = 4, SELECCION = (short)(SelectedEscalaRiesgo.ARRAIGO_LOCALIDAD == 4 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "C. ARRAIGO EN LA LOCALIDAD", DESCRIPCION = "Tiene mas de un año pero menos de dos viviendo dentrode la localidad", VALOR = 3, SELECCION = (short)(SelectedEscalaRiesgo.ARRAIGO_LOCALIDAD == 3 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "C. ARRAIGO EN LA LOCALIDAD", DESCRIPCION = "Tiene menos de un año,pero por lomenos seis meses viviendo en la localidad", VALOR = 2, SELECCION = (short)(SelectedEscalaRiesgo.ARRAIGO_LOCALIDAD == 2 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "C. ARRAIGO EN LA LOCALIDAD", DESCRIPCION = "Tiene menos de seis meses viviendo en la localidad", VALOR = -2, SELECCION = (short)(SelectedEscalaRiesgo.ARRAIGO_LOCALIDAD == -2 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "C. ARRAIGO EN LA LOCALIDAD", DESCRIPCION = "No vive en la localidad", VALOR = -4, SELECCION = (short)(SelectedEscalaRiesgo.ARRAIGO_LOCALIDAD == -4 ? 1 : 0) }); //Residencia erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "D. RESIDENCIA", DESCRIPCION = "Es propietario de la vivienda en la que habita", VALOR = 6, SELECCION = (short)(SelectedEscalaRiesgo.RESIDENCIA == 6 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "D. RESIDENCIA", DESCRIPCION = "Tiene mas de un año ocupando la vivienda en renta o préstamo", VALOR = 4, SELECCION = (short)(SelectedEscalaRiesgo.RESIDENCIA == 4 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "D. RESIDENCIA", DESCRIPCION = "Tiene menos de un año viviendo en renta o préstamo", VALOR = 2, SELECCION = (short)(SelectedEscalaRiesgo.RESIDENCIA == 2 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "D. RESIDENCIA", DESCRIPCION = "Vive en situación de calle", VALOR = -6, SELECCION = (short)(SelectedEscalaRiesgo.RESIDENCIA == -6 ? 1 : 0) }); //Historia Laboral / Escolar erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "E. HISTORIA LABORAL/ESCOLAR", DESCRIPCION = "Tiene mas de un año con la misma actividad laboral o escolar", VALOR = 6, SELECCION = (short)(SelectedEscalaRiesgo.HISTORIA_LAB_ESC == 6 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "E. HISTORIA LABORAL/ESCOLAR", DESCRIPCION = "Tiene mas de un año con actividad laboral, en diversas ocupaciones pero continuas, o escolar", VALOR = 4, SELECCION = (short)(SelectedEscalaRiesgo.HISTORIA_LAB_ESC == 4 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "E. HISTORIA LABORAL/ESCOLAR", DESCRIPCION = "Tiene de 6 a 12 meses con actividad escolar o laboral continua(un o varios trabajos)", VALOR = 2, SELECCION = (short)(SelectedEscalaRiesgo.HISTORIA_LAB_ESC == 2 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "E. HISTORIA LABORAL/ESCOLAR", DESCRIPCION = "Tiene menos de seis meses con actividad laboral o escolar", VALOR = -2, SELECCION = (short)(SelectedEscalaRiesgo.HISTORIA_LAB_ESC == -2 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "E. HISTORIA LABORAL/ESCOLAR", DESCRIPCION = "Se encuentra desempleado y no estudia", VALOR = -6, SELECCION = (short)(SelectedEscalaRiesgo.HISTORIA_LAB_ESC == -6 ? 1 : 0) }); //Consumo de Sustancias erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "F. CONSUMO DE SUSTANCIAS", DESCRIPCION = "Consume drogas y/o alcohol mas de tres veces a la semana", VALOR = -4, SELECCION = (short)(SelectedEscalaRiesgo.CONSUMO_SUSTANCIAS == -4 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "F. CONSUMO DE SUSTANCIAS", DESCRIPCION = "Consume drogas y/o alcohol", VALOR = -2, SELECCION = (short)(SelectedEscalaRiesgo.CONSUMO_SUSTANCIAS == -2 ? 1 : 0) }); //Posible pena a imponer erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "G. POSIBLE PENA A IMPONER", DESCRIPCION = "No excede los 5 años de pena privativa de libertad", VALOR = 4, SELECCION = (short)(SelectedEscalaRiesgo.POSIBLE_PENA_IMPONER == 4 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "G. POSIBLE PENA A IMPONER", DESCRIPCION = "Excede los 5 años de pena privativa de libertad", VALOR = -4, SELECCION = (short)(SelectedEscalaRiesgo.POSIBLE_PENA_IMPONER == -4 ? 1 : 0) }); //Cumplimiento de Condicions Judiciales erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "H. CUMPLIMIENTO DE CONDICIONES JUDICIALES", DESCRIPCION = "Incumplio condiciones judiciales en procesos anteriores", VALOR = -6, SELECCION = (short)(SelectedEscalaRiesgo.CUMPLIMIENTO_CONDICIONES == -6 ? 1 : 0) }); //Antecedentes Penales erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "I. ANTECEDENTES PENALES", DESCRIPCION = "Tiene antecedentes penales", VALOR = -6, SELECCION = (short)(SelectedEscalaRiesgo.ANTECEDENTES_PENALES == -6 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "I. ANTECEDENTES PENALES", DESCRIPCION = "Tiene de 2 a 3 antecedentes penales", VALOR = -5, SELECCION = (short)(SelectedEscalaRiesgo.ANTECEDENTES_PENALES == -11 ? 1 : 0) }); erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "I. ANTECEDENTES PENALES", DESCRIPCION = "Tiene masde3 antecedentes penales", VALOR = -6, SELECCION = (short)(SelectedEscalaRiesgo.ANTECEDENTES_PENALES == -12 ? 1 : 0) }); //Datos Falsos erd.Add(new cReporteEscalaRiesgoDetalle() { GRUPO = "J. DATOS FALSOS", DESCRIPCION = "Mintió en la información proporcionadaen la entrevista", VALOR = -6, SELECCION = (short)(SelectedEscalaRiesgo.DATOS_FALSOS == -6 ? 1 : 0) }); //Resultados var err = new List <cReporteEscalaRiesgoResultado>(); err.Add(new cReporteEscalaRiesgoResultado() { A1 = SelectedEscalaRiesgo.DATOS_FAMILIARES, B1 = SelectedEscalaRiesgo.APORTACION_ECONOMICA, C1 = SelectedEscalaRiesgo.ARRAIGO_LOCALIDAD, D1 = SelectedEscalaRiesgo.RESIDENCIA, E1 = SelectedEscalaRiesgo.HISTORIA_LAB_ESC, F1 = SelectedEscalaRiesgo.CONSUMO_SUSTANCIAS, G1 = SelectedEscalaRiesgo.POSIBLE_PENA_IMPONER, H1 = SelectedEscalaRiesgo.CUMPLIMIENTO_CONDICIONES, I1 = SelectedEscalaRiesgo.ANTECEDENTES_PENALES, J1 = SelectedEscalaRiesgo.DATOS_FALSOS, TOTAL = SelectedEscalaRiesgo.TOTAL }); //Nivel var ern = new List <cReporteEscalaRiesgoNivel>(); ern.Add(new cReporteEscalaRiesgoNivel() { NIVEL = "NULO[26 AL 32]", EN_RANGO = (SelectedEscalaRiesgo.TOTAL >= 26 && SelectedEscalaRiesgo.TOTAL <= 32) ? 1 : 0 }); ern.Add(new cReporteEscalaRiesgoNivel() { NIVEL = "BAJO[11 AL 24]", EN_RANGO = (SelectedEscalaRiesgo.TOTAL >= 11 && SelectedEscalaRiesgo.TOTAL <= 24) ? 1 : 0 }); ern.Add(new cReporteEscalaRiesgoNivel() { NIVEL = "MEDIO[10 AL -10]", EN_RANGO = (SelectedEscalaRiesgo.TOTAL >= -10 && SelectedEscalaRiesgo.TOTAL <= 10) ? 1 : 0 }); ern.Add(new cReporteEscalaRiesgoNivel() { NIVEL = "ALTO[-11 AL -47]", EN_RANGO = (SelectedEscalaRiesgo.TOTAL >= -47 && SelectedEscalaRiesgo.TOTAL <= -11) ? 1 : 0 }); var View = new ReporteView(); PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); View.Owner = PopUpsViewModels.MainWindow; View.Closed += (s, e) => { PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); }; View.ReporteViewer.LocalReport.ReportPath = "Reportes/rEscalaRiesgo.rdlc"; View.ReporteViewer.LocalReport.DataSources.Clear(); ReportDataSource rds1 = new ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = er; View.ReporteViewer.LocalReport.DataSources.Add(rds1); ReportDataSource rds2 = new ReportDataSource(); rds2.Name = "DataSet2"; rds2.Value = datosReporte; View.ReporteViewer.LocalReport.DataSources.Add(rds2); ReportDataSource rds3 = new ReportDataSource(); rds3.Name = "DataSet3"; rds3.Value = erd; View.ReporteViewer.LocalReport.DataSources.Add(rds3); ReportDataSource rds4 = new ReportDataSource(); rds4.Name = "DataSet4"; rds4.Value = ern; View.ReporteViewer.LocalReport.DataSources.Add(rds4); ReportDataSource rds5 = new ReportDataSource(); rds5.Name = "DataSet5"; rds5.Value = err; View.ReporteViewer.LocalReport.DataSources.Add(rds5); View.ReporteViewer.Refresh(); View.ReporteViewer.RefreshReport(); View.Show(); } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error...", ex); } }
//FUNCIONES private void PaginaLoad(ReporteView Window = null) { var metro = Application.Current.Windows[5] as MetroWindow; var x = ((System.Windows.Controls.Button)metro.FindName("myButton")); }