public CatalogoAreasViewModel()
        {
            CatalogoHeader = "Areas";
            HeaderAgregar  = "Agregar Nueva Area";
            FiltroDisplay  = "DESCR";
            //LLENAR
            EditarVisible = false;
            NuevoVisible  = false;
            FiltroVisible = true;
            //ListItems = new ObservableCollection<AREA>();
            cCentro centro = new cCentro();

            ListTipos = new ObservableCollection <CENTRO>(centro.ObtenerTodos("", 2, 0));
            ListTipos.Insert(0, new CENTRO()
            {
                ID_CENTRO = 0, DESCR = "SELECCIONE"
            });
            SelectedTipo   = ListTipos.Where(w => w.DESCR == "SELECCIONE").FirstOrDefault();
            AgregarVisible = false;

            GuardarMenuEnabled  = false;
            AgregarMenuEnabled  = true;
            EliminarMenuEnabled = false;
            EditarMenuEnabled   = false;
            CancelarMenuEnabled = false;
            AyudaMenuEnabled    = true;
            SalirMenuEnabled    = true;
            ExportarMenuEnabled = true;

            SeleccionIndice = -1;
            this.setValidationRules();
        }
        private void GenerarReporte()
        {
            try
            {
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                    Titulo      = "Bitácora de Recepción de Visita Legal",
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Centro      = centro.DESCR.Trim().ToUpper(),
                });


                var lstIngresos = new List <cBitacoraIngresosVisitaLegal>();
                var ingresos    = new cAduanaIngreso().ObtenerTodosPorTipoVisita(FFechaInicio.Value.Date, FFechaFin.Value.Date, GlobalVar.gCentro, (short)enumTipoPersona.PERSONA_ABOGADO);
                if (ingresos != null)
                {
                    foreach (var ai in ingresos)
                    {
                        var obj = new cBitacoraIngresosVisitaLegal();
                        obj.FechaHoraEntrada = string.Format("{0:dd/MM/yyyy hh:mm tt}", ai.ADUANA.ENTRADA_FEC);
                        obj.FechaHoraSalida  = string.Format("{0:dd/MM/yyyy hh:mm tt}", ai.ADUANA.SALIDA_FEC);
                        obj.Expediente       = string.Format("{0}/{1}", ai.ID_ANIO, ai.ID_IMPUTADO);
                        obj.Interno          = string.Format("{0} {1} {2}", !string.IsNullOrEmpty(ai.INGRESO.IMPUTADO.NOMBRE) ? ai.INGRESO.IMPUTADO.NOMBRE.Trim() : string.Empty, !string.IsNullOrEmpty(ai.INGRESO.IMPUTADO.PATERNO) ? ai.INGRESO.IMPUTADO.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(ai.INGRESO.IMPUTADO.MATERNO) ? ai.INGRESO.IMPUTADO.MATERNO.Trim() : string.Empty);
                        obj.Abogado          = string.Format("{0} {1} {2}", !string.IsNullOrEmpty(ai.ADUANA.PERSONA.NOMBRE) ? ai.ADUANA.PERSONA.NOMBRE.Trim() : string.Empty, !string.IsNullOrEmpty(ai.ADUANA.PERSONA.PATERNO) ? ai.ADUANA.PERSONA.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(ai.ADUANA.PERSONA.MATERNO) ? ai.ADUANA.PERSONA.MATERNO.Trim() : string.Empty);
                        lstIngresos.Add(obj);
                    }
                }

                //ARMAMOS EL REPORTE
                Reporte.LocalReport.ReportPath = "Reportes/rBitacoraIngresoVisitaLegal.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                Microsoft.Reporting.WinForms.ReportDataSource rds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = lstIngresos;
                Reporte.LocalReport.DataSources.Add(rds1);

                Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds2);
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.RefreshReport();
                    ReportViewerVisible = Visibility.Visible;
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
        public void GenerarReporte()
        {
            try
            {
                var lVisitantesTramite = new List <cVisitanteTramite>();
                var centro             = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var datosReporte       = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                    Titulo      = "RELACIÓN DE INTERNOS",
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Centro      = centro.DESCR.Trim().ToUpper(),
                });
                var visitante_ingreso = new cVisitanteIngreso();
                lVisitantesTramite = visitante_ingreso.ObtenerTodosFecha().
                                     AsEnumerable().
                                     Select(s => new cVisitanteTramite()
                {
                    Anio              = s.ID_ANIO,
                    Id_Imputado       = s.ID_IMPUTADO,
                    Materno_Ingreso   = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.MATERNO) ? s.INGRESO.IMPUTADO.MATERNO.TrimEnd() : string.Empty,
                    Materno_Visitante = !string.IsNullOrEmpty(s.VISITANTE.PERSONA.MATERNO) ? s.VISITANTE.PERSONA.MATERNO.TrimEnd() : string.Empty,
                    Nombre_Ingreso    = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.NOMBRE) ? s.INGRESO.IMPUTADO.NOMBRE.TrimEnd() : string.Empty,
                    NumeroVisita      = s.ID_PERSONA,
                    Parentesco        = s.TIPO_REFERENCIA != null ? (!string.IsNullOrEmpty(s.TIPO_REFERENCIA.DESCR) ? s.TIPO_REFERENCIA.DESCR.TrimEnd() : "SIN DEFINIR") : "SIN DEFINIR"
                })
                                     .ToList();

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.LocalReport.ReportPath = "Reportes/rVisitantesTramite.rdlc";
                    Reporte.LocalReport.DataSources.Clear();

                    ReportDataSource ReportDataSource = new ReportDataSource();
                    ReportDataSource.Name = "DataSet2";
                    ReportDataSource.Value = lVisitantesTramite;

                    ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();
                    ReportDataSource_Encabezado.Name = "DataSet1";
                    ReportDataSource_Encabezado.Value = datosReporte;

                    Reporte.LocalReport.DataSources.Add(ReportDataSource);
                    Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);

                    Reporte.LocalReport.SetParameters(new ReportParameter("Fecha", Fechas.GetFechaDateServer.ToString()));

                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void GenerarReporteConQuery()
        {
            try
            {
                var centro     = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var encabezado = new System.Collections.Generic.List <cEncabezado>();
                encabezado.Add(new cEncabezado()
                {
                    ImagenIzquierda = Parametro.REPORTE_LOGO2,
                    ImagenDerecha   = Parametro.REPORTE_LOGO1,
                    TituloUno       = Parametro.ENCABEZADO1,
                    TituloDos       = Parametro.ENCABEZADO2,
                    NombreReporte   = centro != null ? !string.IsNullOrEmpty(centro.DESCR) ? centro.DESCR.Trim() : string.Empty : string.Empty,
                    PieUno          = string.Format("Reporte de Reincidentes por Fuero y Delito \n Del {0} Al {1}",
                                                    SelectedFechaInicial.HasValue ? SelectedFechaInicial.Value.ToString("dd/MM/yyyy") : string.Empty,
                                                    SelectedFechaFinal.HasValue ? SelectedFechaFinal.Value.ToString("dd/MM/yyyy") : string.Empty)
                });

                var reporte = new cIngreso().ReporteReincidencias(GlobalVar.gCentro).Select(w => new cReporteReingreso()
                {
                    FUERO     = w.ID_FUERO == "C" ? "COMUN" : "FEDERAL",
                    ID_DELITO = w.ID_DELITO,
                    DELITO    = w.DELITO,
                    TOTAL_M   = w.TOTAL_M,
                    TOTAL_F   = w.TOTAL_F,
                    TOTAL     = w.TOTAL
                });

                System.Windows.Application.Current.Dispatcher.Invoke((System.Action)(delegate
                {
                    Reporte.Reset();
                }));

                Reporte.LocalReport.ReportPath = "Reportes/rReporteReincidentesNew.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                Microsoft.Reporting.WinForms.ReportDataSource ds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                ds1.Name  = "DataSet1";
                ds1.Value = encabezado;
                Reporte.LocalReport.DataSources.Add(ds1);

                Microsoft.Reporting.WinForms.ReportDataSource ds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                ds2.Name  = "DataSet2";
                ds2.Value = reporte;
                Reporte.LocalReport.DataSources.Add(ds2);

                System.Windows.Application.Current.Dispatcher.Invoke((System.Action)(delegate
                {
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
Exemplo n.º 5
0
        private void GenerarReporte1()
        {
            try
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Collapsed;
                    Reporte.Reset();
                }));
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var header = new List <cReporteDatos>();
                header.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1,
                    Encabezado2 = Parametro.ENCABEZADO2,
                    Encabezado3 = Parametro.ENCABEZADO3,
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Titulo      = "Programas y Actividades"
                });

                var reporte = new List <cReporteProgramaActividad>(new cGrupoParticipante().ObtenerReporteProgramasActividades(GlobalVar.gCentro).Select(w => new cReporteProgramaActividad()
                {
                    TIPO_PROGRAMA  = w.TIPO_PROGRAMA,
                    TIPO_ACTIVIDAD = w.ACTIVIDAD,
                    FEMENINO       = w.FEMENINO,
                    MASCULINO      = w.MASCULINO,
                    NO_DEFINIDO    = w.NO_DEFINIDO,
                }));

                Reporte.LocalReport.ReportPath = "Reportes/rProgramasActividades.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = header;
                Reporte.LocalReport.DataSources.Add(rds1);

                ReportDataSource rds2 = new ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = reporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                    ReportViewerVisible = Visibility.Visible;
                }));
            }
            catch (Exception ex)
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate { ReportViewerVisible = Visibility.Collapsed; }));
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte.", ex);
            }
        }
        private void GenerarReporte()
        {
            try
            {
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                    Titulo      = "HORARIO DEL ÁREA",
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Centro      = centro.DESCR.Trim().ToUpper(),
                });

                #region Reporte
                Reporte.LocalReport.ReportPath = "Reportes/rHorarioArea.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                var rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                var rds3 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds3.Name  = "DataSet3";
                rds3.Value = new cGrupoHorario().GetData().Where(w => w.ID_AREA == SelectedArea).AsEnumerable().Select(s => new ReporteHorarioArea
                {
                    Eje          = s.GRUPO.ACTIVIDAD_EJE.EJE.DESCR,
                    Programa     = new cTipoPrograma().GetData().Where(w => w.ID_TIPO_PROGRAMA == s.ID_TIPO_PROGRAMA).FirstOrDefault().NOMBRE,
                    Actividad    = s.GRUPO.ACTIVIDAD.DESCR,
                    Grupo        = s.GRUPO.DESCR,
                    Responsable  = (s.GRUPO.PERSONA.PATERNO != null ? s.GRUPO.PERSONA.PATERNO.Trim() : string.Empty) + " " + (s.GRUPO.PERSONA.MATERNO != null ? s.GRUPO.PERSONA.MATERNO.Trim() : string.Empty) + " " + (s.GRUPO.PERSONA.NOMBRE != null ? s.GRUPO.PERSONA.NOMBRE.Trim() : string.Empty),
                    Area         = s.AREA.DESCR,
                    hora_inicio  = s.HORA_INICIO.Value.ToShortDateString() + " " + s.HORA_INICIO.Value.ToShortTimeString(),
                    hora_termino = s.HORA_TERMINO.Value.ToShortDateString() + " " + s.HORA_TERMINO.Value.ToShortTimeString(),
                    Estatus      = s.GRUPO_HORARIO_ESTATUS.DESCR
                });
                Reporte.LocalReport.DataSources.Add(rds3);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.RefreshReport();
                }));
                #endregion
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
        private void GenerarReporteConQuery()
        {
            try
            {
                var centro       = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var reporteDatos = new List <cReporteDatos>();
                reporteDatos.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1,
                    Encabezado2 = Parametro.ENCABEZADO2,
                    Encabezado3 = Parametro.ENCABEZADO3,
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Titulo      = string.Format("Reporte de Población Activa al Cierre \n Del {0} Al {1}",
                                                SelectedFechaInicial.HasValue ? SelectedFechaInicial.Value.ToString("dd/MM/yyyy") : string.Empty,
                                                SelectedFechaFinal.HasValue ? SelectedFechaFinal.Value.ToString("dd/MM/yyyy") : string.Empty),
                    Centro = centro.DESCR.ToUpper().Trim()
                });
                var reporte = new cPaises().ObtenerPoblacionActivaCierre(GlobalVar.gCentro, SelectedFechaInicial.Value.Date, SelectedFechaFinal.Value.Date).Select(w => new cReporteIngresosActivosCierre()
                {
                    NombrePais = w.PAIS,
                    TotalH     = w.MASCULINO,
                    TotalM     = w.FEMENINO,
                    GrandTotal = w.TOTAL
                });
                System.Windows.Application.Current.Dispatcher.Invoke((System.Action)(delegate
                {
                    Reporte.Reset();
                }));
                Reporte.LocalReport.ReportPath = "Reportes/rReporteIngresosActivosCierre.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Encabezado = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Encabezado.Name  = "DataSet1";
                ReportDataSource_Encabezado.Value = reporteDatos;

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Motivos.Name  = "DataSet2";
                ReportDataSource_Motivos.Value = reporte;

                Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
                Reporte.LocalReport.DataSources.Add(ReportDataSource_Motivos);

                System.Windows.Application.Current.Dispatcher.Invoke((System.Action)(delegate
                {
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
        private void GenerarReporteConQuery()
        {
            try
            {
                var centro       = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1,
                    Encabezado2 = Parametro.ENCABEZADO2,
                    Encabezado3 = Parametro.ENCABEZADO3,
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Titulo      = OrdenarPor == 1 ? "Población por delito común" : "Población por delito federal",
                    Centro      = centro.DESCR.ToUpper().Trim()
                });
                var reporte = new cSentenciaDelito().ObtenerPoblacionDelito(GlobalVar.gCentro, OrdenarPor == 1 ? "C" : "F").Select(w => new cPoblacionDelitoComun()
                {
                    DelitoComun  = w.DELITO,
                    Sexo         = w.SEXO,
                    Indiciados   = w.INDICIADO,
                    Procesados   = w.PROCESADO,
                    Sentenciados = w.SENTENCIADO,
                    Total        = w.TOTAL
                });
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Reset();
                }));
                Reporte.LocalReport.ReportPath = "../../Reportes/rPoblacionPorDelitoComun.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds1);

                ReportDataSource rds2 = new ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = reporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte.", ex);
            }
        }
