From 24a13fb076855968443ce160d4add70b35528c22 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Wed, 25 Mar 2020 00:46:18 -0700 Subject: [PATCH] --- App_Code/ClsPaginas.vb | 59 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 251ad2993..1189f9541 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1753,7 +1753,7 @@ Public Class ClsPaginas If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacenUsuarios"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTAlmacenUsuarios = Dv.ToTable + GlobalDTAlmacenUsuarios = Dv.ToTable Dv.Dispose() @@ -5086,30 +5086,66 @@ Public Class ClsPaginas lrds.Add(rds) Return StreamPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR) End Function + 'Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte() + ' 'limpio ReportViwer + ' Dim sw As New System.Diagnostics.Stopwatch() + ' sw.Start() + + ' If IsNothing(MR) Then MR = New ReportViewer + ' Dim Bytes As Byte() = Nothing + ' Try + ' ' MasterReporteador.LocalReport.DataSources.Clear() + ' For Each RDS As ReportDataSource In DataSource + ' MR.LocalReport.DataSources.Add(RDS) + ' Next + + ' MR.LocalReport.ReportPath = RutaReporte + ' MR.ProcessingMode = ProcessingMode.Local + ' MR.LocalReport.EnableExternalImages = True + ' MR.LocalReport.SetParameters(Parametros) + ' MR.LocalReport.Refresh() + ' Dim Warnings As Warning() = Nothing + ' Dim StreamIds As String() = Nothing + ' Dim MimeType As String = Nothing + ' Dim Encoding As String = Nothing + ' Dim Extension As String = Nothing + ' Bytes = MR.LocalReport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) + ' Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException + ' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") + ' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 + ' 'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") + ' Catch ex As Exception + ' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") + ' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 + ' 'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") + ' End Try + + ' sw.Stop() + ' If sw.Elapsed.TotalSeconds > 10 Then + ' GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ") + ' End If + + ' Return Bytes + 'End Function + Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte() 'limpio ReportViwer Dim sw As New System.Diagnostics.Stopwatch() sw.Start() - If IsNothing(MR) Then MR = New ReportViewer Dim Bytes As Byte() = Nothing Try - ' MasterReporteador.LocalReport.DataSources.Clear() + Dim fllreport As New ADSReportLib.FullTrustReportviewer() + fllreport.Initialize("DisplayName", RutaReporte, Parametros, New List(Of String()), True) For Each RDS As ReportDataSource In DataSource - MR.LocalReport.DataSources.Add(RDS) + fllreport.AddDataSources(RDS) Next - - MR.LocalReport.ReportPath = RutaReporte - MR.ProcessingMode = ProcessingMode.Local - MR.LocalReport.EnableExternalImages = True - MR.LocalReport.SetParameters(Parametros) - MR.LocalReport.Refresh() Dim Warnings As Warning() = Nothing Dim StreamIds As String() = Nothing Dim MimeType As String = Nothing Dim Encoding As String = Nothing Dim Extension As String = Nothing - Bytes = MR.LocalReport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) + Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 @@ -5127,6 +5163,7 @@ Public Class ClsPaginas Return Bytes End Function + Public Function ImprimirPDFCrystal(RutaReporte As String, DataSource As DataTable, Parametros As List(Of CrystalParametro), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportDocument = Nothing) As Byte() 'limpio ReportViwer Dim sw As New System.Diagnostics.Stopwatch()