imprimir reporte en excel y pdf

This commit is contained in:
Antonio Gonzalez
2020-04-23 09:26:50 -07:00
parent 0bc003e2c4
commit 985ad7d871
4 changed files with 77 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;
using Extensiones;
@@ -195,4 +196,35 @@ public partial class CRM_CatProbabilidadAcercamiento : ClsPaginas
}
}
#endregion
protected void LnkImprimir_Click(object sender, EventArgs e)
{
Imprimir("PDF");
}
protected void LnkImprimirExcel_Click(object sender, EventArgs e)
{
Imprimir("EXCEL");
}
private void Imprimir(string formato)
{
System.IO.FileInfo Image = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
string logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
List<ReportParameter> param = new List<ReportParameter>();
param.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
if (Image.Exists)
{
param.Add(new ReportParameter("LogoPath", logouri));
}
else
{
param.Add(new ReportParameter("LogoPath", ""));
}
param.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
param.Add(new ReportParameter("FechaImpresion", DateTime.Today.ToString()));
ImprimirPDF("Empresas/Grales/Formatos/RepCatProbabilidadAcercamiento", TmpDT, param, "Report Cat Etapas Proceso", formato);
}
}