Exemplo n.º 9
0
        private void GenerarReporte3()
        {
            try
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Collapsed;
                    Reporte.Reset();
                }));
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var header = new List <cReporteDatos>();
                header.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1,
                    Encabezado2 = Parametro.ENCABEZADO2,
                    Encabezado3 = Parametro.ENCABEZADO3,
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Titulo      = "Plantilla de Personal Técnico"
                });

                var reporte = new List <cPlantillaPersonalTecnico>(new cUsuario().ObtenerReportePlantillaPersonalTecnico(GlobalVar.gCentro).Select(w => new cPlantillaPersonalTecnico()
                {
                    DEPARTAMENTO = w.DEPARTAMENTO,
                    ROL          = w.ROL,
                    TOTAL        = w.TOTAL
                }));

                Reporte.LocalReport.ReportPath = "Reportes/rPlantillaPersonalTecnico.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = header;
                Reporte.LocalReport.DataSources.Add(rds1);

                ReportDataSource rds2 = new ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = reporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                    ReportViewerVisible = Visibility.Visible;
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte.", ex);
            }
        }
        private async void CambioPropiedad(object parametro)
        {
            if (parametro != null)
            {
                switch (parametro.ToString())
                {
                case "selectedtraslado":
                    await StaticSourcesViewModel.CargarDatosAsync <bool>(() =>
                    {
                        if (SelectedTraslado != null)
                        {
                            DT_Fecha               = SelectedTraslado.TRASLADO_DETALLE.TRASLADO.TRASLADO_FEC;
                            DT_Autorizado          = SelectedTraslado.TRASLADO_DETALLE.TRASLADO.AUTORIZA_TRASLADO;
                            DT_Centro_Origen       = new cCentro().Obtener(SelectedTraslado.TRASLADO_DETALLE.TRASLADO.CENTRO_ORIGEN.Value).First().DESCR;
                            DT_Justificacion       = SelectedTraslado.TRASLADO_DETALLE.TRASLADO.JUSTIFICACION;
                            DT_Motivo              = SelectedTraslado.TRASLADO_DETALLE.TRASLADO.TRASLADO_MOTIVO.DESCR;
                            DT_Oficio_Autorizacion = SelectedTraslado.TRASLADO_DETALLE.TRASLADO.OFICIO_AUTORIZACION;
                            if (SelectedTraslado.TRASLADO_DETALLE.INGRESO.INGRESO_BIOMETRICO
                                .Any(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG))
                            {
                                ImagenIngreso = SelectedTraslado.TRASLADO_DETALLE.INGRESO.INGRESO_BIOMETRICO
                                                .Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).FirstOrDefault().BIOMETRICO;
                            }
                            else
                            {
                                ImagenIngreso = new Imagenes().getImagenPerson();
                            }
                            DatosTrasladosVisible = Visibility.Visible;
                        }
                        else
                        {
                            DatosTrasladosVisible = Visibility.Hidden;
                        }
                        return(true);
                    });

                    break;

                case "salir_menu":
                    SalirMenu();
                    break;
                }
            }
        }
Exemplo n.º 11
0
        public IQueryable <PARAMETRO> Obtener(short?centro = null, string clave = "", string valor = "", int?valor_num = null, string descripcion = "")
        {
            try
            {
                IQueryable <PARAMETRO> queryParametro = null; //< -------------Obtener si se retorna esta variable es porque el centro esta inactivo(Regresa un Null)
                var predicate       = PredicateBuilder.True <PARAMETRO>();
                var predicateCentro = PredicateBuilder.True <CENTRO>();

                predicateCentro = predicateCentro.And(wCentro => wCentro.ID_CENTRO == centro && wCentro.ESTATUS.Equals("S"));
                var EstatusCentro = new cCentro().GetData(predicateCentro.Expand());
                if (EstatusCentro.Count() > 0)
                {
                    if (centro.HasValue)
                    {
                        predicate = predicate.And(w => w.ID_CENTRO == centro);
                    }
                    if (!string.IsNullOrEmpty(clave))
                    {
                        predicate = predicate.And(w => w.ID_CLAVE.Trim().ToUpper().Contains(clave.Trim().ToUpper()));
                    }
                    if (!string.IsNullOrEmpty(valor))
                    {
                        predicate = predicate.And(w => w.VALOR.Trim().ToUpper().Contains(valor.Trim().ToUpper()));
                    }
                    if (valor_num.HasValue)
                    {
                        predicate = predicate.And(w => w.VALOR_NUM == valor_num);
                    }
                    if (!string.IsNullOrEmpty(descripcion))
                    {
                        predicate = predicate.And(w => w.PARAMETRO_CLAVE.DESCR.Trim().ToUpper().Contains(descripcion.Trim().ToUpper()));
                    }
                }
                else
                {
                    return(queryParametro);//<-regresa null en la consulta porque el centro que busca esta inactivo
                }
                return(GetData(predicate.Expand()));
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
 private void GetCentros()
 {
     try
     {
         cCentro centro = new cCentro();
         ListItems = new ObservableCollection <CENTRO>(centro.ObtenerTodos(Busqueda, SelectedEntidad.ID_ENTIDAD, SelectedMunicipio.ID_MUNICIPIO));
         if (ListItems.Count > 0)
         {
             EmptyVisible = false;
         }
         else
         {
             EmptyVisible = true;
         }
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al obtener datos.", ex);
     }
 }
 private bool GeneraReporteDatos()
 {
     try
     {
         ds_detalle = SelectedTraslado.TRASLADO_DETALLE
                      .Select(s => new EXT_REPORTE_TRASLADO_DETALLE
         {
             CERESO_DESTINO  = s.TRASLADO.CENTRO.DESCR,
             EXPEDIENTE      = s.ID_ANIO.ToString() + "/" + s.ID_CENTRO.ToString().PadLeft(2, '0') + "-" + s.ID_INGRESO.ToString(),
             FEC_TRASLADO    = s.TRASLADO.TRASLADO_FEC,
             MOTIVO_TRASLADO = s.TRASLADO.TRASLADO_MOTIVO.DESCR,
             NOMBRECOMPLETO  = ObtieneNombre(s.INGRESO.IMPUTADO),
             UBICACION       = s.INGRESO.CAMA != null ?
                               s.INGRESO.CAMA.CELDA != null ?
                               s.INGRESO.CAMA.CELDA.SECTOR != null ?
                               s.INGRESO.CAMA.CELDA.SECTOR.EDIFICIO != null ?
                               s.INGRESO.CAMA.CELDA.SECTOR.EDIFICIO.DESCR.Trim() + "-" + s.INGRESO.CAMA.CELDA.SECTOR.DESCR.Trim() + "" + s.INGRESO.CAMA.CELDA.ID_CELDA.ToString().Trim() + "-" + s.INGRESO.CAMA.ID_CAMA
                             : string.Empty
                         : string.Empty
                     : string.Empty
                 : string.Empty,
         }).ToList();
         var logo_bc = new cParametro().Seleccionar("LOGO_ESTADO", 0).FirstOrDefault().CONTENIDO;
         var centro  = new cCentro().Obtener(SelectedTraslado.CENTRO_ORIGEN.Value).FirstOrDefault().DESCR;
         ds_encabezado = new List <EXT_REPORTE_TRASLADO_ENCABEZADO>()
         {
             new EXT_REPORTE_TRASLADO_ENCABEZADO {
                 LOGO_BC       = logo_bc,
                 FEC_TRASLADO  = SelectedTraslado.TRASLADO_FEC,
                 CENTRO_ORIGEN = centro
             }
         };
         return(true);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemplo n.º 14
0
 private void CargarListas()
 {
     try
     {
         LstTipoVisitante    = new ObservableCollection <TIPO_VISITANTE>(new cTipoVisitante().ObtenerTodos());
         LstPais             = new ObservableCollection <PAIS_NACIONALIDAD>(new cPaises().ObtenerTodos());
         LstTipoDiscapacidad = new ObservableCollection <TIPO_DISCAPACIDAD>(new cTipoDiscapacidad().ObtenerTodos());
         System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate
         {
             LstTipoVisitante.Insert(0, new TIPO_VISITANTE()
             {
                 ID_TIPO_VISITANTE = -1, DESCR = "SELECCIONE"
             });
             LstPais.Insert(0, new PAIS_NACIONALIDAD()
             {
                 ID_PAIS_NAC = -1, PAIS = "SELECCIONE"
             });
             LstTipoDiscapacidad.Insert(0, new TIPO_DISCAPACIDAD()
             {
                 ID_TIPO_DISCAPACIDAD = -1, DESCR = "SELECCIONE"
             });
             var centro = new cCentro().Obtener(GlobalVar.gCentro).SingleOrDefault();
             if (centro != null)
             {
                 EPais = centro.MUNICIPIO.ENTIDAD.PAIS_NACIONALIDAD.ID_PAIS_NAC;
                 EEstado = centro.ID_ENTIDAD;
                 EMunicipio = centro.ID_MUNICIPIO;
             }
             StaticSourcesViewModel.SourceChanged = false;
         }));
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar listados.", ex);
     }
 }
Exemplo n.º 15
0
        private void GenerarReporte()
        {
            try
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Reset();
                    Repositorio.Visibility = Visibility.Collapsed;
                }));
                var centro       = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1,
                    Encabezado2 = Parametro.ENCABEZADO2,
                    Centro      = centro.DESCR.Trim(),
                    Titulo      = string.Format("{0} DEL {1} AL {2}", Altas ? "ALTAS" : "BAJAS", FechaInicio.Value.ToString("dd/MM/yyyy"), FechaFin.Value.ToString("dd/MM/yyyy")),
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2
                });

                //Obtenemos el listado de personas
                var lista = new cIngreso().ObtenerAltasBajas(FechaInicio, FechaFin, Altas ? 1 : 2).Select(w => new cReporteAltasBajas()
                {
                    Id_Anio     = w.ID_ANIO,
                    Id_Imputado = w.ID_IMPUTADO,
                    Id_Ingreso  = w.ID_INGRESO,
                    Edificio    = w.CAMA.CELDA.SECTOR.EDIFICIO.DESCR,
                    Sector      = w.CAMA.CELDA.SECTOR.DESCR,
                    Id_Celda    = w.CAMA.CELDA.ID_CELDA,
                    Id_Cama     = w.ID_UB_CAMA,
                    Nombre      = w.IMPUTADO.NOMBRE,
                    Paterno     = w.IMPUTADO.PATERNO,
                    Materno     = w.IMPUTADO.MATERNO,
                    Anio_Gob    = w.ANIO_GOBIERNO.HasValue ? w.ANIO_GOBIERNO.Value : 0,
                    Folio_Gob   = w.FOLIO_GOBIERNO,
                    Fecha       = Altas ? w.FEC_INGRESO_CERESO.Value : w.FEC_SALIDA_CERESO.Value
                });

                Reporte.LocalReport.ReportPath = "Reportes/rAltasBajas.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet3";
                rds1.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds1);

                ReportDataSource rds2 = new ReportDataSource();
                rds2.Name  = "DataSet1";
                rds2.Value = lista;
                Reporte.LocalReport.DataSources.Add(rds2);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.RefreshReport();
                    Repositorio.Visibility = Visibility.Visible;
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte.", ex);
            }
        }
