diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 1189f9541..58f56f166 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3,7 +3,6 @@ Option Explicit On Imports System Imports System.Data -Imports System.Security.Cryptography Imports Extensiones Imports System.Web.Security Imports System.Web @@ -14,10 +13,6 @@ Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports CrystalDecisions.ReportSource Imports Stimulsoft.Report -Imports Stimulsoft.Report.Dictionary -Imports Stimulsoft.Report.MobileDesign -Imports System.Linq -Imports Stimulsoft.Report.Export Imports System.Xml @@ -431,7 +426,7 @@ Public Class ClsPaginas End Property Property GlobalDTProveedorClasificacion(CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTProveedorClasificacion{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProveedorClasificacion-{0}", CveEmpresa) 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim P As New ClsCompProveedores @@ -449,14 +444,14 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProveedorClasificacion{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProveedorClasificacion-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property Property GlobalDTProveedorSucursales(CveProveedor As Integer, CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales-{0}", CveEmpresa) 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim P As New ClsCompProveedores @@ -474,7 +469,7 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales-{0}", CveEmpresa) Application(AppNombre) = value End Set @@ -551,7 +546,7 @@ Public Class ClsPaginas End Property Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1, Optional CveClasificacion As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTClasificaciones{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTClasificaciones-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjClasificaciones As New ClsClasificaciones @@ -575,27 +570,35 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTClasificaciones{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTClasificaciones-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property Property GlobalDTClasificaciones2(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTClasificaciones2-{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjClasificaciones As New ClsClasificaciones + If ObjClasificaciones.GetClasificaciones(CveEmpresa, Tipo:=4) Then Application(AppNombre) = ObjClasificaciones.DtResultados + ObjClasificaciones.Dispose() + End If If CveEmpresa <> -1 Then Dim Str As New StringBuilder Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) - Dim Dv As New DataView(DirectCast(Application("GlobalDTClasificaciones2"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) GlobalDTClasificaciones2 = Dv.ToTable Dv.Dispose() Else - GlobalDTClasificaciones2 = DirectCast(Application("GlobalDTClasificaciones2"), DataTable) + GlobalDTClasificaciones2 = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTClasificaciones2") = value + Dim AppNombre As String = String.Format("GlobalDTClasificaciones2-{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTClasificacionesSubProyectos(Optional CveClasificacion As Integer = -1, Optional CveEmpresa As Integer = -1) As DataTable @@ -768,7 +771,7 @@ Public Class ClsPaginas End Property Public Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then Dim ObjUnidadesMedida As New ClsUnidadesMedida() @@ -785,13 +788,13 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property Property GlobalDTUnidadesMedidaAlias(Optional CveEmpresa As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedidaAlias{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedidaAlias-{0}", CveEmpresa) 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then Dim ObjUnidadesMedida As New ClsUnidadesMedida() @@ -807,7 +810,7 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedidaAlias{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedidaAlias-{0}", CveEmpresa) Application(AppNombre) = value 'Dim ObjUnidadesMedida As New ClsUnidadesMedida() 'If ObjUnidadesMedida.GetUnidadesMedidaAlias(CveEmpresa, -1) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados @@ -894,7 +897,7 @@ Public Class ClsPaginas End Property Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then Dim P As New ClsSubProyectos @@ -926,13 +929,13 @@ Public Class ClsPaginas End Get Set(ByVal value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property Property GlobalDTSubProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTSubProyectosUsuarios{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTSubProyectosUsuarios-{0}", CveEmpresa) If Application(AppNombre) Is Nothing Then Dim ObjSubProyectos As New ClsSubProyectos() If ObjSubProyectos.GetSubProyectosUsuarios(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = ObjSubProyectos.DtResultados Else Alert("Ocurrió un error al cargar los SubProyectos. Por favor comuniquese con sistemas.", TipoMensaje.MsgError) @@ -965,7 +968,7 @@ Public Class ClsPaginas End Get Set(ByVal value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTSubProyectosUsuarios{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTSubProyectosUsuarios-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property @@ -1177,7 +1180,7 @@ Public Class ClsPaginas End Property Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) If CveEmpresa <> -1 Then 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then @@ -1208,13 +1211,13 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property Property GlobalDTProductosServiciosAlias(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjPS As New ClsProductosServicios @@ -1237,13 +1240,13 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property Public Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias-{0}", CveEmpresa) If CveEmpresa <> -1 Then 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then @@ -1267,7 +1270,7 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias-{0}", CveEmpresa) Application(AppNombre) = value End Set @@ -1290,7 +1293,7 @@ Public Class ClsPaginas Property GlobalDTPSAdicionales(CvePS As Integer, CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTPSAdicionales{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTPSAdicionales-{0}", CveEmpresa) If CveEmpresa <> -1 Then 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then @@ -1313,7 +1316,7 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTPSAdicionales{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTPSAdicionales-{0}", CveEmpresa) Application(AppNombre) = value End Set @@ -1367,7 +1370,7 @@ Public Class ClsPaginas End Property Property GlobalDTImpuestosLocales(CvePS As Integer, CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTImpuestosLocales{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTImpuestosLocales-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjPS As New ClsProductosServicios @@ -1388,7 +1391,7 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTImpuestosLocales{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTImpuestosLocales-{0}", CveEmpresa) Application(AppNombre) = value 'Dim ObjPS As New ClsProductosServicios 'If ObjPS.GetPSImpuestosLocales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados @@ -1512,7 +1515,7 @@ Public Class ClsPaginas 'Cliente Property GlobalDTCliente(CveEmpresa As Integer, Optional Estatus As Integer = 1, Optional CveCliente As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTCliente-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjClientes As New ClsClientes @@ -1537,13 +1540,13 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTCliente-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property Property GlobalDTClienteClasificaciones(CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjClientes As New ClsClientes @@ -1560,7 +1563,7 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property @@ -1581,7 +1584,7 @@ Public Class ClsPaginas 'Variables para Ventas Property GlobalDTVendedores(CveEmpresa As Integer, Optional Estatus As Boolean = True, Optional VendedorTipo As Integer = 1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTVendedores{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTVendedores-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjVendedores As New ClsVtaVendedores @@ -1597,7 +1600,7 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTVendedores{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTVendedores-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property @@ -1617,7 +1620,7 @@ Public Class ClsPaginas End Property Property GlobalDTCompProveedores(CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTCompProveedores{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTCompProveedores-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjProveedores As New ClsCompProveedores @@ -1635,7 +1638,7 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTCompProveedores{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTCompProveedores-{0}", CveEmpresa) Application(AppNombre) = value 'Dim ObjProveedores As New ClsCompProveedores 'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then Application(AppNombre) = ObjProveedores.DtResultados @@ -1669,7 +1672,7 @@ Public Class ClsPaginas End Property Property GlobalDTContratosTipos(CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTContratosTipos{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTContratosTipos-{0}", CveEmpresa) 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then @@ -1682,7 +1685,7 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTContratosTipos{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTContratosTipos-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property @@ -2850,7 +2853,7 @@ Public Class ClsPaginas Property GlobalDTRHPersonal(CveEmpresa As Integer, Optional CvePersonal As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTRHPersonal{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTRHPersonal-{0}", CveEmpresa) 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim ObjPersonal As New ClsRH @@ -2872,7 +2875,7 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTRHPersonal{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTRHPersonal-{0}", CveEmpresa) Application(AppNombre) = value End Set @@ -3275,7 +3278,7 @@ Public Class ClsPaginas Property GlobalDTAcumGarantiasMesesTipoUso(CveEmpresa As Integer, CveMarca As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTAcumGarantiasMesesTipoUso{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTAcumGarantiasMesesTipoUso-{0}", CveEmpresa) If Application(AppNombre) Is Nothing Then Dim ObjAcumuladores As New ClsAcumuladores() If ObjAcumuladores.GarantiasMesesGet(-1, -1) Then Application(AppNombre) = ObjAcumuladores.DtResultados.FiltraParametros("", DistinctColumns:={"CveMarca", "CveTipoUso", "TipoUso"}) @@ -3295,7 +3298,7 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTAcumGarantiasMesesTipoUso{0}", CveEmpresa) + Dim AppNombre As String = String.Format("GlobalDTAcumGarantiasMesesTipoUso-{0}", CveEmpresa) Application(AppNombre) = value End Set End Property @@ -5132,20 +5135,55 @@ Public Class ClsPaginas 'limpio ReportViwer Dim sw As New System.Diagnostics.Stopwatch() sw.Start() + 'Dim Bytes As Byte() = Nothing + 'Try + ' Dim fllreport As New ADSReportLib.FullTrustReportviewer() + ' fllreport.Initialize("DisplayName", RutaReporte, Parametros, New List(Of String()), True) + ' For Each RDS As ReportDataSource In DataSource + ' fllreport.AddDataSources(RDS) + ' Next + ' 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 = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) + ' fllreport = Nothing + '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 + + If IsNothing(MR) Then MR = New ReportViewer Dim Bytes As Byte() = Nothing Try - Dim fllreport As New ADSReportLib.FullTrustReportviewer() - fllreport.Initialize("DisplayName", RutaReporte, Parametros, New List(Of String()), True) + For Each RDS As ReportDataSource In DataSource - fllreport.AddDataSources(RDS) + MR.LocalReport.DataSources.Add(RDS) Next + 'Dim permissions As New Security.PermissionSet(Security.Permissions.PermissionState.None) + 'permissions.AddPermission(New Security.Permissions.FileIOPermission(Security.Permissions.PermissionState.Unrestricted)) + 'permissions.AddPermission(New Security.Permissions.SecurityPermission(Security.Permissions.SecurityPermissionFlag.Execution)) + 'MR.LocalReport.SetBasePermissionsForSandboxAppDomain(permissions) + + 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 = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) + 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 @@ -5155,6 +5193,8 @@ Public Class ClsPaginas '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 + MR.LocalReport.ReleaseSandboxAppDomain() + MR.Dispose() sw.Stop() If sw.Elapsed.TotalSeconds > 10 Then @@ -5285,7 +5325,7 @@ Public Class ClsPaginas Public Function ImprimirPDFPyME(RutaReporte As String, DataSource As DataSet, Parametros As List(Of CrystalParametro), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As StiReport = Nothing) As Byte() - If IsNothing(MR) Then MR = New StiReport() + If IsNothing(MR) Then MR = New Stimulsoft.Report.StiReport() Dim Bytes As Byte() = Nothing Try MR.Load(RutaReporte) @@ -5301,15 +5341,19 @@ Public Class ClsPaginas MR.Dictionary.Synchronize() MR.IsRendered = False MR.Render(False) - Dim pdfSettings As New StiPdfExportSettings() + Dim pdfSettings As New Stimulsoft.Report.Export.StiPdfExportSettings() Dim MemoryStream As New MemoryStream Select Case Formato Case "PDF" - MR.ExportDocument(StiExportFormat.Pdf, MemoryStream, pdfSettings) + MR.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, MemoryStream, pdfSettings) Case "EXCEL" - MR.ExportDocument(StiExportFormat.Excel2007, MemoryStream, pdfSettings) + MR.ExportDocument(Stimulsoft.Report.StiExportFormat.Excel2007, MemoryStream, pdfSettings) End Select + Bytes = MemoryStream.ToArray + MR.RenderedPages.Clear() + MR.Dispose() + MemoryStream.Dispose() 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 diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 0ea14cbaa..906c5d144 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -1464,7 +1464,7 @@ + DataKeyNames="CantidadF,FolioREQ,CveProveedorSucursal,PS,CantidadPendienteVincular,IEPSPS,IVA,RetIVA,RetISR,Descuento,IVAPorcentaje,RetIVAPorcentaje,RetISRPorcentaje,IEPSPSPorcentaje,IEPSPSIVAPorcentaje,Cantidad,CveProveedorOC"> @@ -1480,7 +1480,7 @@ - + @@ -1518,7 +1518,7 @@ <%----%> - + @@ -2804,9 +2804,9 @@ - - - + + + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index e510c7b5d..afb2a7464 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -14802,14 +14802,14 @@ Partial Class Compras_Compras End Sub Private Sub CargaVinculacionOC(Optional CargaInicial As Boolean = False) 'FILTRAMOS SOLO PENDIENTES POR SURTIR - DTOCGV = DTOCTemp.FiltraParametros("CantidadDisponible > 0", "CveOrdenCompra").Copy + DTOCGV = DTOCTemp.FiltraParametros("CantidadPendienteVincular > 0", "CveOrdenCompra").Copy 'SI PUEDE RECIBIR POR OC Y COMPRA If UsuarioActual.CveEmpresa.Contiene(119) Then If UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 And Not UsuarioActual.Empresa.Funcionalidad(153).ToEntero > 0 Then Select Case DdlOCVinculaInv.SelectedValue.ToEntero Case 176 - DTOCGV = DTOCGV.FiltraParametros("((EstatusInventario IN (3,5) AND CveTipoPS = 2) OR CveTipoPS = 1) AND CantidadPorAdelantado > 0") + DTOCGV = DTOCGV.FiltraParametros("((EstatusInventario IN (3,5) AND CveTipoPS = 2) OR CveTipoPS = 1)") Case 205 DTOCGV = DTOCGV.FiltraParametros("(EstatusInventario IN (1,2) AND CveTipoPS = 2) OR CveTipoPS = 1") End Select @@ -14878,7 +14878,7 @@ Partial Class Compras_Compras Dim Cont As Integer = 0 For Each gvr As GridViewRow In GvOC1.Rows - RegistraScript($"CalculaTotalOCEdit('{gvr.DataKey("PS").Replace("'", "")}', {gvr.DataKey("CantidadDisponible").ToString.ToDouble}, {gvr.FCTextBox("TxtCantidad").ClientID}, {gvr.FCTextBox("TxtPU").ClientID}, {gvr.FCTextBox("TxtTotalOC1").ClientID}, {gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {gvr.DataKey("IVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IVA").ClientID},{gvr.DataKey("RetIVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetIVA").ClientID},{gvr.DataKey("RetISR").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetISR").ClientID},{gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSIVA").ClientID},{gvr.DataKey("Descuento")},{gvr.FCHiddenField("HdnOC1Descuento").ClientID},{gvr.DataKey("IVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetIVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetISRPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSIVAPorcentaje").ToString.ToDouble});", $"Gv{Cont}") + RegistraScript($"CalculaTotalOCEdit('{gvr.DataKey("PS").Replace("'", "")}', {gvr.DataKey("CantidadPendienteVincular").ToString.ToDouble}, {gvr.FCTextBox("TxtCantidad").ClientID}, {gvr.FCTextBox("TxtPU").ClientID}, {gvr.FCTextBox("TxtTotalOC1").ClientID}, {gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {gvr.DataKey("IVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IVA").ClientID},{gvr.DataKey("RetIVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetIVA").ClientID},{gvr.DataKey("RetISR").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetISR").ClientID},{gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSIVA").ClientID},{gvr.DataKey("Descuento")},{gvr.FCHiddenField("HdnOC1Descuento").ClientID},{gvr.DataKey("IVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetIVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetISRPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSIVAPorcentaje").ToString.ToDouble});", $"Gv{Cont}") Cont += 1 Next @@ -14894,8 +14894,8 @@ Partial Class Compras_Compras Protected Sub GvOC1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvOC1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - Dim JSCambiaScript = $"CalculaTotalOCEdit('{e.Row.DBCampo("PS").Replace("'", "")}', {e.Row.DBCampo("CantidadDisponible").ToString.ToDouble}, {e.Row.FCTextBox("TxtCantidad").ClientID}, {e.Row.FCTextBox("TxtPU").ClientID}, {e.Row.FCTextBox("TxtTotalOC1").ClientID}, {e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {e.Row.DBCampo("IVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IVA").ClientID},{e.Row.DBCampo("RetIVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetIVA").ClientID},{e.Row.DBCampo("RetISR").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetISR").ClientID},{e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSIVA").ClientID},{e.Row.DBCampo("Descuento")},{e.Row.FCHiddenField("HdnOC1Descuento").ClientID},{e.Row.DBCampo("IVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetIVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetISRPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSIVAPorcentaje").ToString.ToDouble});" - e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", $"LimitaCantidadOC({e.Row.DBCampo("CantidadDisponible")}, this);{JSCambiaScript}") + Dim JSCambiaScript = $"CalculaTotalOCEdit('{e.Row.DBCampo("PS").Replace("'", "")}', {e.Row.DBCampo("CantidadPendienteVincular").ToString.ToDouble}, {e.Row.FCTextBox("TxtCantidad").ClientID}, {e.Row.FCTextBox("TxtPU").ClientID}, {e.Row.FCTextBox("TxtTotalOC1").ClientID}, {e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {e.Row.DBCampo("IVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IVA").ClientID},{e.Row.DBCampo("RetIVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetIVA").ClientID},{e.Row.DBCampo("RetISR").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetISR").ClientID},{e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSIVA").ClientID},{e.Row.DBCampo("Descuento")},{e.Row.FCHiddenField("HdnOC1Descuento").ClientID},{e.Row.DBCampo("IVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetIVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetISRPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSIVAPorcentaje").ToString.ToDouble});" + e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", $"LimitaCantidadOC({e.Row.DBCampo("CantidadPendienteVincular")}, this);{JSCambiaScript}") e.Row.FCTextBox("TxtPU").Attributes.Add("onkeyup", JSCambiaScript) e.Row.FCTextBox("TxtCantidad").Attributes.Add("onblur", $"ValidaImporteCero('{e.Row.DBCampo("PS").Replace("'", "")}',{e.Row.FCTextBox("TxtCantidad").ClientID}, {e.Row.FCTextBox("TxtPU").ClientID});") @@ -15207,7 +15207,7 @@ Partial Class Compras_Compras TmpDT.Rows(Index)("TipoAF") = 1 End If 'actualizo los movimientos registrados - DTOCGV.Rows(gvr.RowIndex)("CantidadDisponible") = Cantidad + DTOCGV.Rows(gvr.RowIndex)("CantidadPendienteVincular") = Cantidad DTOCGV.Rows(gvr.RowIndex)("Importe") = PU DTOCGV.Rows(gvr.RowIndex)("Total") = Total @@ -15467,7 +15467,7 @@ Partial Class Compras_Compras TmpDT.Rows(IndexVinculacionOC)("TipoAF") = 1 End If 'actualizo los movimientos registrados - DTOCGV.Rows(gvr.RowIndex)("CantidadDisponible") = Cantidad + DTOCGV.Rows(gvr.RowIndex)("CantidadPendienteVincular") = Cantidad DTOCGV.Rows(gvr.RowIndex)("Importe") = PU DTOCGV.Rows(gvr.RowIndex)("Total") = Total End Sub