Ejemplo n.º 1
0
        /// <summary>
        /// Evento que se encarga de generar el reporte de las estadisticas mostradas en el grid
        /// </summary>
        /// <history>
        /// [erosado] 08/Mar/2016 Created
        /// [emoguel] 09/09/2016 Modified. Ahora abre el visor de reportes
        /// </history>
        private async void imgButtonPrint_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            List <RptPRStats> lstRptStats = dtgr.DataContext as List <RptPRStats>;

            if (lstRptStats != null)
            {
                string    dateRangeFileName = DateHelper.DateRangeFileName(dtpkFrom.Value.Value, dtpkTo.Value.Value);
                FileInfo  templatePath      = new FileInfo(string.Concat(Directory.GetCurrentDirectory(), "\\ReportTemplate\\RptPRStatistics.xlsx"));
                DataTable dt            = TableHelper.GetDataTableFromList(lstRptStats);
                string    nombreReporte = "PR Statistics";



                FileInfo finfo = await ReportBuilder.CreateCustomExcelAsync(dt, filterTuple, nombreReporte, dateRangeFileName, UsefulMethods.getExcelFormatTable(), addEnumeration : true, blnShowSubtotal : true, blnRowGrandTotal : true);

                if (finfo != null)
                {
                    frmDocumentViewer documentViewer = new frmDocumentViewer(finfo, Context.User.HasPermission(EnumPermission.RptExcel, EnumPermisionLevel.ReadOnly), false);
                    documentViewer.Owner = this;
                    documentViewer.ShowDialog();
                }
            }
            else
            {
                UIHelper.ShowMessage("There is no info to make a report", MessageBoxImage.Information, "PR Statistics");
            }
        }