Exemplo n.º 16
0
        public async void GenerarReporte()
        {
            var datosReporte = new List <cReporteDatos>();
            var centro       = new CENTRO();
            var lVisitas     = new List <cVisitaFamiliar>();
            var usuario      = new USUARIO();
            await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Collapsed;
                }));
                try
                {
                    usuario = new cUsuario().ObtenerUsuario(GlobalVar.gUsr);
                    centro  = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                    datosReporte.Add(new cReporteDatos()
                    {
                        Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                        Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                        Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                        Titulo      = "VISITA FAMILIAR",
                        Logo1       = Parametro.REPORTE_LOGO1,
                        Logo2       = Parametro.REPORTE_LOGO2,
                        Centro      = centro.DESCR.Trim().ToUpper(),
                    });
                    short TIPO_VISITANTE = 0;
                    Int16.TryParse(Parametro.ID_TIPO_PERSONA_VISITA, out TIPO_VISITANTE);
                    lVisitas = new cAduana().
                               ObtenerVisitantesFamiliaresPorFecha(TIPO_VISITANTE, SelectedFechaInicial, SelectedFechaFinal).
                               AsEnumerable().
                               Select(s =>
                                      new cVisitaFamiliar()
                    {
                        TipoPersona = ObtenerEdad(s.PERSONA.FEC_NACIMIENTO.Value) < MAYORIA_DE_EDAD ? MENORES : (s.PERSONA.SEXO == FEMENINO ? MUJERES : HOMBRES)
                    }).ToList();
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(ex.Message);
                }
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Visible;
                }));
            });

            Reporte.LocalReport.ReportPath = "Reportes/rVisitaFamiliar.rdlc";
            Reporte.LocalReport.DataSources.Clear();

            ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();

            ReportDataSource_Encabezado.Name  = "DataSet2";
            ReportDataSource_Encabezado.Value = datosReporte;

            ReportDataSource ReportDataSource = new ReportDataSource();

            ReportDataSource.Name  = "DataSet1";
            ReportDataSource.Value = lVisitas;

            Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
            Reporte.LocalReport.DataSources.Add(ReportDataSource);

            Reporte.LocalReport.SetParameters(new ReportParameter(("Usuario"), ObtenerNombreUsuario(usuario)));
            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaActual"), string.Format("{0}/{1}/{2} {3}:{4}", Fechas.GetFechaDateServer.Day, Fechas.GetFechaDateServer.Month, Fechas.GetFechaDateServer.Year, (Fechas.GetFechaDateServer.Hour < 10 ? string.Format("0{0}", Fechas.GetFechaDateServer.Hour) : Fechas.GetFechaDateServer.Hour.ToString()), (Fechas.GetFechaDateServer.Minute < 10 ? string.Format("0{0}", Fechas.GetFechaDateServer.Minute) : Fechas.GetFechaDateServer.Minute.ToString()))));
            Reporte.LocalReport.SetParameters(new ReportParameter(("Centro"), centro.DESCR.Trim().ToUpper()));
            Reporte.LocalReport.SetParameters(new ReportParameter(("ComandanteEstatal"), Parametro.COMANDANTE_ESTATAL_CENTROS));
            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaInicial"), string.Format("{0}/{1}/{2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaFinal"), string.Format("{0}/{1}/{2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));

            Reporte.Refresh();
            Reporte.RefreshReport();
        }
        private void GenerarReporte()
        {
            try
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Repositorio.Visibility = Visibility.Collapsed;
                }));
                var centro       = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                    Titulo      = "Reporte de Reubicaciones",
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Centro      = centro.DESCR.Trim().ToUpper(),
                });

                #region Reporte
                List <string> termsList = new List <string>();
                var           ri        = new List <cReubicacionInterno>();
                var           rid       = new List <cReubicacionInternoDetalle>();
                #endregion

                var lstIngreso     = new List <cReubicacionInterno>();
                var lstReubicacion = new cIngresoUbicacionAnterior().ObtenerTodos(GlobalVar.gCentro, FFechaInicio.Value.Date, FFechaFin.Value.Date).Where(w => w.ID_UB_CENTRO == GlobalVar.gCentro);

                if (lstReubicacion != null)
                {
                    lstIngreso = new List <cReubicacionInterno>(lstReubicacion.Select(w => new cReubicacionInterno()
                    {
                        Centro    = w.ID_CENTRO,
                        Anio      = w.ID_ANIO,
                        Imputado  = w.ID_IMPUTADO,
                        IdIngreso = w.ID_INGRESO,
                        Ingreso   = w,
                    }));
                }
                foreach (var item in lstIngreso)
                {
                    var consulta_interno = item.Ingreso.INGRESO;
                    var edificio         = consulta_interno.CAMA.CELDA.SECTOR.EDIFICIO;
                    var sector           = consulta_interno.CAMA.CELDA.SECTOR;
                    var celda            = consulta_interno.CAMA.CELDA;
                    var cama             = consulta_interno.CAMA;
                    item.Expediente      = string.Format("{0}/{1}", item.Ingreso.ID_ANIO, item.Ingreso.ID_IMPUTADO);
                    item.Nombre          = item.Ingreso.INGRESO.IMPUTADO.NOMBRE.Trim() + " " + (string.IsNullOrEmpty(item.Ingreso.INGRESO.IMPUTADO.PATERNO) ? string.Empty : item.Ingreso.INGRESO.IMPUTADO.PATERNO.Trim()) + " " + (string.IsNullOrEmpty(item.Ingreso.INGRESO.IMPUTADO.MATERNO) ? string.Empty : item.Ingreso.INGRESO.IMPUTADO.MATERNO.Trim());
                    item.UbicacionActual = string.Format("{0}-{1}-{2}-{3}",
                                                         edificio != null ? edificio.DESCR.TrimEnd() : string.Empty,
                                                         sector != null ? sector.DESCR.TrimEnd() : string.Empty,
                                                         celda != null ? celda.ID_CELDA.TrimEnd() : string.Empty,
                                                         cama != null ? cama.ID_CAMA : 0);
                }
                lstIngreso = new List <cReubicacionInterno>(lstIngreso.OrderByDescending(o => o.Ingreso.ID_CONSEC));
                var DistinctItems = lstIngreso.GroupBy(x => new { x.Imputado }).Select(y => y.First());
                foreach (var n in DistinctItems)
                {
                    var consulta_interno        = n.Ingreso.INGRESO;
                    var edificio                = consulta_interno.CAMA.CELDA.SECTOR.EDIFICIO;
                    var sector                  = consulta_interno.CAMA.CELDA.SECTOR;
                    var celda                   = consulta_interno.CAMA.CELDA;
                    var lst_ingreso_reubicacion = new cIngresoUbicacionAnterior().ObtenerTodos(GlobalVar.gCentro, n.Anio, n.Imputado, n.IdIngreso, FFechaInicio.Value.Date, FFechaFin.Value.Date).Where(w => w.ID_UB_CENTRO == GlobalVar.gCentro).ToList();
                    if (lst_ingreso_reubicacion != null)
                    {
                        var demo = new List <cReubicacionInternoDetalle>(lst_ingreso_reubicacion.Select(w => new cReubicacionInternoDetalle()
                        {
                            Centro    = w.ID_CENTRO,
                            Anio      = w.ID_ANIO,
                            Imputado  = w.ID_IMPUTADO,
                            IdIngreso = w.ID_INGRESO,
                            Ubicacion = string.Format("{0}-{1}-{2}-{3}",
                                                      edificio != null ?  edificio.DESCR.TrimEnd() : string.Empty,
                                                      sector != null ? sector.DESCR.TrimEnd() : string.Empty,
                                                      celda != null ? celda.ID_CELDA.TrimEnd() : string.Empty,
                                                      w.CAMA != null ? w.CAMA.ID_CAMA : 0),
                            Fecha   = w.REGISTRO_FEC.Value,
                            Motivo  = w.MOTIVO_CAMBIO,
                            Ingreso = w,
                        }));
                        //int numero = 0;
                        foreach (var row in demo)
                        {
                            //numero += 1;
                            row.CountTotal += 1;
                            rid.Add(row);
                            termsList.Add(row.Imputado.ToString());
                        }
                    }
                    ri.Add(n);
                }
                // You can convert it back to an array if you would like to
                var bla = termsList.Cast <String>().ToArray();
                rid = new List <cReubicacionInternoDetalle>(rid);
                //ARMAMOS EL REPORTE
                Reporte.LocalReport.ReportPath = "Reportes/rInternosReubicacion.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds2.Name  = "DataSet1";
                rds2.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                Microsoft.Reporting.WinForms.ReportDataSource rds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds1.Name  = "DataSet2";
                rds1.Value = ri;
                Reporte.LocalReport.DataSources.Add(rds1);

                #region Subreporte
                Reporte.LocalReport.SubreportProcessing += (s, e) =>
                {
                    if (e.ReportPath.Equals("srInternosReubicacionDetalle", StringComparison.InvariantCultureIgnoreCase))
                    {
                        ReportDataSource ds = new ReportDataSource("DataSet4", rid);
                        e.DataSources.Add(ds);
                    }
                };
                #endregion

                #region Parametros
                Reporte.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("Imputado", bla));
                #endregion

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Repositorio.Visibility = Visibility.Visible;
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
        private void GenerarReporte()
        {
            try
            {
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                    Titulo      = "RELACIÓN DE INTERNOS",
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Centro      = centro.DESCR.Trim().ToUpper(),
                });


                #region armar reporte
                var hoy     = Fechas.GetFechaDateServer;
                var f       = new Fechas();
                var reporte = new List <cReporteListadoGeneralDelito>();
                var lista   = new cIngreso().ReporteGeneralDelito(GlobalVar.gCentro, OrdenarPor, Ordenamiento);
                if (lista != null)
                {
                    foreach (var w in lista)
                    {
                        reporte.Add(new cReporteListadoGeneralDelito()
                        {
                            Expediente     = string.Format("{0}/{1}", w.ID_ANIO, w.ID_IMPUTADO),
                            Ingreso        = w.ID_INGRESO.ToString(),
                            Edad           = IncluirEdad ? (short?)f.CalculaEdad(w.NACIMIENTO_FECHA, hoy) : 0,
                            NombreCompleto = string.Format("{0} {1} {2}",
                                                           !string.IsNullOrEmpty(w.NOMBRE) ? w.NOMBRE.Trim() : string.Empty,
                                                           !string.IsNullOrEmpty(w.PATERNO) ? w.PATERNO.Trim() : string.Empty,
                                                           !string.IsNullOrEmpty(w.MATERNO) ? w.MATERNO.Trim() : string.Empty),
                            Ubicacion = string.Format("{0}-{1}-{2}-{3}",
                                                      !string.IsNullOrEmpty(w.EDIFICIO) ? w.EDIFICIO.Trim() : string.Empty,
                                                      !string.IsNullOrEmpty(w.SECTOR) ? w.SECTOR.Trim() : string.Empty,
                                                      !string.IsNullOrEmpty(w.CELDA) ? w.CELDA.Trim() : string.Empty,
                                                      w.CAMA),
                            Fuero         = string.IsNullOrEmpty(w.FUERO) ? (w.FUERO == "C" ? "COMUN" : w.FUERO == "F" ? "FEDERAL" : "DESCONOCIDO") : "DESCONOCIDO",
                            Situacion     = w.CLASIFICACION_JURIDICA,
                            FechaIngreso  = w.FEC_INGRESO_CERESO,
                            DelitoIngreso = w.INGRESO_DELITO,
                            Foto          = IncluirFoto ? (w.FOTO != null ? w.FOTO : new Imagenes().getImagenPerson()) : null,
                            Alias         = w.ALIAS,
                        });
                    }
                }
                #endregion

                #region Reporte
                Reporte.LocalReport.ReportPath = "Reportes/rListadoGeneralDelito.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                var rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                var rds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = reporte;
                Reporte.LocalReport.DataSources.Add(rds1);

                #region Parametros
                Reporte.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("MostrarEdad", IncluirEdad ? "N" : "S"));
                Reporte.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("MostrarFoto", IncluirFoto ? "N" : "S"));
                #endregion

                //cReporteListadoGeneralDelito
                #region comentado
                //ListValue = new cIngreso().GetData().Where(w => w.ID_UB_CENTRO == GlobalVar.gCentro && !Parametro.ESTATUS_ADMINISTRATIVO_INACT.Contains(w.ID_ESTATUS_ADMINISTRATIVO)).GroupBy(g => new { g.ID_ANIO, g.ID_IMPUTADO }).SelectMany(sm => sm.Where(w => w.ID_INGRESO == sm.Max(m => m.ID_INGRESO))).AsEnumerable().Select(s => new cReporteListadoGeneralDelito()
                //{
                //    ID_ANIO = s.ID_ANIO,
                //    ID_IMPUTADO = s.ID_IMPUTADO,
                //    Expediente = s.ID_ANIO + "\\" + s.ID_IMPUTADO,
                //    NombreCompleto = (s.IMPUTADO.PATERNO != null ? s.IMPUTADO.PATERNO.Trim() : string.Empty) + " " + (s.IMPUTADO.MATERNO != null ? s.IMPUTADO.MATERNO.Trim() : string.Empty) + " " + (s.IMPUTADO.NOMBRE != null ? s.IMPUTADO.NOMBRE.Trim() : string.Empty),
                //    Ingreso = s.ID_INGRESO.ToString(),
                //    Alias = getAlias(s.IMPUTADO.ALIAS),// "preguntar por alias",
                //    DelitoIngreso = s.INGRESO_DELITO != null ? s.INGRESO_DELITO.DESCR : string.Empty,
                //    Fuero = "preguntar por fuero",
                //    Situacion = s.CLASIFICACION_JURIDICA != null ? s.CLASIFICACION_JURIDICA.DESCR.Trim() : string.Empty,
                //    Ubicacion = s.CAMA != null ? s.CAMA.CELDA.SECTOR.EDIFICIO.DESCR.Trim() + "-" + s.CAMA.CELDA.SECTOR.DESCR.Trim() + s.CAMA.CELDA.ID_CELDA.Trim() + "-" + (string.IsNullOrEmpty(s.CAMA.DESCR) ? s.CAMA.ID_CAMA.ToString().Trim() : s.CAMA.ID_CAMA + " " + s.CAMA.DESCR.Trim()) : string.Empty,
                //    Foto = IncluirFoto ? s.INGRESO_BIOMETRICO.Any(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG) ? s.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).FirstOrDefault().BIOMETRICO : null : null,


                //    FechaIngreso = s.FEC_INGRESO_CERESO,
                //    Edad = IncluirEdad ? new Fechas().CalculaEdad(s.IMPUTADO.NACIMIENTO_FECHA) : new Nullable<short>()
                //}).ToList();

                //switch (SelectedValue)
                //{
                //    case OrderByValues.Ninguno:
                //        break;
                //    case OrderByValues.Numero_Expediente:
                //        if (Ordenamiento)
                //            rds1.Value = ListValue.OrderBy(o => o.ID_ANIO).ThenBy(t => t.ID_IMPUTADO).ToList();
                //        else
                //            rds1.Value = ListValue.OrderByDescending(o => o.ID_ANIO).ThenByDescending(t => t.ID_IMPUTADO).ToList();
                //        break;
                //    case OrderByValues.Nombre_Interno:
                //        if (Ordenamiento)
                //            rds1.Value = ListValue.OrderBy(o => o.NombreCompleto).ToList();
                //        else
                //            rds1.Value = ListValue.OrderByDescending(o => o.Expediente).ToList();
                //        break;
                //    case OrderByValues.Fecha_Ingreso:
                //        if (Ordenamiento)
                //            rds1.Value = ListValue.OrderBy(o => o.FechaIngreso).ToList();
                //        else
                //            rds1.Value = ListValue.OrderByDescending(o => o.Expediente).ToList();
                //        break;
                //    case OrderByValues.Ubicacion:
                //        if (Ordenamiento)
                //            rds1.Value = ListValue.OrderBy(o => o.Ubicacion).ToList();
                //        else
                //            rds1.Value = ListValue.OrderByDescending(o => o.Expediente).ToList();
                //        break;
                //    case OrderByValues.Clasificacion_Juridica:
                //        if (Ordenamiento)
                //            rds1.Value = ListValue.OrderBy(o => o.DelitoIngreso).ToList();
                //        else
                //            rds1.Value = ListValue.OrderByDescending(o => o.Expediente).ToList();
                //        break;
                //    default:
                //        break;
                //}

                //Reporte.LocalReport.DataSources.Add(rds1);
                #endregion

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.RefreshReport();
                }));
                #endregion
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
Exemplo n.º 19
0
        private void ReportViewer_Load(object sender, EventArgs e)
        {
            try
            {
                ReporteViewer.ShowExportButton = false;
                if (ing != null)
                {
                    ing = (new cIngreso()).Obtener(ing.ID_CENTRO, ing.ID_ANIO, ing.ID_IMPUTADO, ing.ID_INGRESO);
                    if (ing != null)
                    {
                        var f = new cFicha();
                        //HEADER
                        var imp = ing.IMPUTADO;
                        f.Expediente    = string.Format("{0}/{1}", imp.ID_ANIO, imp.ID_IMPUTADO);
                        f.FolioGobierno = string.Format("{0}/{1}", ing.ANIO_GOBIERNO, ing.FOLIO_GOBIERNO);
                        f.NoIngreso     = ing.ID_INGRESO.ToString();
                        f.FecIngreso    = ing.FEC_INGRESO_CERESO.HasValue ? ing.FEC_INGRESO_CERESO.Value.ToString("dd/MM/yyyy") : string.Empty;
                        f.HoraIngreso   = ing.FEC_INGRESO_CERESO.HasValue ? ing.FEC_INGRESO_CERESO.Value.ToString("HH:mm:ss") : string.Empty;
                        f.Nombre        = string.Format("{0} {1} {2}", !string.IsNullOrEmpty(imp.NOMBRE) ? imp.NOMBRE.Trim() : string.Empty, !string.IsNullOrEmpty(imp.PATERNO) ? imp.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(imp.MATERNO) ? imp.MATERNO.Trim() : string.Empty);

                        f.Alias = string.Empty;
                        if (imp.ALIAS != null)
                        {
                            foreach (var i in imp.ALIAS)
                            {
                                if (!string.IsNullOrEmpty(f.Alias))
                                {
                                    f.Alias = string.Format("{0}, ", f.Alias);
                                }
                                f.Alias = string.Format("{0} {1} {2} {3}", f.Alias, !string.IsNullOrEmpty(i.NOMBRE) ? i.NOMBRE.Trim() : string.Empty, !string.IsNullOrEmpty(i.PATERNO) ? i.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(i.MATERNO) ? i.MATERNO.Trim() : string.Empty);
                            }
                        }
                        f.Apodo = string.Empty;
                        if (f.Apodo != null)
                        {
                            foreach (var a in imp.APODO)
                            {
                                if (!string.IsNullOrEmpty(f.Apodo))
                                {
                                    f.Apodo = string.Format("{0}, ", f.Apodo);
                                }
                                f.Apodo = string.Format("{0}{1}", f.Apodo, a.APODO1);
                            }
                        }
                        f.Estatus             = ing.ESTATUS_ADMINISTRATIVO != null ? !string.IsNullOrEmpty(ing.ESTATUS_ADMINISTRATIVO.DESCR) ? ing.ESTATUS_ADMINISTRATIVO.DESCR.Trim() : string.Empty : string.Empty;
                        f.TipoIngreso         = ing.TIPO_INGRESO != null ? !string.IsNullOrEmpty(ing.TIPO_INGRESO.DESCR) ? ing.TIPO_INGRESO.DESCR.Trim() : string.Empty : string.Empty;
                        f.NoOficioInternacion = ing.DOCINTERNACION_NUM_OFICIO;
                        f.Autoridad           = ing.TIPO_AUTORIDAD_INTERNA != null ? !string.IsNullOrEmpty(ing.TIPO_AUTORIDAD_INTERNA.DESCR) ? ing.TIPO_AUTORIDAD_INTERNA.DESCR.Trim() : string.Empty : string.Empty;
                        f.ADisposicion        = ing.TIPO_DISPOSICION != null ? !string.IsNullOrEmpty(ing.TIPO_DISPOSICION.DESCR) ? ing.TIPO_DISPOSICION.DESCR.Trim() : string.Empty : string.Empty;
                        //DATOS GENERALES
                        f.Padre = string.Format("{0} {1} {2}", !string.IsNullOrEmpty(imp.NOMBRE_PADRE) ? imp.NOMBRE_PADRE.Trim() : string.Empty, !string.IsNullOrEmpty(imp.PATERNO_PADRE) ? imp.PATERNO_PADRE.Trim() : string.Empty, !string.IsNullOrEmpty(imp.MATERNO_PADRE) ? imp.MATERNO_PADRE.Trim() : string.Empty);
                        f.Madre = string.Format("{0} {1} {2}", !string.IsNullOrEmpty(imp.NOMBRE_MADRE) ? imp.NOMBRE_MADRE.Trim() : string.Empty, !string.IsNullOrEmpty(imp.PATERNO_MADRE) ? imp.PATERNO_MADRE.Trim() : string.Empty, !string.IsNullOrEmpty(imp.MATERNO_MADRE) ? imp.MATERNO_MADRE.Trim() : string.Empty);
                        var originario = new List <MUNICIPIO>((new cMunicipio()).Obtener(imp.NACIMIENTO_ESTADO.Value, imp.NACIMIENTO_MUNICIPIO.Value));
                        f.Originario = string.Empty;
                        if (originario != null)
                        {
                            if (originario.Count > 0)
                            {
                                var o = originario[0];
                                f.Originario = string.Format("{0},{1},{2}", originario[0].MUNICIPIO1, originario[0].ENTIDAD.DESCR, originario[0].ENTIDAD.PAIS_NACIONALIDAD.PAIS);
                            }
                        }

                        f.Domicilio     = ing.DOMICILIO_CALLE;
                        f.Numero        = ing.DOMICILIO_NUM_EXT.HasValue ? ing.DOMICILIO_NUM_EXT.Value.ToString() : string.Empty;
                        f.Colonia       = ing.COLONIA != null ? !string.IsNullOrEmpty(ing.COLONIA.DESCR) ? ing.COLONIA.DESCR.Trim() : string.Empty : string.Empty;
                        f.Ciudad        = ing.MUNICIPIO != null ? !string.IsNullOrEmpty(ing.MUNICIPIO.MUNICIPIO1) ? ing.MUNICIPIO.MUNICIPIO1.Trim() : string.Empty : string.Empty;
                        f.FecNacimiento = imp.NACIMIENTO_FECHA.HasValue ? imp.NACIMIENTO_FECHA.Value.ToString("dd/MM/yyyy") : string.Empty;
                        var calcula = new Fechas();
                        f.Edad = calcula.CalculaEdad(imp.NACIMIENTO_FECHA).ToString();
                        f.Sexo = imp.SEXO == "M" ? "MASCULINO" : "FEMENINO";
                        //f.EdoCivil = imp.ESTADO_CIVIL != null ? !string.IsNullOrEmpty(imp.ESTADO_CIVIL.DESCR) ? imp.ESTADO_CIVIL.DESCR.Trim() : string.Empty : string.Empty;
                        //f.Religion = imp.RELIGION != null ? !string.IsNullOrEmpty(imp.RELIGION.DESCR) ? imp.RELIGION.DESCR.Trim() : string.Empty : string.Empty;
                        //f.Ocupacion = imp.OCUPACION != null ? !string.IsNullOrEmpty(imp.OCUPACION.DESCR) ? imp.OCUPACION.DESCR.Trim() : string.Empty : string.Empty;
                        //f.GradoMaxEstudio = imp.ESCOLARIDAD != null ? !string.IsNullOrEmpty(imp.ESCOLARIDAD.DESCR) ? imp.ESCOLARIDAD.DESCR.Trim() : string.Empty : string.Empty;
                        f.EdoCivil           = ing.ESTADO_CIVIL != null ? !string.IsNullOrEmpty(ing.ESTADO_CIVIL.DESCR) ? ing.ESTADO_CIVIL.DESCR.Trim() : string.Empty : string.Empty;
                        f.Religion           = ing.RELIGION != null ? !string.IsNullOrEmpty(ing.RELIGION.DESCR) ? ing.RELIGION.DESCR.Trim() : string.Empty : string.Empty;
                        f.Ocupacion          = ing.OCUPACION != null ? !string.IsNullOrEmpty(ing.OCUPACION.DESCR) ? ing.OCUPACION.DESCR.Trim() : string.Empty : string.Empty;
                        f.GradoMaxEstudio    = ing.ESCOLARIDAD != null ? !string.IsNullOrEmpty(ing.ESCOLARIDAD.DESCR) ? ing.ESCOLARIDAD.DESCR.Trim() : string.Empty : string.Empty;
                        f.LugarNAcExtranjero = imp.NACIMIENTO_LUGAR;



                        //MEDIA FILIACION
                        f.Estatura = ing.ESTATURA != null?ing.ESTATURA.HasValue?ing.ESTATURA.Value.ToString() : string.Empty : string.Empty;

                        f.Peso = ing.PESO != null?ing.PESO.HasValue?ing.PESO.Value.ToString() : string.Empty : string.Empty;

                        if (imp.IMPUTADO_FILIACION != null)
                        {
                            foreach (var x in imp.IMPUTADO_FILIACION)
                            {
                                switch (x.ID_MEDIA_FILIACION)
                                {
                                case 1://NARIZ RAIZ
                                    f.NarizRaiz = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 4://NARIZ ANCHO
                                    f.NarizAncho = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 9://CABELLO COLOR
                                    f.CabelloColor = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 11://CABELLO FORMA
                                    f.CabelloForma = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 16://OJOS COLOR
                                    f.OjosColor = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 17://OJOS FORMA
                                    f.OjosForma = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 18://OJOS TAMANIO
                                    f.OjosTamano = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 19://BOCA TAMANIO
                                    f.BocaTamano = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 20://BOCA COMISURAS
                                    f.BocaComisuras = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 21://LABIOS ESPESOR
                                    f.LabiosEspesor = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 24://MENTON TIPO
                                    f.MentonTipo = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 25://MENTON FORMA
                                    f.MentonForma = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 26://MENTON INCLINACION
                                    f.MentonInclinacion = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 27://FRENTE ALTURA
                                    f.FrenteAlta = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 28://FRENTE INCLINACION
                                    f.FrenteInclinada = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 29://FRENTE ANCHO
                                    f.FrenteAncha = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 30://COLOR DE PIEL
                                    f.ColorPiel = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 32://LABIO ALTURA
                                    f.LabiosAltura = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 33://LABIO PROMINENCIA
                                    f.LabiosPromedio = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;

                                case 39://COMPLEAXION
                                    f.Complexion = x.TIPO_FILIACION != null ? !string.IsNullOrEmpty(x.TIPO_FILIACION.DESCR) ? x.TIPO_FILIACION.DESCR.Trim() : string.Empty : string.Empty;
                                    break;
                                }
                            }
                        }
                        var ficha = new List <cFicha>();
                        ficha.Add(f);
                        //CAUSAS PENALES
                        var causasPenales = new List <cCausasPenales>();
                        if (ing.CAUSA_PENAL != null)
                        {
                            foreach (var x in ing.CAUSA_PENAL)
                            {
                                var cp = new cCausasPenales();
                                cp.CausaPenal  = string.Format("{0}/{1}{2}", x.CP_ANIO, x.CP_FOLIO, string.IsNullOrEmpty(x.CP_BIS) ? string.Empty : "-" + x.CP_BIS);
                                cp.Abreviatura = string.Empty;
                                if (x.JUZGADO != null)
                                {
                                    cp.Juzgado = x.JUZGADO.DESCR;
                                }
                                cp.Consignado = x.AP_FEC_CONSIGNACION != null?x.AP_FEC_CONSIGNACION.Value.ToString("dd/MM/yyyy") : string.Empty;

                                cp.Delitos = string.Empty;//"* HOMICIDIO SIMPLE \n* PRIVACION DE LIBERTAR PERSONAL \n* DELITOS EN MATERIA DE INHUMACION Y EXHUMACION \n* RESPONSABILIDAD PROFESIONAL Y TECNICA";
                                if (x.CAUSA_PENAL_DELITO != null)
                                {
                                    foreach (var d in x.CAUSA_PENAL_DELITO)
                                    {
                                        if (string.IsNullOrEmpty(cp.Delitos))
                                        {
                                            cp.Delitos = string.Format("{0}\n", d.TIPO_DELITO != null ? !string.IsNullOrEmpty(d.TIPO_DELITO.DESCR) ? d.TIPO_DELITO.DESCR.Trim() : string.Empty : string.Empty);
                                        }
                                        cp.Delitos = string.Format("{0}* {1}", cp.Delitos, d.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(d.MODALIDAD_DELITO.DESCR) ? d.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty);
                                    }
                                }
                                causasPenales.Add(cp);
                            }
                        }

                        //SENIAS PARTICULARES
                        var seniasParticulares = new List <cSeniasParticulares>();
                        if (imp.SENAS_PARTICULARES != null)
                        {
                            foreach (var x in imp.SENAS_PARTICULARES)
                            {
                                var sp = new cSeniasParticulares();
                                sp.Significado = x.SIGNIFICADO;
                                seniasParticulares.Add(sp);
                            }
                        }
                        //BIOMETRICO (FOTOS)
                        var imputadoBiometricos = new List <cBiometricos>();
                        var ib = new cBiometricos();
                        ib.FotoIzquerda = ib.FotoCentro = ib.FotoDerecha = new Imagenes().getImagenPerson();//System.IO.File.ReadAllBytes("../../Imagen/placeholder_person.gif");
                        if (ing.INGRESO_BIOMETRICO.Where(w => w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG) != null)
                        {
                            foreach (var b in ing.INGRESO_BIOMETRICO)
                            {
                                switch (b.ID_TIPO_BIOMETRICO)
                                {
                                case (int)enumTipoBiometrico.FOTO_IZQ_SEGUIMIENTO:
                                    ib.FotoIzquerda = b.BIOMETRICO;
                                    break;

                                case (int)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO:
                                    ib.FotoCentro = b.BIOMETRICO;
                                    break;

                                case (int)enumTipoBiometrico.FOTO_DER_SEGUIMIENTO:
                                    ib.FotoDerecha = b.BIOMETRICO;
                                    break;
                                }
                            }
                        }


                        //HUELLAS
                        if (imp.IMPUTADO_BIOMETRICO != null)
                        {
                            foreach (var b in imp.IMPUTADO_BIOMETRICO.Where(w => w.ID_FORMATO == (short)enumTipoFormato.FMTO_WSQ))
                            {
                                if (b.BIOMETRICO.Length > 0)
                                {
                                    switch (b.ID_TIPO_BIOMETRICO)
                                    {
                                    case (int)enumTipoBiometrico.PULGAR_IZQUIERDO:
                                        ib.PulgarIzquierda = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.INDICE_IZQUIERDO:
                                        ib.IndiceIzquierda = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.MEDIO_IZQUIERDO:
                                        ib.MedioIzquierda = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.ANULAR_IZQUIERDO:
                                        ib.AnularIzquierda = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.MENIQUE_IZQUIERDO:
                                        ib.MeniqueIzquierda = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.PULGAR_DERECHO:
                                        ib.PulgarDerecha = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.INDICE_DERECHO:
                                        ib.IndiceDerecha = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.MEDIO_DERECHO:
                                        ib.MedioDerecha = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.ANULAR_DERECHO:
                                        ib.AnularDerecha = getHuella(b.BIOMETRICO);
                                        break;

                                    case (int)enumTipoBiometrico.MENIQUE_DERECHO:
                                        ib.MeniqueDerecha = getHuella(b.BIOMETRICO);
                                        break;
                                    }
                                }
                            }
                        }

                        //GENERALES IDIOMA
                        var gi = new List <cIdiomaGenerales>();
                        gi.Add(
                            new cIdiomaGenerales()
                        {
                            Nacionalidad      = ing.IMPUTADO != null ? ing.IMPUTADO.PAIS_NACIONALIDAD != null ? !string.IsNullOrEmpty(ing.IMPUTADO.PAIS_NACIONALIDAD.NACIONALIDAD) ? ing.IMPUTADO.PAIS_NACIONALIDAD.NACIONALIDAD.Trim() : string.Empty : string.Empty : string.Empty,
                            Idioma            = ing.IMPUTADO != null ? ing.IMPUTADO.IDIOMA != null ? !string.IsNullOrEmpty(ing.IMPUTADO.IDIOMA.DESCR) ? ing.IMPUTADO.IDIOMA.DESCR.Trim() : string.Empty : string.Empty : string.Empty,
                            Etnia             = ing.IMPUTADO != null ? ing.IMPUTADO.ETNIA != null ? !string.IsNullOrEmpty(ing.IMPUTADO.ETNIA.DESCR) ? ing.IMPUTADO.ETNIA.DESCR.Trim() : string.Empty : string.Empty : string.Empty,
                            Dialecto          = ing.IMPUTADO != null ? ing.IMPUTADO.DIALECTO != null ? !string.IsNullOrEmpty(ing.IMPUTADO.DIALECTO.DESCR) ? ing.IMPUTADO.DIALECTO.DESCR.Trim() : string.Empty : string.Empty : string.Empty,
                            RequiereTraductor = ing.IMPUTADO != null ? !string.IsNullOrEmpty(ing.IMPUTADO.TRADUCTOR) ? ing.IMPUTADO.TRADUCTOR == "S" ? "SI" : "NO" : "NO" : "NO"
                        });


                        //ib.PulgarIzquierda = System.IO.File.ReadAllBytes(@"C:\Git\seguridadpublica\ControlPenales\Imagen\huella.jpg");
                        //ib.IndiceIzquierda = System.IO.File.ReadAllBytes(@"C:\Git\seguridadpublica\ControlPenales\Imagen\huella.jpg");
                        //ib.MedioIzquierda = ib.IndiceIzquierda;
                        //ib.AnularIzquierda = ib.IndiceIzquierda;
                        //ib.MeniqueIzquierda = ib.IndiceIzquierda;
                        //ib.PulgarDerecha = ib.IndiceIzquierda;
                        //ib.IndiceDerecha = ib.IndiceIzquierda;
                        //ib.MedioDerecha = ib.IndiceIzquierda;
                        //ib.AnularDerecha = ib.IndiceIzquierda;
                        //ib.MeniqueDerecha = ib.IndiceIzquierda;
                        imputadoBiometricos.Add(ib);

                        var centro  = new cCentro().Obtener(GlobalVar.gCentro).SingleOrDefault();
                        var reporte = new List <cReporte>();
                        reporte.Add(new cReporte()
                        {
                            Encabezado1 = Parametro.ENCABEZADO1,
                            Encabezado2 = Parametro.ENCABEZADO2,
                            Encabezado3 = centro.DESCR.Trim().ToUpper(),
                            Encabezado4 = "Ficha",
                            Logo1       = Parametro.REPORTE_LOGO1,
                            Logo2       = Parametro.REPORTE_LOGO2,
                        });

                        var firmas = new List <cFirmas>();
                        firmas.Add(new cFirmas()
                        {
                            NombreUsuario     = StaticSourcesViewModel.UsuarioLogin.Nombre,
                            NombreSubdirector = Parametro.SUBDIRECTOR_CENTRO.Trim()
                        });

                        ReporteViewer.LocalReport.ReportPath = "Reportes/rFicha.rdlc";
                        ReporteViewer.LocalReport.DataSources.Clear();
                        //FICHA
                        Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource();
                        rds.Name  = "DataSet1";
                        rds.Value = ficha;
                        ReporteViewer.LocalReport.DataSources.Add(rds);
                        //CAUSA PENAL
                        Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                        rds2.Name  = "DataSet2";
                        rds2.Value = causasPenales;
                        ReporteViewer.LocalReport.DataSources.Add(rds2);
                        //SENIAS PARTICULARES
                        Microsoft.Reporting.WinForms.ReportDataSource rds3 = new Microsoft.Reporting.WinForms.ReportDataSource();
                        rds3.Name  = "DataSet3";
                        rds3.Value = seniasParticulares;
                        ReporteViewer.LocalReport.DataSources.Add(rds3);
                        //BIOMETRICO
                        Microsoft.Reporting.WinForms.ReportDataSource rds4 = new Microsoft.Reporting.WinForms.ReportDataSource();
                        rds4.Name  = "DataSet4";
                        rds4.Value = imputadoBiometricos;
                        ReporteViewer.LocalReport.DataSources.Add(rds4);
                        ReporteViewer.RefreshReport();

                        //IDIOMA
                        Microsoft.Reporting.WinForms.ReportDataSource rds5 = new Microsoft.Reporting.WinForms.ReportDataSource();
                        rds5.Name  = "DataSet5";
                        rds5.Value = gi;
                        ReporteViewer.LocalReport.DataSources.Add(rds5);

                        //Reporte
                        Microsoft.Reporting.WinForms.ReportDataSource rds6 = new Microsoft.Reporting.WinForms.ReportDataSource();
                        rds6.Name  = "DataSet6";
                        rds6.Value = reporte;
                        ReporteViewer.LocalReport.DataSources.Add(rds6);

                        //Firmas
                        Microsoft.Reporting.WinForms.ReportDataSource rds7 = new Microsoft.Reporting.WinForms.ReportDataSource();
                        rds7.Name  = "DataSet7";
                        rds7.Value = firmas;
                        ReporteViewer.LocalReport.DataSources.Add(rds7);

                        ReporteViewer.RefreshReport();
                    }
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte de la ficha.", ex);
            }
        }
        private void GenerarReporte()
        {
            try
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Repositorio.Visibility = Visibility.Collapsed;
                }));
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = centro.DESCR.Trim().ToUpper(),
                    Titulo      = "RELACIÓN DE INTERNOS",
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    //Centro = centro.DESCR.Trim().ToUpper(),
                });

                var hoy = Fechas.GetFechaDateServer.Date;

                var lstInternos = new List <cReporteRelacionInternosDetalle>();
                var lista       = new cIngreso().ReporteRelacionInterno(GlobalVar.gCentro, OrdenarPor);
                if (lista != null)
                {
                    foreach (var w in lista)
                    {
                        lstInternos.Add(new cReporteRelacionInternosDetalle()
                        {
                            Hoy           = hoy,
                            Anio          = w.ID_ANIO,
                            Imputado      = w.ID_IMPUTADO,
                            Nombre        = w.NOMBRE,
                            Paterno       = w.PATERNO,
                            Materno       = w.MATERNO,
                            FecNacimiento = IncluirEdad ? w.NACIMIENTO_FECHA : null,
                            Fuero         = string.IsNullOrEmpty(w.FUERO) ? (w.FUERO == "C" ? "COMUN" : w.FUERO == "F" ? "FEDERAL" : "DESCONOCIDO") : "DESCONOCIDO",
                            Clasificacion = w.CLASIFICACION_JURIDICA,
                            Ubicacion     = string.Format("{0}-{1}-{2}-{3}",
                                                          !string.IsNullOrEmpty(w.EDIFICIO) ? w.EDIFICIO.Trim() : string.Empty,
                                                          !string.IsNullOrEmpty(w.SECTOR) ? w.SECTOR.Trim() : string.Empty,
                                                          !string.IsNullOrEmpty(w.CELDA) ? w.CELDA.Trim() : string.Empty,
                                                          w.CAMA),
                            Foto = IncluirFoto ? (w.FOTO != null ? w.FOTO : new Imagenes().getImagenPerson()) : null,
                        });
                    }
                }

                #region comentado
                //var ingresos = new cIngreso().ObtenerIngresosActivos(GlobalVar.gCentro).Where(w => w.CAMA != null);//.Where(w => w.ID_UB_CENTRO > 0 && w.ID_UB_SECTOR > 0 && !string.IsNullOrEmpty(w.ID_UB_CELDA) && w.ID_UB_CAMA > 0 && w.CAMA != null);
                //if (ingresos != null)
                //{
                //    switch (OrdenarPor)
                //    {
                //        case 1://expediente
                //            ingresos = ingresos.OrderBy(w => new { w.ID_ANIO, w.ID_IMPUTADO });
                //            break;
                //        case 2://nombre
                //            ingresos = ingresos.OrderBy(w => new { w.IMPUTADO.NOMBRE, w.IMPUTADO.PATERNO, w.IMPUTADO.MATERNO });
                //            break;
                //        case 3://Fecha de ingreso
                //            ingresos = ingresos.OrderBy(w => w.FEC_INGRESO_CERESO);
                //            break;
                //        case 4://Ubicacion
                //            ingresos = ingresos.OrderBy(w => new { w.ID_UB_CENTRO, w.ID_UB_EDIFICIO, w.ID_UB_SECTOR, w.ID_UB_CELDA, w.ID_UB_CAMA });
                //            break;
                //        case 5://Autoridad que interna
                //            ingresos = ingresos.OrderBy(w => w.ID_AUTORIDAD_INTERNA);
                //            break;
                //        case 6://Clasificacion juridica
                //            ingresos = ingresos.OrderBy(w => w.ID_CLASIFICACION_JURIDICA);
                //            break;
                //    }

                //var lstInternos = ingresos.Select(w => new cReporteRelacionInternosDetalle()
                //{
                //    Hoy = hoy,
                //    Anio = w.ID_ANIO,
                //    Imputado = w.ID_IMPUTADO,
                //    Nombre = w.IMPUTADO.NOMBRE,
                //    Paterno = w.IMPUTADO.PATERNO,
                //    Materno = w.IMPUTADO.MATERNO,
                //    FecNacimiento = IncluirEdad ? w.IMPUTADO.NACIMIENTO_FECHA : null,
                //    CP = w.CAUSA_PENAL.FirstOrDefault(x => x.ID_ESTATUS_CP == 1),
                //    Clasificacion = w.ID_CLASIFICACION_JURIDICA,
                //    UEdificio = w.CAMA.CELDA.SECTOR.EDIFICIO.DESCR,
                //    //USector = w.CAMA.CELDA.SECTOR.DESCR,
                //    //UCelda = w.CAMA.CELDA.ID_CELDA,
                //    //UCama = w.CAMA.ID_CAMA,
                //    IB = IncluirFoto ? w.INGRESO_BIOMETRICO.FirstOrDefault(x => x.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && x.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG) : null,
                //}).ToList();



                //if (ingresos != null)
                //{
                ////byte[] foto;
                ////INGRESO_BIOMETRICO biometrico;
                //foreach (var w in ingresos)
                //{
                //    //if(IncluirFoto)
                //    //{
                //    //    if (w.INGRESO_BIOMETRICO != null)
                //    //    {
                //    //        biometrico = w.INGRESO_BIOMETRICO.FirstOrDefault(x => x.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && x.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG);
                //    //    }
                //    //    else
                //    //        biometrico = null;
                //    //}
                //    //else
                //    //{
                //    //    biometrico = null;
                //    //}
                //    lstInternos.Add(new cReporteRelacionInternosDetalle()
                //    {
                //        Hoy = hoy,
                //        Anio = w.ID_ANIO,
                //        Imputado = w.ID_IMPUTADO,
                //        Nombre = w.IMPUTADO.NOMBRE,
                //        Paterno = w.IMPUTADO.PATERNO,
                //        Materno = w.IMPUTADO.MATERNO,
                //        FecNacimiento = IncluirEdad ? w.IMPUTADO.NACIMIENTO_FECHA : null,
                //        CP = w.CAUSA_PENAL.FirstOrDefault(x => x.ID_ESTATUS_CP == 1),
                //        Clasificacion = w.ID_CLASIFICACION_JURIDICA,
                //        //UEdificio = w.CAMA.CELDA.SECTOR.EDIFICIO.DESCR,
                //        //USector = w.CAMA.CELDA.SECTOR.DESCR,
                //        //UCelda = w.CAMA.CELDA.ID_CELDA,
                //        //UCama = w.CAMA.ID_CAMA,
                //        Ubicacion = string.Format("{0}-{1}-{2}-{3}",
                //                     w.CAMA.CELDA.SECTOR.EDIFICIO.DESCR.Trim(),
                //                     w.CAMA.CELDA.SECTOR.DESCR.Trim(),
                //                     w.CAMA.CELDA.ID_CELDA.Trim(),
                //                     w.CAMA.ID_CAMA),
                //        IB = IncluirFoto ? w.INGRESO_BIOMETRICO != null ? w.INGRESO_BIOMETRICO.FirstOrDefault(x => x.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && x.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG) : null : null
                //    });
                //}
                //}
                #endregion

                #region Reporte
                Reporte.LocalReport.ReportPath = "Reportes/rRelacionInternosDetalle.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                Microsoft.Reporting.WinForms.ReportDataSource rds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds1);

                Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = lstInternos;
                Reporte.LocalReport.DataSources.Add(rds2);

                #region Parametros
                Reporte.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("MostrarEdad", IncluirEdad ? "N" : "S"));
                Reporte.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("MostrarFoto", IncluirFoto ? "N" : "S"));
                #endregion
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.RefreshReport();
                }));
                #endregion
                //}
            }
            catch (Exception ex)
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Repositorio.Visibility = Visibility.Collapsed;
                }));
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }

            Application.Current.Dispatcher.Invoke((Action)(delegate
            {
                Repositorio.Visibility = Visibility.Visible;
            }));
        }
