Beispiel #1
0
        public void GenerarReporte()
        {
            try
            {
                var encabezado                = new System.Collections.Generic.List <cEncabezado>();
                var listaIngresosActivos      = new System.Collections.Generic.List <cReporteReingresos>();
                var ListaDelitosPreliminar    = new System.Collections.Generic.List <cReporteReincidentes>();
                var listaIngresosDefinitivos  = new System.Collections.Generic.List <cReporteReincidentes>(); //COMUNES
                var listaIngresosDefinitivos2 = new System.Collections.Generic.List <cReporteReincidentes>(); //FEDERALES
                var listaIngresosDefinitivos3 = new System.Collections.Generic.List <cReporteReincidentes>(); //OTROS
                var centro = new SSP.Controlador.Catalogo.Justicia.cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                encabezado.Add(new cEncabezado()
                {
                    ImagenIzquierda = Parametro.REPORTE_LOGO1,
                    ImagenDerecha   = Parametro.REPORTE_LOGO2,
                    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 _IngresosActivos = new SSP.Controlador.Catalogo.Justicia.cIngreso().ObtenerIngresosActivosPorFecha(GlobalVar.gCentro, SelectedFechaInicial, SelectedFechaFinal);
                if (_IngresosActivos != null && _IngresosActivos.Any())
                {
                    foreach (var item in _IngresosActivos)
                    {
                        if (item.CAUSA_PENAL != null && item.CAUSA_PENAL.Any())
                        {
                            var _detallesCausaPenal = item.CAUSA_PENAL.FirstOrDefault(x => x.ID_ESTATUS_CP == (short)eEstatusCausaPenal.ACTIVO);
                            if (_detallesCausaPenal != null)
                            {
                                if (_detallesCausaPenal.SENTENCIA != null)
                                {
                                    if (_detallesCausaPenal.SENTENCIA.Any(x => x.FEC_EJECUTORIA.HasValue))//SI CAUSO EJECUTORIA
                                    {
                                        var _fuero = _detallesCausaPenal.CP_FUERO;
                                        if (!string.IsNullOrEmpty(_fuero))
                                        {
                                            var _Delitos = _detallesCausaPenal.CAUSA_PENAL_DELITO;
                                            if (_Delitos != null && _Delitos.Any())
                                            {
                                                if (_fuero == "C")
                                                {
                                                    foreach (var item2 in _Delitos)
                                                    {
                                                        ListaDelitosPreliminar.Add(new cReporteReincidentes
                                                        {
                                                            Delito    = item2.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(item2.MODALIDAD_DELITO.DESCR) ? item2.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty,
                                                            Femenino  = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "F" ? +1 : +0 : +0,
                                                            Masculino = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "M" ? +1 : +0 : +0,
                                                            Fuero     = _fuero,
                                                            Total     = +1
                                                        });
                                                    }
                                                }
                                                ;

                                                if (_fuero == "F")
                                                {
                                                    foreach (var item2 in _Delitos)
                                                    {
                                                        ListaDelitosPreliminar.Add(new cReporteReincidentes
                                                        {
                                                            Delito    = item2.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(item2.MODALIDAD_DELITO.DESCR) ? item2.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty,
                                                            Femenino  = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "F" ? +1 : +0 : +0,
                                                            Masculino = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "M" ? +1 : +0 : +0,
                                                            Fuero     = _fuero,
                                                            Total     = +1
                                                        });
                                                    }
                                                }
                                                ;
                                            }
                                            ;
                                        }
                                        else
                                        {
                                            var _Delitos = _detallesCausaPenal.CAUSA_PENAL_DELITO;//ESTOS DELITOS NO TIENEN FUERO PERO SI CAUSARON EJECUTORIA EN UNA CAUSA PENAL ACTIVA
                                            if (_Delitos != null && _Delitos.Any())
                                            {
                                                foreach (var itemX in _Delitos)
                                                {
                                                    ListaDelitosPreliminar.Add(new cReporteReincidentes
                                                    {
                                                        Delito    = itemX.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(itemX.MODALIDAD_DELITO.DESCR) ? itemX.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty,
                                                        Femenino  = _detallesCausaPenal != null ? _detallesCausaPenal.INGRESO != null ? _detallesCausaPenal.INGRESO.IMPUTADO != null ? _detallesCausaPenal.INGRESO.IMPUTADO.SEXO == "F" ? +1 : +0 : +0 : +0 : +0,
                                                        Masculino = _detallesCausaPenal != null ? _detallesCausaPenal.INGRESO != null ? _detallesCausaPenal.INGRESO.IMPUTADO != null ? _detallesCausaPenal.INGRESO.IMPUTADO.SEXO == "M" ? +1 : +0 : +0 : +0 : +0,
                                                        Fuero     = "X",
                                                        Total     = +1
                                                    });
                                                }
                                            }
                                        }
                                    }//EJECUTORIA
                                }
                                ; //SENTENCIA
                            }
                            ;
                        }
                    }
                }
                ;

                if (ListaDelitosPreliminar != null && ListaDelitosPreliminar.Any())
                {
                    var _Comunes   = ListaDelitosPreliminar.Where(x => x.Fuero == "C");
                    var _Federales = ListaDelitosPreliminar.Where(x => x.Fuero == "F");
                    var _SinFuero  = ListaDelitosPreliminar.Where(x => x.Fuero == "X");
                    if (_Comunes != null && _Comunes.Any())
                    {
                        var _DetalleComunes = _Comunes.GroupBy(x => x.Delito);
                        if (_DetalleComunes != null && _DetalleComunes.Any())
                        {
                            foreach (var item in _DetalleComunes)
                            {
                                if (!string.IsNullOrEmpty(item.Key))
                                {
                                    listaIngresosDefinitivos.Add(new cReporteReincidentes
                                    {
                                        Delito    = item.Key,
                                        Femenino  = item.Sum(x => x.Femenino),
                                        Masculino = item.Sum(x => x.Masculino),
                                        Fuero     = "COMÚN",
                                        Total     = (item.Any() ? item.Sum(x => x.Femenino) : 0) + (item.Any() ? item.Sum(x => x.Masculino) : 0)
                                    });
                                }
                            }
                        }
                    }
                    ;

                    if (_Federales != null && _Federales.Any())
                    {
                        var _DetalleFederales = _Federales.GroupBy(x => x.Delito);
                        if (_DetalleFederales != null && _DetalleFederales.Any())
                        {
                            foreach (var item in _DetalleFederales)
                            {
                                if (!string.IsNullOrEmpty(item.Key))
                                {
                                    listaIngresosDefinitivos2.Add(new cReporteReincidentes
                                    {
                                        Delito    = item.Key,
                                        Femenino  = item.Sum(x => x.Femenino),
                                        Masculino = item.Sum(x => x.Masculino),
                                        Fuero     = "FEDERAL",
                                        Total     = (item.Any() ? item.Sum(x => x.Femenino) : 0) + (item.Any() ? item.Sum(x => x.Masculino) : 0)
                                    });
                                }
                            }
                        }
                    }
                    ;

                    if (_SinFuero != null && _SinFuero.Any())
                    {
                        var _DetalleSinFuero = _Federales.GroupBy(x => x.Delito);
                        if (_DetalleSinFuero != null && _DetalleSinFuero.Any())
                        {
                            foreach (var item in _DetalleSinFuero)
                            {
                                if (!string.IsNullOrEmpty(item.Key))
                                {
                                    listaIngresosDefinitivos3.Add(new cReporteReincidentes
                                    {
                                        Delito    = item.Key,
                                        Femenino  = item.Sum(x => x.Femenino),
                                        Masculino = item.Sum(x => x.Masculino),
                                        Fuero     = "SIN FUERO",
                                        Total     = (item.Any() ? item.Sum(x => x.Femenino) : 0) + (item.Any() ? item.Sum(x => x.Masculino) : 0)
                                    });
                                }
                            }
                        }
                    }
                    ;
                }
                ;

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

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

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Motivos.Name  = "DataSet2";
                ReportDataSource_Motivos.Value = listaIngresosDefinitivos != null?listaIngresosDefinitivos.Any() ? listaIngresosDefinitivos.OrderBy(x => x.Delito).ToList() : new System.Collections.Generic.List <cReporteReincidentes>() : new System.Collections.Generic.List <cReporteReincidentes>();

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Motivos2.Name  = "DataSet3";
                ReportDataSource_Motivos2.Value = listaIngresosDefinitivos2 != null?listaIngresosDefinitivos2.Any() ? listaIngresosDefinitivos2.OrderBy(x => x.Delito).ToList() : new System.Collections.Generic.List <cReporteReincidentes>() : new System.Collections.Generic.List <cReporteReincidentes>();

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

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

            catch (System.Exception exc)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar el reporte", exc);
            }
        }
        public void GenerarReporte()
        {
            try
            {
                if (SelectedFechaInicial == null)
                {
                    return;
                }

                if (SelectedFechaFinal == null)
                {
                    return;
                }

                var encabezado           = new System.Collections.Generic.List <cEncabezado>();
                var listaIngresosActivos = new System.Collections.Generic.List <cReporteIngresosActivosCierre>();
                var centro = new SSP.Controlador.Catalogo.Justicia.cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                encabezado.Add(new cEncabezado()
                {
                    ImagenDerecha = Parametro.LOGO_ESTADO_BC,
                    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 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)
                });

                var _IngresosActivos = new SSP.Controlador.Catalogo.Justicia.cIngreso().ObtenerIngresosActivosPorFecha(GlobalVar.gCentro, SelectedFechaInicial, SelectedFechaFinal);
                int alf = _IngresosActivos.Count(x => x.IMPUTADO.NACIMIENTO_PAIS != null);
                if (_IngresosActivos.Any())
                {
                    int _NoUbicados        = new int();
                    int _HombresNoUbicados = new int();
                    int _MujeresNoUbicadas = new int();
                    var _Agrupados         = _IngresosActivos.GroupBy(x => x.IMPUTADO.NACIMIENTO_PAIS);
                    if (_Agrupados.Any())
                    {
                        foreach (var item in _Agrupados)
                        {
                            var _NombrePais = new SSP.Controlador.Catalogo.Justicia.cPaises().GetData(x => x.ID_PAIS_NAC == item.Key).FirstOrDefault();
                            if (_NombrePais == null)
                            {
                                _NoUbicados        = _NoUbicados + item.Count();
                                _HombresNoUbicados = _HombresNoUbicados + (item.Any() ? item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "M") : 0);
                                _MujeresNoUbicadas = _MujeresNoUbicadas + (item.Any() ? item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "F") : 0);
                                continue;
                            }
                            else
                            if (string.IsNullOrEmpty(_NombrePais.PAIS))
                            {
                                _NoUbicados        = _NoUbicados + item.Count();
                                _HombresNoUbicados = _HombresNoUbicados + (item.Any() ? item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "M") : 0);
                                _MujeresNoUbicadas = _MujeresNoUbicadas + (item.Any() ? item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "F") : 0);
                                continue;
                            }
                            else
                            {
                                listaIngresosActivos.Add(new cReporteIngresosActivosCierre
                                {
                                    TotalM     = item.Any() ? item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "F") : 0,
                                    TotalH     = item.Any() ? item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "M") : 0,
                                    NombrePais = _NombrePais != null ? !string.IsNullOrEmpty(_NombrePais.PAIS) ? _NombrePais.PAIS.Trim() : "SIN CAPTURAR" : "SIN CAPTURAR",
                                    GrandTotal = item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "M") + item.Count(x => x.IMPUTADO != null && x.IMPUTADO.SEXO == "F")
                                });
                            }
                        }
                        ;

                        //Ya tengo el condensado de las personas que no tienen pais
                        listaIngresosActivos.Add(new cReporteIngresosActivosCierre
                        {
                            NombrePais = "SIN CAPTURAR",
                            TotalH     = _HombresNoUbicados,
                            TotalM     = _MujeresNoUbicadas,
                            GrandTotal = _HombresNoUbicados + _MujeresNoUbicadas
                        });
                    }
                }
                ;

                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 = encabezado;

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Motivos.Name  = "DataSet2";
                ReportDataSource_Motivos.Value = listaIngresosActivos != null?listaIngresosActivos.Any() ? listaIngresosActivos.OrderBy(x => x.NombrePais).ToList() : new List <cReporteIngresosActivosCierre>() : new List <cReporteIngresosActivosCierre>();

                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 (System.Exception exc)
            {
                throw;
            }
        }
