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() diff --git a/Bin/ADSReportLib.dll b/Bin/ADSReportLib.dll new file mode 100644 index 000000000..d1edd2a16 Binary files /dev/null and b/Bin/ADSReportLib.dll differ diff --git a/Bin/ADSReportLib.pdb b/Bin/ADSReportLib.pdb new file mode 100644 index 000000000..9b46fdb6d Binary files /dev/null and b/Bin/ADSReportLib.pdb differ diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 394f9a8be..9ba9734d0 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6724,7 +6724,7 @@ Partial Class Ventas End If End If - If GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 AndAlso ddlAlmacen.SelectedValue.ToEntero() <= 0 Then + If DivAlmacen.Visible AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Dev") AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 AndAlso ddlAlmacen.SelectedValue.ToEntero() <= 0 Then Alert("Tiene que seleccionar un almacén para la salida de almacén", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -11010,7 +11010,7 @@ Partial Class Ventas Next End If - If GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then + If DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then Dim Filtro As String = "" Select Case factura.TipoDocto