Exemplo n.º 21
0
        private void GenerarReporteConQuery()
        {
            try
            {
                var centro       = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var grafica      = new List <cReporteIncidenteGrafica>();
                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1,
                    Encabezado2 = Parametro.ENCABEZADO2,
                    Encabezado3 = centro.DESCR.ToUpper().Trim(),
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Titulo      = "INCIDENCIAS",
                    Centro      = centro.DESCR.ToUpper().Trim()
                });

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Reset();
                }));
                var reporte = new cIncidente().ObtenerReporteIncidente(GlobalVar.gCentro).Select(w => new cReporteIncidentes()
                {
                    INCIDENTE           = w.INCIDENTE,
                    COMUN_PROCESADO     = w.PROCESADO_COMUN,
                    COMUN_SENTENCIADO   = w.SENTENCIADO_COMUN,
                    SIN_FUERO_IMPUTADO  = w.SIN_FUERO_IMPUTADO,
                    SIN_FUERO_PROCESADO = w.SIN_FUERO_PROCESADO,
                });

                if (reporte != null)
                {
                    //imputados sin fuero
                    grafica.Add(new cReporteIncidenteGrafica()
                    {
                        TIPO  = "IMPUTADO\nSIN FUERO",
                        VALOR = reporte.Sum(w => w.SIN_FUERO_IMPUTADO)
                    });
                    //procesado fuero comun
                    grafica.Add(new cReporteIncidenteGrafica()
                    {
                        TIPO  = "PROCESADO\nFUERO COMUN",
                        VALOR = reporte.Sum(w => w.COMUN_PROCESADO)
                    });
                    //procesado sin fuero
                    grafica.Add(new cReporteIncidenteGrafica()
                    {
                        TIPO  = "PROCESADO\nSIN FUERO",
                        VALOR = reporte.Sum(w => w.SIN_FUERO_PROCESADO)
                    });
                    //sentenciado fuero comun
                    grafica.Add(new cReporteIncidenteGrafica()
                    {
                        TIPO  = "SENTENCIADO\nFUERO COMUN",
                        VALOR = reporte.Sum(w => w.COMUN_SENTENCIADO)
                    });
                }
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Reset();
                }));
                Reporte.LocalReport.ReportPath = "../../Reportes/rIncidente.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds1);

                ReportDataSource rds2 = new ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = reporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                ReportDataSource rds3 = new ReportDataSource();
                rds3.Name  = "DataSet3";
                rds3.Value = grafica;
                Reporte.LocalReport.DataSources.Add(rds3);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte.", ex);
            }
        }
        public async void GenerarReporte()
        {
            var lCorrespondencia = new List <cBitacoraCorrepondenciaPoblacionPenitenciaria>();
            var datosReporte     = new List <cReporteDatos>();

            try
            {
                await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                {
                    Application.Current.Dispatcher.Invoke((Action)(delegate
                    {
                        ReportViewerVisible = Visibility.Collapsed;
                    }));
                    var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                    datosReporte.Add(new cReporteDatos()
                    {
                        Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                        Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                        Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                        Titulo      = "RELACIÓN DE INTERNOS",
                        Logo1       = Parametro.REPORTE_LOGO1,
                        Logo2       = Parametro.REPORTE_LOGO2,
                        Centro      = centro.DESCR.Trim().ToUpper(),
                    });

                    lCorrespondencia = new cCorrespondencia().
                                       ObtenerTodosRecibidos(SelectedFecha).
                                       AsEnumerable().
                                       Select(s =>
                                              new cBitacoraCorrepondenciaPoblacionPenitenciaria()
                    {
                        FechaDeposito = string.Format("{0}/{1}/{2}", s.RECEPCION_FEC.Value.Day, s.RECEPCION_FEC.Value.Month, s.RECEPCION_FEC.Value.Year),
                        FechaEntrega  = s.ENTREGA_FEC.HasValue ? string.Format("{0}/{1}/{2}", s.ENTREGA_FEC.Value.Day, s.ENTREGA_FEC.Value.Month, s.ENTREGA_FEC.Value.Year) : string.Empty,
                        LoginEntrega  = string.Empty,
                        Observaciones = !string.IsNullOrEmpty(s.OBSERV) ? s.OBSERV : string.Empty,

                        Id_Anio         = s.ID_ANIO,
                        Id_Imputado     = s.ID_IMPUTADO,
                        EdificioDescr   = s.INGRESO.CAMA.CELDA.SECTOR.EDIFICIO.DESCR.TrimEnd(),
                        SectorDescr     = s.INGRESO.CAMA.CELDA.SECTOR.DESCR.TrimEnd(),
                        Celda           = s.INGRESO.ID_UB_CELDA.TrimStart().TrimEnd(),
                        Paterno_Ingreso = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.PATERNO) ? s.INGRESO.IMPUTADO.PATERNO.TrimEnd() : string.Empty,
                        Materno_Ingreso = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.MATERNO) ? s.INGRESO.IMPUTADO.MATERNO.TrimEnd() : string.Empty,
                        Nombre_Ingreso  = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.NOMBRE) ? s.INGRESO.IMPUTADO.NOMBRE.TrimEnd() : string.Empty,

                        Materno_Depositante = s.PERSONA != null ? (!string.IsNullOrEmpty(s.PERSONA.MATERNO) ? s.PERSONA.MATERNO.TrimEnd() : string.Empty) : string.Empty,
                        Paterno_Depositante = s.PERSONA != null ? (!string.IsNullOrEmpty(s.PERSONA.PATERNO) ? s.PERSONA.PATERNO.TrimEnd() : string.Empty) : string.Empty,
                        Nombre_Depositante  = s.PERSONA != null ? (!string.IsNullOrEmpty(s.PERSONA.NOMBRE) ? s.PERSONA.NOMBRE.TrimEnd() : string.Empty) : string.Empty,

                        Paterno_Remitente = s.PERSONA1 != null ? (!string.IsNullOrEmpty(s.PERSONA1.PATERNO) ? s.PERSONA1.PATERNO.TrimEnd() : string.Empty) : string.Empty,
                        Materno_Remitente = s.PERSONA1 != null ? (!string.IsNullOrEmpty(s.PERSONA1.MATERNO) ? s.PERSONA1.MATERNO.TrimEnd() : string.Empty) : string.Empty,
                        Nombre_Remitente  = s.PERSONA1 != null ? (!string.IsNullOrEmpty(s.PERSONA1.NOMBRE) ? s.PERSONA1.NOMBRE.TrimEnd() : string.Empty) : string.Empty
                    }).ToList();
                    Application.Current.Dispatcher.Invoke((Action)(delegate
                    {
                        ReportViewerVisible = Visibility.Visible;
                    }));
                });
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }


            #region Reporte
            Reporte.LocalReport.ReportPath = "Reportes/rBitacoraCorrespondenciaPoblacionPenitenciaria.rdlc";
            Reporte.LocalReport.DataSources.Clear();

            ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();
            ReportDataSource_Encabezado.Name  = "DataSet1";
            ReportDataSource_Encabezado.Value = datosReporte;

            ReportDataSource ReportDataSource_Bitacora = new ReportDataSource();
            ReportDataSource_Bitacora.Name  = "DataSet2";
            ReportDataSource_Bitacora.Value = lCorrespondencia;

            Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
            Reporte.LocalReport.DataSources.Add(ReportDataSource_Bitacora);
            #endregion

            #region Parametros
            Reporte.LocalReport.SetParameters(new ReportParameter("Fecha", string.Format("{0}/{1}/{2}", SelectedFecha.Month, SelectedFecha.Day, SelectedFecha.Year)));
            #endregion

            Reporte.Refresh();
            Reporte.RefreshReport();
        }
        private void GenerarReporte()
        {
            try
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Repositorio.Visibility = Visibility.Collapsed;
                }));
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                    Titulo      = "TIEMPO POR COMPURGAR",
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Centro      = centro.DESCR.Trim().ToUpper(),
                });
                DateTime fecha = Fec.HasValue ? Fec.Value.Date : Fechas.GetFechaDateServer;
                int      da = 0, dm = 0, dd = 0, ha = 0, hm = 0, hd = 0, tipo = 1;
                //desde
                da = DAnios.HasValue ? DAnios.Value : 0;
                dm = DMeses.HasValue ? DMeses.Value : 0;
                dd = DDias.HasValue ? DDias.Value : 0;
                //hasta
                ha   = HAnios.HasValue ? HAnios.Value : 0;
                hm   = HMeses.HasValue ? HMeses.Value : 0;
                hd   = HDias.HasValue ? HDias.Value : 0;
                tipo = Compurgado ? 1 : 0;

                LstInternos = new cCausaPenal().ObtenerReporte(((da * 365) + (dm * 30) + dd), ((ha * 365) + (hm * 30) + hd), tipo, fecha).Select(w => new cReporteCausaPenal()
                {
                    ID_ANIO        = w.ID_ANIO,
                    ID_IMPUTADO    = w.ID_IMPUTADO,
                    NOMBRE         = w.NOMBRE,
                    PATERNO        = w.PATERNO,
                    MATERNO        = w.MATERNO,
                    ANIO_GOBIERNO  = w.ANIO_GOBIERNO,
                    FOLIO_GOBIERNO = w.FOLIO_GOBIERNO,
                    FECHA_INICIO   = w.FECHA_INICIO,
                    S_ANIO         = w.S_ANIO,
                    S_MES          = w.S_MES,
                    S_DIA          = w.S_DIA,
                    C_ANIO         = w.C_ANIO,
                    C_MES          = w.C_MES,
                    C_DIA          = w.C_DIA,
                    A_ANIO         = w.A_ANIO,
                    A_MES          = w.A_MES,
                    A_DIA          = w.A_DIA,
                    PC_ANIO        = w.PC_ANIO,
                    PC_MES         = w.PC_MES,
                    PC_DIA         = w.PC_DIA,
                    ID_UB_CENTRO   = w.ID_UB_CENTRO
                });

                #region Reporte
                Reporte.LocalReport.ReportPath = "Reportes/rCausasPenales.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                Microsoft.Reporting.WinForms.ReportDataSource rds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds1.Name  = "DataSet3";
                rds1.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds1);

                Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds2.Name  = "DataSet1";
                rds2.Value = LstInternos;
                Reporte.LocalReport.DataSources.Add(rds2);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Repositorio.Visibility = Visibility.Visible;
                    Reporte.RefreshReport();
                }));
                #endregion
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte.", ex);
            }
        }
        private void GenerarReporte()
        {
            try
            {
                var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                    Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                    Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                    Titulo      = "LISTA GRUPO " + LstActividad.Where(w => w.ID_ACTIVIDAD == SelectedActividad).FirstOrDefault().DESCR,
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Centro      = centro.DESCR.Trim().ToUpper(),
                });

                #region Reporte
                Reporte.LocalReport.ReportPath = "Reportes/rGrupoActivos.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                var rds2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds2);

                var rds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = new List <ReporteListaGruposActivos>()
                {
                    new ReporteListaGruposActivos()
                    {
                        Actividad = LstActividad.Where(w => w.ID_ACTIVIDAD == SelectedActividad).FirstOrDefault().DESCR,
                        Eje       = LstEje.Where(w => w.ID_EJE == SelectedEje).FirstOrDefault().DESCR,
                        Programa  = LstPrograma.Where(w => w.ID_TIPO_PROGRAMA == SelectedPrograma).FirstOrDefault().NOMBRE
                    }
                };
                Reporte.LocalReport.DataSources.Add(rds1);

                var rds3 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds3.Name  = "DataSet3";
                rds3.Value = new cGrupo().GetData().Where(w => w.ID_EJE == SelectedEje && w.ID_TIPO_PROGRAMA == SelectedPrograma && w.ID_ACTIVIDAD == SelectedActividad && w.ID_ESTATUS_GRUPO == 1).AsEnumerable().Select(s => new ReporteDetalleGruposActivos
                {
                    Grupo        = s.DESCR,
                    Responsable  = (s.PERSONA.PATERNO != null ? s.PERSONA.PATERNO.Trim() : string.Empty) + " " + (s.PERSONA.MATERNO != null ? s.PERSONA.MATERNO.Trim() : string.Empty) + " " + (s.PERSONA.NOMBRE != null ? s.PERSONA.NOMBRE.Trim() : string.Empty),
                    Fecha_Inicio = s.GRUPO_HORARIO.OrderBy(o => o.HORA_INICIO).FirstOrDefault().HORA_INICIO.Value.ToShortDateString(),
                    Fecha_Fin    = s.GRUPO_HORARIO.OrderByDescending(o => o.HORA_TERMINO).FirstOrDefault().HORA_TERMINO.Value.ToShortDateString(),
                    Departamento = s.CENTRO_DEPARTAMENTO.DEPARTAMENTO.DESCR,
                    Recurrencia  = s.RECURRENCIA
                });
                Reporte.LocalReport.DataSources.Add(rds3);



                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.RefreshReport();
                }));
                #endregion
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
        public void GenerarReporte()
        {
            var Centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

            try
            {
                List <cReporteEdificio>        lEdificio = new List <cReporteEdificio>();
                List <cReporteSector>          lSector   = new List <cReporteSector>();
                List <cBrazaleteGafeteInterno> internos  = new List <cBrazaleteGafeteInterno>();

                if (SelectedEdificio.ID_EDIFICIO == TODOS_LOS_EDIFICIOS)
                {
                    lEdificio.Add(new cReporteEdificio {
                        Descr = "TODOS LOS EDIFICIOS", IdCentro = GlobalVar.gCentro, IdEdificio = TODOS_LOS_EDIFICIOS
                    });
                }
                else
                {
                    lEdificio.Add(new cReporteEdificio {
                        Descr = SelectedEdificio.DESCR, IdCentro = SelectedEdificio.ID_CENTRO, IdEdificio = SelectedEdificio.ID_EDIFICIO
                    });
                }

                if (SelectedEdificio.ID_EDIFICIO == TODOS_LOS_EDIFICIOS)
                {
                    lSector.Add(new cReporteSector {
                        Descr = "TODOS LOS SECTORES", IdCentro = GlobalVar.gCentro
                    });
                }
                else
                {
                    if (SelectedSector.ID_SECTOR == TODOS_LOS_SECTORES)
                    {
                        lSector.Add(new cReporteSector {
                            Descr = "TODOS LOS SECTORES", IdCentro = GlobalVar.gCentro
                        });
                    }
                    else
                    {
                        lSector.Add(new cReporteSector {
                            Descr = SelectedSector.DESCR, IdCentro = GlobalVar.gCentro, IdEdificio = SelectedEdificio.ID_EDIFICIO, IdSector = SelectedSector.ID_SECTOR
                        });
                    }
                }
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte = Ventana.ReportCredencialBiblioteca;
                    Reporte.LocalReport.ReportPath = "Reportes/rCredencialBiblioteca.rdlc";
                    Reporte.LocalReport.DataSources.Clear();
                    Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_CredencialBiblioteca = new Microsoft.Reporting.WinForms.ReportDataSource();
                    ReportDataSource_CredencialBiblioteca.Name = "DataSet1";
                    ReportDataSource_CredencialBiblioteca.Value = ListaIngresosSeleccionados;
                    Reporte.LocalReport.DataSources.Add(ReportDataSource_CredencialBiblioteca);

                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public async void GenerarReporte()
        {
            var datosReporte = new List <cReporteDatos>();
            var lIngreso     = new List <cTotalIngreso>();
            await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Collapsed;
                }));
                try
                {
                    var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                    datosReporte.Add(new cReporteDatos()
                    {
                        Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                        Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                        Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                        Titulo      = "RELACIÓN DE INGRESOS",
                        Logo1       = Parametro.REPORTE_LOGO1,
                        Logo2       = Parametro.REPORTE_LOGO2,
                        Centro      = centro.DESCR.Trim().ToUpper(),
                    });

                    lIngreso = new cIngreso().ObtenerIngresosActivosPorFecha(GlobalVar.gCentro, SelectedFechaInicial, SelectedFechaFinal).
                               AsEnumerable().
                               Select(s => new cTotalIngreso()
                    {
                        Nacionalidad = s.PAIS_NACIONALIDAD != null ?
                                       (!string.IsNullOrEmpty(s.PAIS_NACIONALIDAD.NACIONALIDAD) ? (s.PAIS_NACIONALIDAD.NACIONALIDAD.TrimEnd() != "MEXICANA" ? "EXTRANJEROS" : "MEXICANOS") : "INDEFINIDO") : "INDEFINIDO",
                        Sexo = !string.IsNullOrEmpty(s.IMPUTADO.SEXO) ? (s.IMPUTADO.SEXO == FEMENINO ? "FEMENINO" : "MASCULINO") : "INDEFINIDO"
                    }).ToList();
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(ex.Message);
                }

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Visible;
                }));
            });

            Reporte.LocalReport.ReportPath = "Reportes/rTotalIngresos.rdlc";
            Reporte.LocalReport.DataSources.Clear();

            ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();

            ReportDataSource_Encabezado.Name  = "DataSet1";
            ReportDataSource_Encabezado.Value = datosReporte;

            ReportDataSource ReportDataSource_TotalIngresos = new ReportDataSource();

            ReportDataSource_TotalIngresos.Name  = "DataSet2";
            ReportDataSource_TotalIngresos.Value = lIngreso;

            Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
            Reporte.LocalReport.DataSources.Add(ReportDataSource_TotalIngresos);

            Reporte.LocalReport.SetParameters(new ReportParameter("FechaInicial", string.Format("{0}/{1}/{2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
            Reporte.LocalReport.SetParameters(new ReportParameter("FechaFinal", string.Format("{0}/{1}/{2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));

            Reporte.Refresh();
            Reporte.RefreshReport();
        }
Exemplo n.º 27
0
        public async void GenerarReporte()
        {
            var datosReporte = new List <cReporteDatos>();
            var centro       = new CENTRO();
            var lVisitantes  = new List <cControlVisitante>();
            var usuario      = new USUARIO();
            await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Collapsed;
                }));
                try
                {
                    usuario = new cUsuario().ObtenerUsuario(GlobalVar.gUsr);
                    centro  = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                    datosReporte.Add(new cReporteDatos()
                    {
                        Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                        Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                        Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                        Titulo      = "CONTROL VISITANTES POR DÍA",
                        Logo1       = Parametro.REPORTE_LOGO1,
                        Logo2       = Parametro.REPORTE_LOGO2,
                        Centro      = centro.DESCR.Trim().ToUpper(),
                    });

                    lVisitantes = new cAduana().
                                  ObtenerVisitasIntimasXDiaPorFecha(SelectedFechaInicial, SelectedFechaFinal).
                                  AsEnumerable().
                                  Select(s => new cControlVisitante()
                    {
                        Categoria    = (s.PERSONA.SEXO == FEMENINO ? MUJERES : HOMBRES),
                        FechaEntrada = s.ENTRADA_FEC.Value.Date
                    }).
                                  ToList();
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(ex.Message);
                }
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Visible;
                }));
            });

            Reporte.LocalReport.ReportPath = "Reportes/rControlVisitantesXDiaIntima.rdlc";
            Reporte.LocalReport.DataSources.Clear();

            ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();

            ReportDataSource_Encabezado.Name  = "DataSet1";
            ReportDataSource_Encabezado.Value = datosReporte;

            ReportDataSource ReportDataSource = new ReportDataSource();

            ReportDataSource.Name  = "DataSet2";
            ReportDataSource.Value = lVisitantes;

            Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
            Reporte.LocalReport.DataSources.Add(ReportDataSource);

            Reporte.LocalReport.SetParameters(new ReportParameter(("Usuario"), ObtenerNombreUsuario(usuario)));
            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaActual"), string.Format("{0} DE {1} DE {2}", Fechas.GetFechaDateServer.Day, ((eMesesAnio)Fechas.GetFechaDateServer.Month).ToString(), Fechas.GetFechaDateServer.Year)));
            Reporte.LocalReport.SetParameters(new ReportParameter(("Centro"), centro.DESCR.Trim().ToUpper()));
            Reporte.LocalReport.SetParameters(new ReportParameter(("ComandanteEstatal"), Parametro.COMANDANTE_ESTATAL_CENTROS));
            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaInicial"), string.Format("{0}/{1}/{2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaFinal"), string.Format("{0}/{1}/{2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));

            Reporte.Refresh();
            Reporte.RefreshReport();
        }
