public void mostrar(DateTime Desde, DateTime Hasta, string Titulo)
        {
            try
            {
                DAL.Tareas tareas = new DAL.Tareas();

                DataTable dt = tareas.ObtenerDataTable_Grupos(Desde, Hasta);
                rv1.LocalReport.ReportPath = Server.MapPath("~/Reports/TareasGrupos.rdlc");
                rv1.ProcessingMode         = ProcessingMode.Local;

                ReportDataSource datasource = new ReportDataSource("DataSet1", dt);
                rv1.LocalReport.DataSources.Clear();
                rv1.LocalReport.DataSources.Add(datasource);

                rv1.LocalReport.SetParameters(new ReportParameter("Desde", Desde.ToString("dd/MM/yyyy")));
                rv1.LocalReport.SetParameters(new ReportParameter("Hasta", Hasta.ToString("dd/MM/yyyy")));

                rv1.Enabled = true;
                rv1.Visible = true;
                rv1.ExportContentDisposition = ContentDisposition.AlwaysInline;
            }
            catch (Exception Exception)
            {
                LogManager.Mensaje m = new LogManager.Mensaje("SGECA.Forms.FrmReporteTareasGrupos",
                                                              "mostrar",
                                                              0,
                                                              "Error al intentar mostrar el documento.",
                                                              Exception.Message,
                                                              "",
                                                              true,
                                                              LogManager.EMensaje.Critico,
                                                              Exception.StackTrace);

                //Notify(m);
            }
        }
示例#2
0
        public void mostrar(DateTime Desde, DateTime Hasta, string Titulo)
        {
            List <string> ids        = new List <string>();
            List <string> ids_grupos = new List <string>();

            List <DAL.Empleados> empleados_asignados = (List <DAL.Empleados>)Session["empleados_asignados"];

            foreach (DAL.Empleados item in empleados_asignados)
            {
                ids.Add(item.Id.ToString());

                var gid = ids_grupos.Where(t => t.Contains(item.Grupo.ToString()));
                if (gid.Count() <= 0)
                {
                    ids_grupos.Add(item.Grupo.ToString());
                }
            }

            try
            {
                DAL.Tareas tareas = new DAL.Tareas();

                DataTable dt = tareas.ObtenerDataTable(Desde, Hasta, "DataTable1", ids);
                rv1.LocalReport.ReportPath = Server.MapPath("~/Reports/TareasReporte.rdlc");
                rv1.ProcessingMode         = ProcessingMode.Local;

                ReportDataSource datasource = new ReportDataSource("DataSet1", dt);
                rv1.LocalReport.DataSources.Clear();
                rv1.LocalReport.DataSources.Add(datasource);

                DAL.Empleados_Gastos gastos = new DAL.Empleados_Gastos();
                dt         = gastos.ObtenerDataTable(Desde.ToShortDateString(), Hasta.ToShortDateString(), ids_grupos);
                datasource = new ReportDataSource("DataSet2", dt);
                rv1.LocalReport.DataSources.Add(datasource);

                rv1.LocalReport.SetParameters(new ReportParameter("Desde", Desde.ToString("dd/MM/yyyy")));
                rv1.LocalReport.SetParameters(new ReportParameter("Hasta", Hasta.ToString("dd/MM/yyyy")));

                if (ids_grupos.Count() == 1)
                {
                    DAL.EmpleadosGrupos grupo = new DAL.EmpleadosGrupos();
                    rv1.LocalReport.SetParameters(new ReportParameter("Titulo", "REPORTE DE RENDICIÓN DE " + grupo.obtener_nombre(ids_grupos[0])));
                }
                else
                {
                    rv1.LocalReport.SetParameters(new ReportParameter("Titulo", "REPORTE DE RENDICIÓN"));
                }

                rv1.Enabled = true;
                rv1.Visible = true;
                rv1.ExportContentDisposition = ContentDisposition.AlwaysInline;
            }
            catch (Exception Exception)
            {
                LogManager.Mensaje m = new LogManager.Mensaje("SGECA.Forms.FrmReporteVentas",
                                                              "mostrar",
                                                              0,
                                                              "Error al intentar mostrar el documento.",
                                                              Exception.Message,
                                                              "",
                                                              true,
                                                              LogManager.EMensaje.Critico,
                                                              Exception.StackTrace);

                //Notify(m);
            }
        }