Beispiel #3
0
        public void GenerarReporte()
        {
            try
            {
                var encabezado                = new System.Collections.Generic.List <cEncabezado>();
                var listaIngresosActivos      = new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>();
                var listaIngresosDefinitivos  = new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>(); //COMUNES
                var listaIngresosDefinitivos2 = new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>(); //FEDERALES
                var listaIngresosDefinitivos3 = new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>(); //OTROS
                var centro = new SSP.Controlador.Catalogo.Justicia.cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                encabezado.Add(new cEncabezado()
                {
                    ImagenIzquierda = Parametro.REPORTE_LOGO1,
                    ImagenDerecha   = Parametro.REPORTE_LOGO2,
                    TituloUno       = Parametro.ENCABEZADO1,
                    TituloDos       = Parametro.ENCABEZADO2,
                    NombreReporte   = centro != null ? !string.IsNullOrEmpty(centro.DESCR) ? centro.DESCR.Trim() : string.Empty : string.Empty,
                    PieUno          = string.Format("Reporte por Primera Vez 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)
                });

                //System.Linq.Expressions.Expression<System.Func<SSP.Servidor.CAUSA_PENAL_DELITO, bool>> _expresionPersonalizada = e => e.CAUSA_PENAL != null ?
                //             e.CAUSA_PENAL.ID_ESTATUS_CP == (short)eEstatusCausaPenal.EN_PROCESO || e.CAUSA_PENAL.ID_ESTATUS_CP == (short)eEstatusCausaPenal.ACTIVA ?
                //             e.CAUSA_PENAL.INGRESO != null ?
                //                (e.CAUSA_PENAL.INGRESO.ID_ESTATUS_ADMINISTRATIVO != 1 && e.CAUSA_PENAL.INGRESO.ID_ESTATUS_ADMINISTRATIVO != 2 &&
                //                 e.CAUSA_PENAL.INGRESO.ID_ESTATUS_ADMINISTRATIVO != 3 && e.CAUSA_PENAL.INGRESO.ID_ESTATUS_ADMINISTRATIVO != 8) : false : false : false;

                var _IngresosActivos = new SSP.Controlador.Catalogo.Justicia.cIngreso().ObtenerIngresosActivosPorFecha(GlobalVar.gCentro, SelectedFechaInicial, SelectedFechaFinal);
                var PrimerIngreso    = _IngresosActivos.Where(x => x.ID_INGRESO == 1 && x.CAUSA_PENAL.Any(y => y.ID_ESTATUS_CP == (short)eEstatusCausaPenal.EN_PROCESO || y.ID_ESTATUS_CP == (short)eEstatusCausaPenal.ACTIVA) && x.CAUSA_PENAL.Any(y => y.CAUSA_PENAL_DELITO.Any()));
                foreach (var item in PrimerIngreso)
                {//CAUSAS PENALES CON DELITOS, ACTIVAS, PRODUCTO DE UN INGRESO ACTIVO. EL INGRESO ES EL PRIMERO
                    foreach (var item2 in item.CAUSA_PENAL)
                    {
                        foreach (var item3 in item2.CAUSA_PENAL_DELITO)
                        {
                            listaIngresosActivos.Add(new cReportePrimeraVezFueroDelito
                            {
                                Delito  = item3.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(item3.MODALIDAD_DELITO.DESCR) ? item3.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty,
                                Fuero   = item2.CP_FUERO,
                                Hombres = item2.INGRESO != null ? item2.INGRESO.IMPUTADO != null ? item2.INGRESO.IMPUTADO.SEXO == "M" ? +1 : +0 : +0 : +0,
                                Mujeres = item2.INGRESO != null ? item2.INGRESO.IMPUTADO != null ? item2.INGRESO.IMPUTADO.SEXO == "F" ? +1 : +0 : +0 : +0,
                                Total   = (item2.INGRESO != null ? item2.INGRESO.IMPUTADO != null ? item2.INGRESO.IMPUTADO.SEXO == "M" ? +1 : +0 : +0 : +0) +
                                          (item2.INGRESO != null ? item2.INGRESO.IMPUTADO != null ? item2.INGRESO.IMPUTADO.SEXO == "F" ? +1 : +0 : +0 : +0)
                            });
                        }
                        ;
                    }
                    ;
                }
                ;

                if (listaIngresosActivos != null && listaIngresosActivos.Any())
                {
                    var GruposDelitos = listaIngresosActivos.GroupBy(x => x.Delito);
                    foreach (var item in GruposDelitos)
                    {
                        var _Comunes     = item.Any() ? item.Where(x => x.Fuero == "C") : null;
                        var _Federales   = item.Any() ? item.Where(x => x.Fuero == "F") : null;
                        var _OtrosFueros = item.Any() ? item.Where(x => x.Fuero != "C" && x.Fuero != "F") : null;

                        if (_Comunes != null && _Comunes.Any())
                        {
                            if (_Comunes.Any())
                            {
                                listaIngresosDefinitivos.Add(new cReportePrimeraVezFueroDelito
                                {
                                    Delito  = item.Key,
                                    Fuero   = "COMÚN",
                                    Hombres = _Comunes.Sum(x => x.Hombres),
                                    Mujeres = _Comunes.Sum(x => x.Mujeres),
                                    Total   = (_Comunes.Sum(x => x.Hombres)) + (_Comunes.Sum(x => x.Mujeres))
                                });
                            }
                        }

                        if (_Federales != null && _Federales.Any())
                        {
                            if (_Federales.Any())
                            {
                                listaIngresosDefinitivos2.Add(new cReportePrimeraVezFueroDelito
                                {
                                    Delito  = item.Key,
                                    Fuero   = "FEDERAL",
                                    Hombres = _Federales.Sum(x => x.Hombres),
                                    Mujeres = _Federales.Sum(x => x.Mujeres),
                                    Total   = (_Federales.Sum(x => x.Hombres)) + (_Federales.Sum(x => x.Mujeres))
                                });
                            }
                        }


                        if (_OtrosFueros != null && _OtrosFueros.Any())
                        {
                            if (_OtrosFueros.Any())
                            {
                                listaIngresosDefinitivos3.Add(new cReportePrimeraVezFueroDelito
                                {
                                    Delito  = item.Key,
                                    Fuero   = "SIN FUERO",
                                    Hombres = _OtrosFueros.Sum(x => x.Hombres),
                                    Mujeres = _OtrosFueros.Sum(x => x.Mujeres),
                                    Total   = (_OtrosFueros.Sum(x => x.Hombres)) + (_OtrosFueros.Sum(x => x.Mujeres))
                                });
                            }
                        }
                    }
                    ;
                }

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

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

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Motivos.Name  = "DataSet2";
                ReportDataSource_Motivos.Value = listaIngresosDefinitivos != null?listaIngresosDefinitivos.Any() ? listaIngresosDefinitivos.OrderBy(x => x.Delito).ToList() : new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>() : new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>();

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos2 = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Motivos2.Name  = "DataSet3";
                ReportDataSource_Motivos2.Value = listaIngresosDefinitivos2 != null?listaIngresosDefinitivos2.Any() ? listaIngresosDefinitivos2.OrderBy(x => x.Delito).ToList() : new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>() : new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>();

                Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos3 = new Microsoft.Reporting.WinForms.ReportDataSource();
                ReportDataSource_Motivos3.Name  = "DataSet4";
                ReportDataSource_Motivos3.Value = listaIngresosDefinitivos3 != null?listaIngresosDefinitivos3.Any() ? listaIngresosDefinitivos3.OrderBy(c => c.Delito).ToList() : new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>() : new System.Collections.Generic.List <cReportePrimeraVezFueroDelito>();

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

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

            catch (System.Exception exc)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar el reporte", exc);
            }
        }