Exemplo n.º 28
0
        public async void GenerarReporte()
        {
            var lAduana      = new List <cBitacoraAccesoAduana>();
            var datosReporte = new List <cReporteDatos>();

            Ventana.WFH.Visibility = Visibility.Collapsed;
            try
            {
                await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                {
                    var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                    datosReporte.Add(new cReporteDatos()
                    {
                        Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                        Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                        Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                        Titulo      = "RELACIÓN DE INTERNOS",
                        Logo1       = Parametro.REPORTE_LOGO1,
                        Logo2       = Parametro.REPORTE_LOGO2,
                        Centro      = centro.DESCR.Trim().ToUpper(),
                    });

                    lAduana = new cAduana().
                              ObtenerReporteBitacora(GlobalVar.gCentro, SelectedFecha).
                              AsEnumerable().
                              Select(s =>
                                     new cBitacoraAccesoAduana()
                    {
                        Asunto        = !string.IsNullOrEmpty(s.ASUNTO) ? s.ASUNTO.TrimEnd() : string.Empty,
                        HoraEntrada   = string.Format("{0}:{1}", s.ENTRADA_FEC.Value.Hour < 10 ? string.Format("0{0}", s.ENTRADA_FEC.Value.Hour) : s.ENTRADA_FEC.Value.Hour.ToString(), s.ENTRADA_FEC.Value.Minute < 10 ? string.Format("0{0}", s.ENTRADA_FEC.Value.Minute) : s.ENTRADA_FEC.Value.Minute.ToString()),
                        HoraSalida    = s.SALIDA_FEC.HasValue ? string.Format("{0}:{1}", s.SALIDA_FEC.Value.Hour < 10 ? string.Format("0{0}", s.SALIDA_FEC.Value.Hour) : s.SALIDA_FEC.Value.Hour.ToString(), s.SALIDA_FEC.Value.Minute < 10 ? string.Format("0{0}", s.SALIDA_FEC.Value.Minute) : s.SALIDA_FEC.Value.Minute.ToString()) : string.Empty,
                        Institucion   = !string.IsNullOrEmpty(s.INSTITUCION) ? s.INSTITUCION : string.Empty,
                        LugarDestino  = s.AREA != null ? (!string.IsNullOrEmpty(s.AREA.DESCR) ? s.AREA.DESCR.TrimEnd() : string.Empty) : string.Empty,
                        Paterno       = !string.IsNullOrEmpty(s.PERSONA.PATERNO) ? s.PERSONA.PATERNO.TrimEnd() : string.Empty,
                        Materno       = !string.IsNullOrEmpty(s.PERSONA.MATERNO) ? s.PERSONA.MATERNO.TrimEnd() : string.Empty,
                        Nombre        = !string.IsNullOrEmpty(s.PERSONA.NOMBRE) ? s.PERSONA.NOMBRE.TrimEnd() : string.Empty,
                        Observaciones = !string.IsNullOrEmpty(s.OBSERV) ? s.OBSERV.TrimEnd() : string.Empty,
                        TipoVisitante = s.ID_TIPO_PERSONA != null ? ObtenerTipoVisitante(s) : string.Empty
                    }).
                              ToList();
                });

                Ventana.WFH.Visibility = Visibility.Visible;

                #region Reporte
                Reporte.LocalReport.ReportPath = "Reportes/rBitacoraAccesoAduana.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();
                ReportDataSource_Encabezado.Name  = "DataSet1";
                ReportDataSource_Encabezado.Value = datosReporte;

                ReportDataSource ReportDataSource_Bitacora = new ReportDataSource();
                ReportDataSource_Bitacora.Name  = "DataSet2";
                ReportDataSource_Bitacora.Value = lAduana;

                Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
                Reporte.LocalReport.DataSources.Add(ReportDataSource_Bitacora);
                #endregion

                #region Parametros
                Reporte.LocalReport.SetParameters(new ReportParameter("Fecha", string.Format("{0}/{1}/{2}", SelectedFecha.Month, SelectedFecha.Day, SelectedFecha.Year)));
                #endregion

                Reporte.Refresh();
                Reporte.RefreshReport();
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public async void GenerarReporte()
        {
            var lInternos    = new List <cInternoVisitantes>();
            var datosReporte = new List <cReporteDatos>();
            var centro       = new CENTRO();



            await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
            {
                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Collapsed;
                }));
                try
                {
                    centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                    datosReporte.Add(new cReporteDatos()
                    {
                        Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                        Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                        Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                        Titulo      = "VISITA FAMILIAR",
                        Logo1       = Parametro.REPORTE_LOGO1,
                        Logo2       = Parametro.REPORTE_LOGO2,
                        Centro      = centro.DESCR.Trim().ToUpper(),
                    });



                    var ingresos = new cVisitanteIngreso().
                                   ObtenerTodosIngresos().
                                   Select(s => new { s.ID_CENTRO, s.ID_ANIO, s.ID_IMPUTADO, s.ID_INGRESO }).
                                   Distinct().OrderBy(o => o.ID_CENTRO).ThenBy(t => t.ID_ANIO).ThenBy(t => t.ID_IMPUTADO).ThenBy(t => t.ID_INGRESO).ToList();

                    var consulta_ingreso = new cIngreso();
                    foreach (var ingreso in ingresos)
                    {
                        var visitantes_registrados = new cVisitanteIngreso().
                                                     ObtenerVisitantesIngreso(ingreso.ID_CENTRO, ingreso.ID_ANIO, ingreso.ID_IMPUTADO, ingreso.ID_INGRESO).
                                                     Select(s => new { s.ID_PERSONA }).
                                                     Distinct().OrderBy(o => o.ID_PERSONA).ToList();
                        if (visitantes_registrados.Count() != 0)
                        {
                            var visitantes_aduana = new cAduana().
                                                    ObtenerTodosVisitantesIngreso(ingreso.ID_CENTRO, ingreso.ID_ANIO, ingreso.ID_IMPUTADO, ingreso.ID_INGRESO, SelectedFechaInicial, SelectedFechaFinal).
                                                    Select(s => new { s.ID_PERSONA }).
                                                    Distinct().OrderBy(o => o.ID_PERSONA).ToList();

                            foreach (var visitante in visitantes_aduana)
                            {
                                visitantes_registrados.Remove(visitante);
                            }

                            var ultimo_ingreso = consulta_ingreso.ObtenerUltimoIngreso(GlobalVar.gCentro, ingreso.ID_ANIO, ingreso.ID_IMPUTADO);
                            if (visitantes_registrados.Count() != 0)
                            {
                                lInternos.Add(
                                    new cInternoVisitantes()
                                {
                                    Anio                  = ingreso != null ? ingreso.ID_ANIO : new int(),
                                    Celda                 = ultimo_ingreso != null ? ultimo_ingreso.CAMA != null ? ultimo_ingreso.CAMA.ID_CELDA : string.Empty : string.Empty,
                                    Edificio              = ultimo_ingreso != null ? ultimo_ingreso.CAMA != null ? ultimo_ingreso.CAMA.CELDA != null ? ultimo_ingreso.CAMA.CELDA.SECTOR != null ? ultimo_ingreso.CAMA.CELDA.SECTOR.EDIFICIO != null ? !string.IsNullOrEmpty(ultimo_ingreso.CAMA.CELDA.SECTOR.EDIFICIO.DESCR) ? ultimo_ingreso.CAMA.CELDA.SECTOR.EDIFICIO.DESCR.Trim() : string.Empty : string.Empty : string.Empty : string.Empty : string.Empty : string.Empty,
                                    Id_Imputado           = ingreso != null ? ingreso.ID_IMPUTADO : new int(),
                                    Materno               = ultimo_ingreso != null ? ultimo_ingreso.IMPUTADO != null ? !string.IsNullOrEmpty(ultimo_ingreso.IMPUTADO.MATERNO) ? ultimo_ingreso.IMPUTADO.MATERNO.Trim() : string.Empty : string.Empty : string.Empty,
                                    Nombre                = ultimo_ingreso != null ? ultimo_ingreso.IMPUTADO != null ? !string.IsNullOrEmpty(ultimo_ingreso.IMPUTADO.NOMBRE) ? ultimo_ingreso.IMPUTADO.NOMBRE.Trim() : string.Empty : string.Empty : string.Empty,
                                    Paterno               = ultimo_ingreso != null ? ultimo_ingreso.IMPUTADO != null ? !string.IsNullOrEmpty(ultimo_ingreso.IMPUTADO.PATERNO) ? ultimo_ingreso.IMPUTADO.PATERNO.Trim() : string.Empty : string.Empty : string.Empty,
                                    Sector                = ultimo_ingreso != null ? ultimo_ingreso.CAMA != null ? ultimo_ingreso.CAMA.CELDA != null ? ultimo_ingreso.CAMA.CELDA.SECTOR != null ? !string.IsNullOrEmpty(ultimo_ingreso.CAMA.CELDA.SECTOR.DESCR) ? ultimo_ingreso.CAMA.CELDA.SECTOR.DESCR.Trim() : string.Empty : string.Empty : string.Empty : string.Empty : string.Empty,
                                    VisitantesRegistrados = visitantes_registrados != null ? visitantes_registrados.Any() ? visitantes_registrados.Count : new int() : new int(),
                                });
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(ex.Message);
                }

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    ReportViewerVisible = Visibility.Visible;
                }));
            });


            Reporte.LocalReport.ReportPath = "Reportes/rVisitantesRegistradosXInterno.rdlc";
            Reporte.LocalReport.DataSources.Clear();

            ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();

            ReportDataSource_Encabezado.Name  = "DataSet1";
            ReportDataSource_Encabezado.Value = datosReporte;

            ReportDataSource ReportDataSource = new ReportDataSource();

            ReportDataSource.Name  = "DataSet2";
            ReportDataSource.Value = lInternos;

            Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
            Reporte.LocalReport.DataSources.Add(ReportDataSource);


            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaInicial"), string.Format("{0}/{1}/{2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
            Reporte.LocalReport.SetParameters(new ReportParameter(("FechaFinal"), string.Format("{0}/{1}/{2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));

            Reporte.Refresh();
            Reporte.RefreshReport();
        }
        public async void GenerarReporte()
        {
            var datosReporte       = new List <cReporteDatos>();
            var ingresosDecomiso   = new List <cDecomisoCustodioIngreso>();
            var objetosDecomiso    = new List <cDecomisoCustodioObjeto>();
            var visitantesDecomiso = new List <cDecomisoCustodioVisitante>();
            var decomisos          = new List <cDecomisoFecha>();

            try
            {
                await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                {
                    Application.Current.Dispatcher.Invoke((Action)(delegate
                    {
                        ReportViewerVisible = Visibility.Collapsed;
                    }));

                    var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();

                    datosReporte.Add(new cReporteDatos()
                    {
                        Encabezado1 = Parametro.ENCABEZADO1.Trim(),
                        Encabezado2 = Parametro.ENCABEZADO2.Trim(),
                        Encabezado3 = Parametro.ENCABEZADO3.Trim(),
                        Titulo      = "RELACIÓN DE INTERNOS",
                        Logo1       = Parametro.REPORTE_LOGO1,
                        Logo2       = Parametro.REPORTE_LOGO2,
                        Centro      = centro.DESCR.Trim().ToUpper(),
                    });


                    //var objetos_decomiso = new cDecomisoObjeto().ObtenerObjetos(null).ToList();
                    objetosDecomiso.AddRange(new cDecomisoObjeto().ObtenerObjetos(null).AsEnumerable().Select(s => new cDecomisoCustodioObjeto()
                    {
                        Cantidad       = s.CANTIDAD.HasValue ? s.CANTIDAD.Value : 0,
                        Capacidad      = !string.IsNullOrEmpty(s.CAPACIDAD) ? s.CAPACIDAD.TrimEnd() : string.Empty,
                        Comentarios    = !string.IsNullOrEmpty(s.COMENTARIO) ? s.COMENTARIO.TrimEnd() : "SIN COMENTARIOS",
                        Compañia       = s.ID_COMPANIA != null && s.ID_COMPANIA.HasValue ? (!string.IsNullOrEmpty(s.COMPANIA.DESCR) ? s.COMPANIA.DESCR.TrimEnd() : string.Empty) : string.Empty,
                        Descripcion    = !string.IsNullOrEmpty(s.DESCR) ? s.DESCR.TrimEnd() : "SIN DESCRIPCIÓN",
                        Dosis          = s.DOSIS != null && s.DOSIS.HasValue ? s.DOSIS.Value.ToString() : string.Empty,
                        Envoltorios    = s.ENVOLTORIOS != null && s.ENVOLTORIOS.HasValue ? s.ENVOLTORIOS.ToString() : "0",
                        Fabricante     = s.ID_COMPANIA != null && s.ID_FABRICANTE != null && s.ID_FABRICANTE.HasValue && s.ID_COMPANIA.HasValue ? (!string.IsNullOrEmpty(s.COMPANIA.DESCR) ? s.COMPANIA.DESCR.TrimEnd() : string.Empty) : "NO APLICA",
                        Id_Decomiso    = s.ID_DECOMISO,
                        IMEI           = !string.IsNullOrEmpty(s.IMEI) ? s.IMEI.TrimEnd() : string.Empty,
                        Modelo         = s.DECOMISO_MODELO != null && s.ID_MODELO.HasValue ? (!string.IsNullOrEmpty(s.DECOMISO_MODELO.DESCR) ? s.DECOMISO_MODELO.DESCR.TrimEnd() : string.Empty) : string.Empty,
                        NumeroTelefono = !string.IsNullOrEmpty(s.TELEFONO) ? s.TELEFONO.TrimEnd() : string.Empty,
                        SerieNumero    = !string.IsNullOrEmpty(s.SERIE) ? s.SERIE.TrimEnd() : string.Empty,
                        SimSerie       = !string.IsNullOrEmpty(s.SIM_SERIE) ? s.SIM_SERIE.TrimEnd() : string.Empty,
                        TipoObjeto     = !string.IsNullOrEmpty(s.OBJETO_TIPO.DESCR) ? s.OBJETO_TIPO.DESCR.TrimEnd() : string.Empty,
                        Unidad         = s.ID_UNIDAD_MEDIDA != null && s.ID_UNIDAD_MEDIDA.HasValue && s.DROGA_UNIDAD_MEDIDA != null ? (!string.IsNullOrEmpty(s.DROGA_UNIDAD_MEDIDA.DESCR) ? s.DROGA_UNIDAD_MEDIDA.DESCR.TrimEnd() : "NO APLICA") : "NO APLICA"
                    }));
                    var consulta_decomiso = new cDecomiso();
                    foreach (var objeto in objetosDecomiso)
                    {
                        var decomiso = consulta_decomiso.Obtener(objeto.Id_Decomiso).FirstOrDefault();
                        if (!ingresosDecomiso.Any(a => a.Id_Decomiso == objeto.Id_Decomiso))
                        {
                            ingresosDecomiso.AddRange(decomiso.
                                                      DECOMISO_INGRESO.
                                                      Select(s => new cDecomisoCustodioIngreso()
                            {
                                Celda       = !string.IsNullOrEmpty(s.INGRESO.ID_UB_CELDA) ? s.INGRESO.ID_UB_CELDA.TrimEnd() : string.Empty,
                                Edificio    = s.INGRESO.ID_UB_EDIFICIO.HasValue ? s.INGRESO.ID_UB_EDIFICIO.Value.ToString() : string.Empty,
                                Id_Anio     = s.ID_ANIO,
                                Id_Decomiso = s.ID_DECOMISO,
                                Id_Imputado = s.ID_IMPUTADO,
                                Materno     = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.MATERNO) ? s.INGRESO.IMPUTADO.MATERNO.TrimEnd() : string.Empty,
                                Nombre      = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.NOMBRE) ? s.INGRESO.IMPUTADO.NOMBRE.TrimEnd() : string.Empty,
                                Paterno     = !string.IsNullOrEmpty(s.INGRESO.IMPUTADO.PATERNO) ? s.INGRESO.IMPUTADO.PATERNO.TrimEnd() : string.Empty,
                                Sector      = s.INGRESO.ID_UB_SECTOR.HasValue ? s.INGRESO.ID_UB_SECTOR.Value.ToString() : string.Empty
                            }));
                        }

                        if (!visitantesDecomiso.Any(a => a.Id_Decomiso == objeto.Id_Decomiso))
                        {
                            visitantesDecomiso.AddRange(decomiso.
                                                        DECOMISO_PERSONA.Where(w => w.ID_TIPO_PERSONA == VISITA).
                                                        Select(s => new cDecomisoCustodioVisitante()
                            {
                                Discapacitado = s.PERSONA.ID_TIPO_DISCAPACIDAD.HasValue ? "SI" : "NO",    //(!string.IsNullOrEmpty(s.PERSONA.TIPO_DISCAPACIDAD.DESCR) ? s.PERSONA.TIPO_DISCAPACIDAD.DESCR.TrimEnd() : string.Empty) : string.Empty,
                                Estatus       = s.PERSONA.VISITANTE.ID_ESTATUS_VISITA.HasValue ? (!string.IsNullOrEmpty(s.PERSONA.VISITANTE.ESTATUS_VISITA.DESCR) ? s.PERSONA.VISITANTE.ESTATUS_VISITA.DESCR.TrimEnd() : "SIN DEFINIR") : "SIN DEFINIR",
                                FechaRegistro = s.PERSONA.VISITANTE.FEC_ALTA.HasValue ? (string.Format("{0}/{1}/{2}", s.PERSONA.VISITANTE.FEC_ALTA.Value.Day, s.PERSONA.VISITANTE.FEC_ALTA.Value.Month, s.PERSONA.VISITANTE.FEC_ALTA.Value.Year)) : string.Empty,
                                Id_Decomiso   = s.ID_DECOMISO,
                                Materno       = !string.IsNullOrEmpty(s.PERSONA.MATERNO) ? s.PERSONA.MATERNO.TrimEnd() : string.Empty,
                                Paterno       = !string.IsNullOrEmpty(s.PERSONA.PATERNO) ? s.PERSONA.PATERNO.TrimEnd() : string.Empty,
                                Nombre        = !string.IsNullOrEmpty(s.PERSONA.NOMBRE) ? s.PERSONA.NOMBRE.TrimEnd() : string.Empty,
                                Sexo          = !string.IsNullOrEmpty(s.PERSONA.SEXO) ? (s.PERSONA.SEXO.TrimEnd() == "F" ? "FEMENINO" : "MASCULINO") : string.Empty,
                                TipoVisitante = "FAMILIAR"     //TODO: Pendiente?
                            }));
                        }
                    }


                    Application.Current.Dispatcher.Invoke((Action)(delegate
                    {
                        Reporte.LocalReport.ReportPath = "Reportes/rDecomisoObjetos.rdlc";
                        ReportDataSource ReportDataSource_Encabezado = new ReportDataSource();
                        ReportDataSource_Encabezado.Name = "DataSet1";
                        ReportDataSource_Encabezado.Value = datosReporte;

                        ReportDataSource ReportDataSource = new ReportDataSource();
                        ReportDataSource.Name = "DataSet2";
                        ReportDataSource.Value = objetosDecomiso;

                        Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado);
                        Reporte.LocalReport.DataSources.Add(ReportDataSource);


                        Reporte.LocalReport.SubreportProcessing += (s, e) =>
                        {
                            if (e.ReportPath.Equals("srDecomisoIngreso", StringComparison.InvariantCultureIgnoreCase))
                            {
                                ReportDataSource rds2 = new ReportDataSource("DataSet1", ingresosDecomiso);
                                e.DataSources.Add(rds2);
                            }

                            if (e.ReportPath.Equals("srDecomisoVisitante", StringComparison.InvariantCultureIgnoreCase))
                            {
                                ReportDataSource rds4 = new ReportDataSource("DataSet1", visitantesDecomiso);
                                e.DataSources.Add(rds4);
                            }
                        };

                        //Reporte.LocalReport.SetParameters(new ReportParameter("FechaInicial", string.Format("{0}/{1}/{2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
                        //Reporte.LocalReport.SetParameters(new ReportParameter("FechaFinal", string.Format("{0}/{1}/{2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));


                        Reporte.Refresh();
                        Reporte.RefreshReport();
                        ReportViewerVisible = Visibility.Visible;
                    }));
                });
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }