Пример #1
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();
        }
        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();
        }
Пример #3
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();
        }
Пример #4
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);
            }
        }
Пример #5
0
        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 lstBRVL = new List <cBitacoraRecepcionVisitaLegal>();
                var aduana  = new cAduana().ObtenerTodos(GlobalVar.gCentro, FFechaInicio.Value.Date, FFechaFin.Value.Date);
                if (aduana != null)
                {
                    foreach (var a in aduana)
                    {
                        var obj = new cBitacoraRecepcionVisitaLegal();
                        obj.FechaInicio = string.Format("{0:dd/MM/yyyy}", a.ENTRADA_FEC);
                        obj.HoraInicio  = string.Format("{0:hh:mm tt}", a.ENTRADA_FEC);
                        obj.Abogado     = string.Format("Abogado: {0} {1} {2}", !string.IsNullOrEmpty(a.PERSONA.NOMBRE) ? a.PERSONA.NOMBRE.Trim() : string.Empty, !string.IsNullOrEmpty(a.PERSONA.PATERNO) ? a.PERSONA.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(a.PERSONA.MATERNO) ? a.PERSONA.MATERNO : string.Empty);
                        obj.Autorizo    = "SYSTEM";
                        obj.FechaFin    = string.Format("{0:dd/MM/yyyy}", a.SALIDA_FEC);
                        obj.HoraFin     = string.Format("{0:hh:mm tt}", a.SALIDA_FEC);
                        if (a.ADUANA_INGRESO.Count > 0)
                        {
                            foreach (var ai in a.ADUANA_INGRESO)
                            {
                                //if(ai.ADUANA_INGRESO_CP != null)
                                //{
                                //    var exp = string.Empty;
                                //    foreach (var e in ai.ADUANA_INGRESO_CP)
                                //    {
                                //        if(!string.IsNullOrEmpty(obj.Expediente))
                                //            exp = exp + ",";
                                //        obj.Expediente = obj.Expediente + string.Format("{0}/{1}", e.CAUSA_PENAL.CP_ANIO, e.CAUSA_PENAL.CP_FOLIO);
                                //    }
                                //    if (!string.IsNullOrEmpty(exp))
                                //    {
                                //        obj.Expediente = string.Format("Expediente:{0}",exp);
                                //    }
                                //}
                                obj.Expediente = string.Format("Expediente:{0}/{1}", ai.INGRESO.ID_ANIO, ai.INGRESO.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);
                            }
                        }
                        lstBRVL.Add(obj);
                    }
                }

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

                Microsoft.Reporting.WinForms.ReportDataSource rds1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = lstBRVL;
                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);
                Reporte.RefreshReport();
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
Пример #6
0
        public void GenerarReporteConQuery()
        {
            try
            {
                var hoy          = Fechas.GetFechaDateServer;
                var centro       = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault();
                var datosReporte = new List <cReporteDatos>();
                var totales      = new List <cControlVisitaTotales>();
                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 reporte = new cAduana().ObtenerReporteControlVisita(GlobalVar.gCentro, SelectedFechaInicial, SelectedFechaFinal).Select(w => new cControlVisita()
                {
                    Hora_Ingreso      = w.ENTRADA_FEC.ToString("hh:mm tt"),
                    Hora_Salida       = w.SALIDA_FEC != null ? w.SALIDA_FEC.Value.ToString("hh:mm tt") : null,
                    Id_Persona        = w.ID_PERSONA,
                    Nombre_Visitante  = w.VISITA_NOMBRE,
                    Paterno_Visitante = w.VISITA_PATERNO,
                    Materno_Visitante = w.VISITA_MATERNO,
                    Centro            = w.ID_CENTRO,
                    Id_Anio           = w.ID_ANIO,
                    Id_Imputado       = w.ID_IMPUTADO,
                    Nombre_Ingreso    = w.INTERNO_NOMBRE,
                    Paterno_Ingreso   = w.INTERNO_PATERNO,
                    Materno_Ingreso   = w.INTERNO_MATERNO,
                    Ubicacion_Ingreso = string.Format("{0}-{1}-{2}-{3}", w.EDIFICIO, w.SECTOR, w.CELDA, w.CAMA),
                    Usuario           = string.Format("{0} {1} {2}", w.USUARIO_NOMBRE, w.USUARIO_PATERNO, w.USUARIO_MATERNO),
                    //DioSalida
                    Tipo_Visita = w.INTIMA == "S" ?  w.TIPO_VISITA + "(INTIMA)" : w.TIPO_VISITA,
                    Intima      = w.INTIMA,
                    Categoria   = new Fechas().CalculaEdad(w.VISITA_NACIMIENTO, hoy) < MAYORIA_DE_EDAD ? MENORES : (w.VISITA_SEXO == "F" ? MUJERES : HOMBRES),
                });

                if (reporte != null)
                {
                    int tve = reporte.Count();
                    int tvs = reporte.Count(w => !string.IsNullOrEmpty(w.Hora_Salida));
                    int tvi = reporte.GroupBy(w => new { w.Centro, w.Id_Anio, w.Id_Imputado }).Count();

                    int tie = reporte.Count(w => w.Intima == "S");
                    int tis = reporte.Count(w => w.Intima == "S" && !string.IsNullOrEmpty(w.Hora_Salida));

                    totales.Add(new cControlVisitaTotales()
                    {
                        VisitantesIngresaron      = tve,
                        VisitantesSalieron        = tvs,
                        InternosVisitados         = tvi,
                        VisitanteIntimaIngresaron = tie,
                        VisitanteIntimaSalieron   = tis
                    });
                }

                Reporte.Refresh();
                Reporte.LocalReport.ReportPath = "Reportes/rControlVisitantes.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 = reporte;

                ReportDataSource ReportDataSource2 = new ReportDataSource();
                ReportDataSource2.Name  = "DataSet3";
                ReportDataSource2.Value = totales;


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

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

                Reporte.Refresh();
                Reporte.RefreshReport();

                ReporteGrafica.Refresh();
                ReporteGrafica.LocalReport.ReportPath = "Reportes/rControlVisitantesGrafica.rdlc";
                ReporteGrafica.LocalReport.DataSources.Clear();

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

                ReportDataSource ReportDataSource_Grafica = new ReportDataSource();
                ReportDataSource_Grafica.Name  = "DataSet3";
                ReportDataSource_Grafica.Value = reporte;

                ReporteGrafica.LocalReport.DataSources.Add(ReportDataSource_Encabezado_Grafica);
                ReporteGrafica.LocalReport.DataSources.Add(ReportDataSource_Grafica);

                ReporteGrafica.LocalReport.SetParameters(new ReportParameter("FechaInicial", string.Format("{0} DE {1} DEL {2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
                ReporteGrafica.LocalReport.SetParameters(new ReportParameter("FechaFinal", string.Format("{0} DE {1} DEL {2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));
                ReporteGrafica.LocalReport.SetParameters(new ReportParameter("TotalVisitantes", reporte.Count().ToString()));

                ReporteGrafica.Refresh();
                ReporteGrafica.RefreshReport();
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte", ex);
            }
        }
Пример #7
0
        public async void GenerarReporte()
        {
            try
            {
                var lVisitas      = new List <cControlVisita>();
                var datosReporte  = new List <cReporteDatos>();
                var VisitasGenero = new List <cVisitantesGenero>();

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

                    var totales = new List <cControlVisitaTotales>();
                    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 consulta_cama = new cCama();

                    double Total_Resultados = new cAduana().
                                              ObtenerVisitas(SelectedFechaInicial, SelectedFechaFinal, Parametro.CONTROL_VISITANTES_REPORTE).Count();
                    var Paginas = Math.Abs(Total_Resultados - (int)Total_Resultados) < double.Epsilon ? ((int)((Total_Resultados / VISITANTES_POR_PAGINA) + 1)) : ((int)(Total_Resultados / VISITANTES_POR_PAGINA));

                    for (int i = 0; i < Paginas; i++)
                    {
                        lVisitas.AddRange(new cAduana().
                                          ObtenerVisitas(SelectedFechaInicial, SelectedFechaFinal, Parametro.CONTROL_VISITANTES_REPORTE).OrderBy(o => o.ID_ADUANA).Skip(ULTIMO_REGISTRO).Take(VISITANTES_POR_PAGINA).
                                          AsEnumerable().
                                          Select(s => new cControlVisita()
                        {
                            Hora_Ingreso    = string.Format("{0}:{1}", s.ENTRADA_FEC.Value.Hour < 10 ? string.Format("0{0}", s.ENTRADA_FEC.Value.Hour.ToString()) : s.ENTRADA_FEC.Value.Hour.ToString(), s.ENTRADA_FEC.Value.Minute < 10 ? string.Format("0{0}", s.ENTRADA_FEC.Value.Minute.ToString()) : s.ENTRADA_FEC.Value.Minute.ToString()),
                            Hora_Salida     = s.SALIDA_FEC.HasValue ? string.Format("{0}:{1}", s.SALIDA_FEC.Value.Hour < 10 ? string.Format("0{0}", s.SALIDA_FEC.Value.Hour.ToString()) : s.SALIDA_FEC.Value.Hour.ToString(), s.SALIDA_FEC.Value.Minute < 10 ? string.Format("0{0}", s.SALIDA_FEC.Value.Minute.ToString()) : s.SALIDA_FEC.Value.Minute.ToString()) : string.Empty,
                            Centro          = s.ADUANA_INGRESO.Any() ? s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().ID_CENTRO : new short(),
                            Id_Anio         = s.ADUANA_INGRESO.Any() ? s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().ID_ANIO : new short(),
                            Id_Imputado     = s.ADUANA_INGRESO.Any() ? s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().ID_IMPUTADO : new short(),
                            Id_Persona      = s.ID_PERSONA,
                            Paterno_Ingreso = s.ADUANA_INGRESO.Any() ? !string.IsNullOrEmpty(s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.PATERNO) ?
                                              s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.PATERNO.TrimEnd() : string.Empty : string.Empty,
                            Materno_Ingreso = s.ADUANA_INGRESO.Any() ? !string.IsNullOrEmpty(s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.MATERNO) ?
                                              s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.MATERNO.TrimEnd() : string.Empty : string.Empty,
                            Nombre_Ingreso = s.ADUANA_INGRESO.Any() ? !string.IsNullOrEmpty(s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.NOMBRE) ?
                                             s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.NOMBRE.TrimEnd() : string.Empty : string.Empty,
                            Ubicacion_Ingreso = new Func <string>(() =>
                            {
                                var ingreso = s.ADUANA_INGRESO.Any() ? s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO : null;

                                if (ingreso != null)
                                {
                                    if (ingreso.ID_UB_CENTRO != null &&
                                        ingreso.ID_UB_EDIFICIO != null &&
                                        ingreso.ID_UB_SECTOR != null &&
                                        ingreso.ID_UB_CELDA != null &&
                                        ingreso.ID_UB_CAMA != null)
                                    {
                                        var cama = consulta_cama.ObtenerCama((short)ingreso.ID_UB_CENTRO, (short)ingreso.ID_UB_EDIFICIO, (short)ingreso.ID_UB_SECTOR, ingreso.ID_UB_CELDA, (short)ingreso.ID_UB_CAMA);
                                        if (cama != null)
                                        {
                                            return(string.Format("{0}-{1}-{2}",
                                                                 cama.CELDA != null ? cama.CELDA.SECTOR != null ? cama.CELDA.SECTOR.EDIFICIO != null ? !string.IsNullOrEmpty(cama.CELDA.SECTOR.EDIFICIO.DESCR) ? cama.CELDA.SECTOR.EDIFICIO.DESCR.TrimEnd() : string.Empty : string.Empty : string.Empty : string.Empty,
                                                                 cama.CELDA != null ? cama.CELDA.SECTOR != null ? !string.IsNullOrEmpty(cama.CELDA.SECTOR.DESCR) ? cama.CELDA.SECTOR.DESCR.TrimEnd() : string.Empty : string.Empty : string.Empty,
                                                                 cama.CELDA != null ? cama.CELDA.ID_CELDA.TrimStart().TrimEnd() : string.Empty));
                                        }
                                    }
                                }
                                return(string.Empty);
                            })(),
                            Usuario           = s.USUARIO != null ? s.USUARIO.ID_USUARIO : string.Empty,
                            Paterno_Visitante = s.PERSONA != null ? !string.IsNullOrEmpty(s.PERSONA.PATERNO) ? s.PERSONA.PATERNO.TrimEnd() : string.Empty : string.Empty,
                            Materno_Visitante = s.PERSONA != null ? !string.IsNullOrEmpty(s.PERSONA.MATERNO) ? s.PERSONA.MATERNO.TrimEnd() : string.Empty : string.Empty,
                            Nombre_Visitante  = s.PERSONA != null ? !string.IsNullOrEmpty(s.PERSONA.NOMBRE) ? s.PERSONA.NOMBRE.TrimEnd() : string.Empty : string.Empty,
                            Tipo_Visita       = new Func <string>(() =>
                            {
                                enumTipoPersona TipoPersona = (enumTipoPersona)s.ID_TIPO_PERSONA;
                                var TipoVisita = string.Empty;
                                switch (TipoPersona)
                                {
                                case enumTipoPersona.ABOGADO:
                                    TipoVisita = string.Format(VISITA_LEGAL + " ({0})", s.TIPO_PERSONA != null ? !string.IsNullOrEmpty(s.TIPO_PERSONA.DESCR) ? s.TIPO_PERSONA.DESCR.TrimEnd() : string.Empty : string.Empty);
                                    break;

                                case enumTipoPersona.VISITA:
                                    TipoVisita = s.ADUANA_INGRESO.Any() ? string.Format("{0}", s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INTIMA == ES_VISITA_INTIMA ? VISITA_INTIMA : VISITA_FAMILIAR) : string.Empty;
                                    break;
                                }
                                return(TipoVisita);
                            })(),
                            Categoria = ObtenerEdad(s.PERSONA.FEC_NACIMIENTO.Value) < MAYORIA_DE_EDAD ? MENORES : (s.PERSONA.SEXO == FEMENINO ? MUJERES : HOMBRES),
                        }).
                                          ToList());
                        ULTIMO_REGISTRO += VISITANTES_POR_PAGINA;
                    }


                    #region Informacion_Reporte
                    //lVisitas = new cAduana().
                    //    ObtenerVisitas(SelectedFechaInicial, SelectedFechaFinal, Parametro.CONTROL_VISITANTES_REPORTE).
                    //    AsEnumerable().
                    //    Select(s => new cControlVisita()
                    //    {
                    //        Hora_Ingreso = string.Format("{0}:{1}", s.ENTRADA_FEC.Value.Hour < 10 ? string.Format("0{0}", s.ENTRADA_FEC.Value.Hour.ToString()) : s.ENTRADA_FEC.Value.Hour.ToString(), s.ENTRADA_FEC.Value.Minute < 10 ? string.Format("0{0}", s.ENTRADA_FEC.Value.Minute.ToString()) : s.ENTRADA_FEC.Value.Minute.ToString()),
                    //        Hora_Salida = s.SALIDA_FEC.HasValue ? string.Format("{0}:{1}", s.SALIDA_FEC.Value.Hour < 10 ? string.Format("0{0}", s.SALIDA_FEC.Value.Hour.ToString()) : s.SALIDA_FEC.Value.Hour.ToString(), s.SALIDA_FEC.Value.Minute < 10 ? string.Format("0{0}", s.SALIDA_FEC.Value.Minute.ToString()) : s.SALIDA_FEC.Value.Minute.ToString()) : string.Empty,
                    //        Id_Anio = s.ADUANA_INGRESO.Any() ? s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().ID_ANIO : new short(),
                    //        Id_Imputado = s.ADUANA_INGRESO.Any() ? s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().ID_IMPUTADO : new short(),
                    //        Id_Persona = s.ID_PERSONA,
                    //        Paterno_Ingreso = s.ADUANA_INGRESO.Any() ? !string.IsNullOrEmpty(s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.PATERNO) ?
                    //                s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.PATERNO.TrimEnd() : string.Empty : string.Empty,
                    //        Materno_Ingreso = s.ADUANA_INGRESO.Any() ? !string.IsNullOrEmpty(s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.MATERNO) ?
                    //                s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.MATERNO.TrimEnd() : string.Empty : string.Empty,
                    //        Nombre_Ingreso = s.ADUANA_INGRESO.Any() ? !string.IsNullOrEmpty(s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.NOMBRE) ?
                    //                s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO.IMPUTADO.NOMBRE.TrimEnd() : string.Empty : string.Empty,
                    //        Ubicacion_Ingreso = new Func<string>(() =>
                    //        {
                    //            var ingreso = s.ADUANA_INGRESO.Any() ? s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INGRESO : null;

                    //            if (ingreso != null)
                    //            {
                    //                if (ingreso.ID_UB_CENTRO != null &&
                    //                    ingreso.ID_UB_EDIFICIO != null &&
                    //                    ingreso.ID_UB_SECTOR != null &&
                    //                    ingreso.ID_UB_CELDA != null &&
                    //                    ingreso.ID_UB_CAMA != null)
                    //                {
                    //                    var cama = consulta_cama.ObtenerCama((short)ingreso.ID_UB_CENTRO, (short)ingreso.ID_UB_EDIFICIO, (short)ingreso.ID_UB_SECTOR, ingreso.ID_UB_CELDA, (short)ingreso.ID_UB_CAMA);
                    //                    if (cama != null)
                    //                        return string.Format("{0}-{1}-{2}",
                    //                            cama.CELDA != null ? cama.CELDA.SECTOR != null ? cama.CELDA.SECTOR.EDIFICIO != null ? !string.IsNullOrEmpty(cama.CELDA.SECTOR.EDIFICIO.DESCR) ? cama.CELDA.SECTOR.EDIFICIO.DESCR.TrimEnd() : string.Empty : string.Empty : string.Empty : string.Empty,
                    //                            cama.CELDA != null ? cama.CELDA.SECTOR != null ? !string.IsNullOrEmpty(cama.CELDA.SECTOR.DESCR) ? cama.CELDA.SECTOR.DESCR.TrimEnd() : string.Empty : string.Empty : string.Empty,
                    //                            cama.CELDA != null ? cama.CELDA.ID_CELDA.TrimStart().TrimEnd() : string.Empty);
                    //                }
                    //            }
                    //            return string.Empty;
                    //        })(),
                    //        Usuario = s.USUARIO != null ? s.USUARIO.ID_USUARIO : string.Empty,
                    //        Paterno_Visitante = s.PERSONA != null ? !string.IsNullOrEmpty(s.PERSONA.PATERNO) ? s.PERSONA.PATERNO.TrimEnd() : string.Empty : string.Empty,
                    //        Materno_Visitante = s.PERSONA != null ? !string.IsNullOrEmpty(s.PERSONA.MATERNO) ? s.PERSONA.MATERNO.TrimEnd() : string.Empty : string.Empty,
                    //        Nombre_Visitante = s.PERSONA != null ? !string.IsNullOrEmpty(s.PERSONA.NOMBRE) ? s.PERSONA.NOMBRE.TrimEnd() : string.Empty : string.Empty,
                    //        Tipo_Visita = new Func<string>(() =>
                    //        {
                    //            enumTipoPersona TipoPersona = (enumTipoPersona)s.ID_TIPO_PERSONA;
                    //            var TipoVisita = string.Empty;
                    //            switch (TipoPersona)
                    //            {
                    //                case enumTipoPersona.ABOGADO:
                    //                    TipoVisita = string.Format(VISITA_LEGAL + " ({0})", s.TIPO_PERSONA != null ? !string.IsNullOrEmpty(s.TIPO_PERSONA.DESCR) ? s.TIPO_PERSONA.DESCR.TrimEnd() : string.Empty : string.Empty);
                    //                    break;
                    //                case enumTipoPersona.VISITA:
                    //                    TipoVisita = s.ADUANA_INGRESO.Any() ? string.Format("{0}", s.ADUANA_INGRESO.Where(w => w.ID_ADUANA == s.ID_ADUANA).FirstOrDefault().INTIMA == ES_VISITA_INTIMA ? VISITA_INTIMA : VISITA_FAMILIAR) : string.Empty;
                    //                    break;
                    //            }
                    //            return TipoVisita;
                    //        })(),
                    //        Categoria = ObtenerEdad(s.PERSONA.FEC_NACIMIENTO.Value) < MAYORIA_DE_EDAD ? MENORES : (s.PERSONA.SEXO == FEMENINO ? MUJERES : HOMBRES),
                    //    }).
                    //    ToList();
                    #endregion
                    Application.Current.Dispatcher.Invoke((Action)(delegate
                    {
                        ReportViewerVisible = Visibility.Visible;
                    }));
                });


                #region Reporte
                Reporte.LocalReport.ReportPath = "Reportes/rControlVisitantes.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);
                #endregion

                #region Grafica
                ReporteGrafica.LocalReport.ReportPath = "Reportes/rControlVisitantesGrafica.rdlc";
                ReporteGrafica.LocalReport.DataSources.Clear();

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

                ReportDataSource ReportDataSource_Grafica = new ReportDataSource();
                ReportDataSource_Grafica.Name  = "DataSet3";
                ReportDataSource_Grafica.Value = lVisitas;

                ReporteGrafica.LocalReport.DataSources.Add(ReportDataSource_Encabezado_Grafica);
                ReporteGrafica.LocalReport.DataSources.Add(ReportDataSource_Grafica);
                #endregion

                #region Parametros
                Reporte.LocalReport.SetParameters(new ReportParameter("FechaInicial", string.Format("{0} DE {1} DEL {2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
                Reporte.LocalReport.SetParameters(new ReportParameter("FechaFinal", string.Format("{0} DE {1} DEL {2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));
                ReporteGrafica.LocalReport.SetParameters(new ReportParameter("FechaInicial", string.Format("{0} DE {1} DEL {2}", SelectedFechaInicial.Day, SelectedFechaInicial.Month, SelectedFechaInicial.Year)));
                ReporteGrafica.LocalReport.SetParameters(new ReportParameter("FechaFinal", string.Format("{0} DE {1} DEL {2}", SelectedFechaFinal.Day, SelectedFechaFinal.Month, SelectedFechaFinal.Year)));
                ReporteGrafica.LocalReport.SetParameters(new ReportParameter("TotalVisitantes", lVisitas.Count.ToString()));
                #endregion


                Reporte.Refresh();
                Reporte.RefreshReport();
                ReporteGrafica.Refresh();
                ReporteGrafica.RefreshReport();
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }