diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 64ee112a5..ae2a6e5ca 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -435,7 +435,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim P As New ClsCompProveedores - If P.GetProveedorClasificacion(UsuarioActual.CveEmpresa) Then Application(AppNombre) = P.DtResultados + If P.GetProveedorClasificacion(CveEmpresa) Then Application(AppNombre) = P.DtResultados P.Dispose() End If @@ -449,8 +449,9 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProveedorClasificacion{0}", CveEmpresa) - Application(AppNombre) = value + 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 @@ -459,7 +460,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim P As New ClsCompProveedores - If P.GetSucursales(-1, UsuarioActual.CveEmpresa) Then Application(AppNombre) = P.DtResultados + If P.GetSucursales(-1, CveEmpresa) Then Application(AppNombre) = P.DtResultados P.Dispose() End If @@ -473,8 +474,9 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales{0}", CveEmpresa) - Application(AppNombre) = value + Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales{0}", CveEmpresa) + Application(AppNombre) = value + End Set End Property Property GlobalDTRoles(CveEmpresa As Integer) As DataTable @@ -755,37 +757,36 @@ Public Class ClsPaginas Application("GlobalDTSATUsosCFDI") = value End Set End Property - Public Shared Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + Public Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida{0}", CveEmpresa) 'sino existe, recarga los datos - If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + 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() - If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjUnidadesMedida.DtResultados Else HttpContext.Current.Application(AppNombre) = Nothing - 'If ObjUnidadesMedida.GetUnidadesMedidaAlias() Then Application("GlobalDTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados Else Application("GlobalDTUnidadesMedidaAlias") = Nothing + If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados ObjUnidadesMedida.Dispose() End If If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) GlobalDTUnidadesMedida = Dv.ToTable Dv.Dispose() Else - GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + GlobalDTUnidadesMedida = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value + 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) 'sino existe, recarga los datos - If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + 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() - If ObjUnidadesMedida.GetUnidadesMedidaAlias(CveEmpresa, -1) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados Else Application(AppNombre) = Nothing + If ObjUnidadesMedida.GetUnidadesMedidaAlias(CveEmpresa, -1) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados ObjUnidadesMedida.Dispose() End If If CveEmpresa <> -1 Then @@ -797,8 +798,11 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedidaAlias{0}", CveEmpresa) - Application(AppNombre) = value + 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 + 'ObjUnidadesMedida.Dispose() End Set End Property Property GlobalDTEstatusOrdenCompra() As DataTable @@ -879,20 +883,18 @@ Public Class ClsPaginas Application("GlobalDTProyectos") = value End Set End Property - Public Shared Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + 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) 'sino existe, recarga los datos - If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + 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 - If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then - HttpContext.Current.Application(AppNombre) = P.DtResultados - End If + If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = P.DtResultados P.Dispose() Dim msg As String = "aqui no se carga subproyectos" - If HttpContext.Current.Request IsNot Nothing Then - msg = msg & HttpContext.Current.Request.ServerVariables("URL") + If Request IsNot Nothing Then + msg = msg & Request.ServerVariables("URL") End If msg.GuardaLog() @@ -905,26 +907,18 @@ Public Class ClsPaginas If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) GlobalDTSubProyectos = Dv.ToTable Dv.Dispose() Else - GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + GlobalDTSubProyectos = DirectCast(Application(AppNombre), DataTable) End If End Get Set(ByVal value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) - If value Is Nothing OrElse value.Rows.Count = 0 Then - Dim msg As String = "aqui no se carga subproyectos" - If HttpContext.Current.Request IsNot Nothing Then - msg = msg & HttpContext.Current.Request.ServerVariables("URL") - End If - msg.GuardaLog() - - End If - HttpContext.Current.Application(AppNombre) = value + 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 @@ -1179,20 +1173,20 @@ Public Class ClsPaginas ObjPS.Dispose() End Get End Property - Public Shared 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) As DataTable + 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) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa) If CveEmpresa <> -1 Then 'sino existe, recarga los datos - If HttpContext.Current.Application(AppNombre) Is Nothing Then + If Application(AppNombre) Is Nothing Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSimplificado(-1) Then HttpContext.Current.Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() Else HttpContext.Current.Application("GlobalDTPSSimplificado") = Nothing + If ObjPS.GetPSSimplificado(CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() ObjPS.Dispose() End If - Dim Cons = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)) + Dim Cons = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)) Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) @@ -1207,12 +1201,12 @@ Public Class ClsPaginas End Try Else - GlobalDTPSSimplificado = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable + GlobalDTPSSimplificado = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value + 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 @@ -1221,9 +1215,8 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSAlias(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados Else Application(AppNombre) = Nothing + If ObjPS.GetPSAlias(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados ObjPS.Dispose() - End If @@ -1241,20 +1234,19 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias{0}", CveEmpresa) - Application(AppNombre) = value + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property - Public Shared Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable + Public Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) If CveEmpresa <> -1 Then 'sino existe, recarga los datos - If HttpContext.Current.Application(AppNombre) Is Nothing Then + If Application(AppNombre) Is Nothing Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSEquivalencias(-1, CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjPS.DtResultados Else HttpContext.Current.Application(AppNombre) = Nothing - ObjPS.Dispose() - + If ObjPS.GetPSEquivalencias(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados + ObjPS.Dispose() End If End If @@ -1264,16 +1256,17 @@ Public Class ClsPaginas If CveUM <> -1 Then StrSQL.AppendFormat(" AND CveUM = {0}", CveUM) If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) GlobalDTProductosServiciosEquivalencias = Dv.ToTable Dv.Dispose() Else - GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + GlobalDTProductosServiciosEquivalencias = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) + Application(AppNombre) = value + End Set End Property Property GlobalDTProductosServiciosCaracteristicas(CveEmpresa As Integer) As DataTable @@ -1299,7 +1292,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSAdicionales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados Else Application(AppNombre) = Nothing + If ObjPS.GetPSAdicionales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados ObjPS.Dispose() End If @@ -1317,8 +1310,9 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTPSAdicionales{0}", CveEmpresa) - Application(AppNombre) = value + Dim AppNombre As String = String.Format("GlobalDTPSAdicionales{0}", CveEmpresa) + Application(AppNombre) = value + End Set End Property Property GlobalDTProductosServiciosCaracteristicasOpciones(CveEmpresa As Integer) As DataTable @@ -1374,7 +1368,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSImpuestosLocales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados Else Application(AppNombre) = Nothing + If ObjPS.GetPSImpuestosLocales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados ObjPS.Dispose() End If @@ -1391,8 +1385,11 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTImpuestosLocales{0}", CveEmpresa) - Application(AppNombre) = value + 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 + 'ObjPS.Dispose() End Set End Property 'Bancos @@ -1516,7 +1513,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjClientes As New ClsClientes - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus:=-1) Then Application(AppNombre) = ObjClientes.DtResultados Else Application(AppNombre) = Nothing + If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then Application(AppNombre) = ObjClientes.DtResultados ObjClientes.Dispose() End If @@ -1536,8 +1533,8 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) - Application(AppNombre) = value + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTClienteClasificaciones(CveEmpresa As Integer) As DataTable @@ -1546,7 +1543,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjClientes As New ClsClientes - If ObjClientes.GetClienteClasificacion(UsuarioActual.CveEmpresa) Then Application(AppNombre) = ObjClientes.DtResultados Else Application(AppNombre) = Nothing + If ObjClientes.GetClienteClasificacion(CveEmpresa) Then Application(AppNombre) = ObjClientes.DtResultados ObjClientes.Dispose() End If If CveEmpresa <> -1 Then @@ -1559,8 +1556,8 @@ Public Class ClsPaginas End If End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) - Application(AppNombre) = value + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTEstatusOrdenServicios(CveEmpresa As Integer) As DataTable @@ -1580,16 +1577,24 @@ 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) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjVendedores As New ClsVtaVendedores + If ObjVendedores.GetVendedores(-1) Then Application(AppNombre) = ObjVendedores.DtResultados + ObjVendedores.Dispose() + End If If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTVendedores"), DataTable), String.Format("CveEmpresa = {0} AND CveEstatus = {1} AND VendedorTipo = {2}", CveEmpresa, If(Estatus, 1, 0), VendedorTipo), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0} AND CveEstatus = {1} AND VendedorTipo = {2}", CveEmpresa, If(Estatus, 1, 0), VendedorTipo), "", DataViewRowState.CurrentRows) GlobalDTVendedores = Dv.ToTable Dv.Dispose() Else - GlobalDTVendedores = DirectCast(Application("GlobalDTVendedores"), DataTable) + GlobalDTVendedores = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTVendedores") = value + Dim AppNombre As String = String.Format("GlobalDTVendedores{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTClientesCorporativo(CveEmpresa As Integer) As DataTable @@ -1612,7 +1617,7 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjProveedores As New ClsCompProveedores - If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then Application(AppNombre) = ObjProveedores.DtResultados Else Application(AppNombre) = Nothing + If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then Application(AppNombre) = ObjProveedores.DtResultados ObjProveedores.Dispose() End If @@ -1626,8 +1631,11 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTCompProveedores{0}", CveEmpresa) - Application(AppNombre) = value + 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 + 'ObjProveedores.Dispose() End Set End Property 'EstatusFactura @@ -3228,7 +3236,36 @@ Public Class ClsPaginas Set(value As DataTable) Application("GlobalDTAcumTiposUso") = value End Set - End Property + End Property + + Property GlobalDTAcumGarantiasMesesTipoUso(CveEmpresa As Integer, CveMarca As Integer) As DataTable + Get + 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"}) + ObjAcumuladores.Dispose() + End If + + If CveMarca <> -1 Then + Dim Str As StringBuilder = New StringBuilder() + If CveMarca <> -1 Then Str.AppendFormat("CveMarca = {0}", CveMarca) + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTAcumGarantiasMesesTipoUso = Dv.ToTable + Dv.Dispose() + Else + GlobalDTAcumGarantiasMesesTipoUso = DirectCast(Application(AppNombre), DataTable) + End If + + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTAcumGarantiasMesesTipoUso{0}", CveEmpresa) + Application(AppNombre) = value + End Set + End Property + + Property GlobalDTAcumTamaños() As DataTable Get GlobalDTAcumTamaños = DirectCast(Application("GlobalDTAcumTamaños"), DataTable) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index c5e33a480..52038c7cd 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2630,7 +2630,7 @@ Namespace Modelos importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador) importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, ClsPaginas.GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" + Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas @@ -2705,7 +2705,7 @@ Namespace Modelos importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador) importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, ClsPaginas.GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" + Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas @@ -3204,7 +3204,7 @@ Namespace Modelos If UsuarioActual.CveEmpresa = 1 Then DtEquivalencias = New DataTable - DtEquivalencias = ClsPaginas.GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa) + DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa) Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'") @@ -5446,11 +5446,11 @@ Namespace Modelos Public Sub SetSubProyecto() If CveSubProyecto > 0 Then - SubProyecto = New Modelos.SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) + SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) End If End Sub Public Sub SetSubProyectoMatriz() - Dim Row As Data.DataRow = ClsPaginas.GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") + Dim Row As Data.DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") If Not IsNothing(Row) Then SubProyectoMatriz = New Modelos.SubProyectoModel(Row) End If @@ -5496,12 +5496,12 @@ Namespace Modelos End Sub Public Sub SetSubProyecto(obj As ClsPaginas) If CveSubProyecto > 0 AndAlso Not IsNothing(obj) Then - SubProyecto = New Modelos.SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) + SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) End If End Sub Public Sub SetSubProyectoMatriz(obj As ClsPaginas) If Not IsNothing(obj) Then - Dim Row As Data.DataRow = ClsPaginas.GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=obj.UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") + Dim Row As Data.DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=obj.UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") If Not IsNothing(Row) Then SubProyectoMatriz = New Modelos.SubProyectoModel(Row) End If @@ -5937,6 +5937,27 @@ Namespace Modelos HttpContext.Current.Application("GlobalDTProveedoresCuentas") = value End Set End Property + + Public ReadOnly Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) + + + If CvePS <> -1 OrElse CveUM <> -1 Then + Dim StrSQL As New StringBuilder + If CvePS <> -1 Then StrSQL.AppendFormat(" AND CvePS = {0}", CvePS) + If CveUM <> -1 Then StrSQL.AppendFormat(" AND CveUM = {0}", CveUM) + If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + GlobalDTProductosServiciosEquivalencias = Dv.ToTable + Dv.Dispose() + Else + GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + End Get + + End Property Property GlobalDTProveedorClasificacion(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then @@ -6245,34 +6266,34 @@ Namespace Modelos HttpContext.Current.Application("GlobalDTSATUsosCFDI") = value End Set End Property - Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedida = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTUnidadesMedida") = value - End Set - End Property - Property GlobalDTUnidadesMedidaAlias(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedidaAlias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedidaAlias = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias") = value - End Set - End Property + 'Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + ' Get + ' If CveEmpresa <> -1 Then + ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + ' GlobalDTUnidadesMedida = Dv.ToTable + ' Dv.Dispose() + ' Else + ' GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable) + ' End If + ' End Get + ' Set(value As DataTable) + ' HttpContext.Current.Application("GlobalDTUnidadesMedida") = value + ' End Set + 'End Property + 'Property GlobalDTUnidadesMedidaAlias(Optional CveEmpresa As Integer = -1) As DataTable + ' Get + ' If CveEmpresa <> -1 Then + ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + ' GlobalDTUnidadesMedidaAlias = Dv.ToTable + ' Dv.Dispose() + ' Else + ' GlobalDTUnidadesMedidaAlias = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable) + ' End If + ' End Get + ' Set(value As DataTable) + ' HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias") = value + ' End Set + 'End Property Property GlobalDTEstatusOrdenCompra() As DataTable Get GlobalDTEstatusOrdenCompra = DirectCast(HttpContext.Current.Application("GlobalDTEstatusOrdenCompra"), DataTable) @@ -6341,6 +6362,45 @@ Namespace Modelos End Set 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) + 'sino existe, recarga los datos + If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim P As New ClsSubProyectos + If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then HttpContext.Current.Application(AppNombre) = P.DtResultados + P.Dispose() + + Dim msg As String = "aqui no se carga subproyectos" + If HttpContext.Current.Request IsNot Nothing Then + msg = msg & HttpContext.Current.Request.ServerVariables("URL") + End If + msg.GuardaLog() + + End If + + If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then + Dim StrSQL As New StringBuilder + If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) + If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) + If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) + If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + GlobalDTSubProyectos = Dv.ToTable + Dv.Dispose() + + Else + GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + + End Get + Set(ByVal value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) + HttpContext.Current.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 @@ -6698,51 +6758,64 @@ Namespace Modelos 'Fin Ruta 'Cliente - Property GlobalDTCliente(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim StrSQL As New StringBuilder - StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If Estatus >= 0 Then StrSQL.AppendFormat(" AND EstatusBool = {0} ", Estatus) - - If HttpContext.Current.Application("GlobalDTCliente") Is Nothing Then - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then HttpContext.Current.Application("GlobalDTCliente") = ObjClientes.DtResultados Else HttpContext.Current.Application("GlobalDTCliente") = Nothing - ObjClientes.Dispose() - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCliente"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCliente = Dv.ToTable - Dv.Dispose() - - Else - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCliente"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCliente = Dv.ToTable - Dv.Dispose() - End If - - Else - GlobalDTCliente = DirectCast(HttpContext.Current.Application("GlobalDTCliente"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCliente") = value - End Set - End Property - Property GlobalDTClienteClasificaciones(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClienteClasificaciones"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTClienteClasificaciones = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClienteClasificaciones = DirectCast(HttpContext.Current.Application("GlobalDTClienteClasificaciones"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificacionesCliente") = value - End Set + Property GlobalDTCliente(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados + ObjClientes.Dispose() + End If + + + If CveEmpresa <> -1 Then + + Dim StrSQL As New StringBuilder + StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) + If Estatus >= 0 Then StrSQL.AppendFormat(" AND EstatusBool = {0} ", Estatus) + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) + GlobalDTCliente = Dv.ToTable + Dv.Dispose() + + Else + GlobalDTCliente = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + 'Dim ObjClientes As New ClsClientes + 'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then Application(AppNombre) = ObjClientes.DtResultados + 'ObjClientes.Dispose() + End Set + End Property + Property GlobalDTClienteClasificaciones(CveEmpresa As Integer) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClienteClasificacion(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados + ObjClientes.Dispose() + End If + If CveEmpresa <> -1 Then + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + GlobalDTClienteClasificaciones = Dv.ToTable + Dv.Dispose() + Else + GlobalDTClienteClasificaciones = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + 'Dim ObjClientes As New ClsClientes + 'If ObjClientes.GetClienteClasificacion(CveEmpresa) Then Application(AppNombre) = ObjClientes.DtResultados + 'ObjClientes.Dispose() + End Set End Property Property GlobalDTEstatusOrdenServicios(CveEmpresa As Integer) As DataTable Get diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index dbb113a45..eb476418f 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -356,13 +356,15 @@ Public Class Timbrado Else conector.EstableceCredenciales("vSGxMFWnNRy/nDoowxqrqw==|Sia123654") End If - + MsgCancelacion.AppendFormat("-3.2") Dim resultadoCancelacion As Profact.TimbraCFDI.ResultadoCancelacionAck resultadoCancelacion = conector.CancelaCFDIAck(RFCEmisor, FolioFiscal) CancelacionFecha = Now Dim resp As Profact.TimbraCFDI.ResultadoConsulta resp = conector.ObtieneCFDI(RFCEmisor, FolioFiscal) + MsgCancelacion.AppendFormat("-3.3") If resultadoCancelacion.Exitoso Then + MsgCancelacion.AppendFormat("-3.4") CancelacionMensaje = resultadoCancelacion.Descripcion Dim xmlDoc As New System.Xml.XmlDocument() @@ -372,20 +374,22 @@ Public Class Timbrado xmlDoc.LoadXml(resp.Xml) End Try - + MsgCancelacion.AppendFormat("-3.4.1") Dim xpath As String = "Acuse/Folios" Dim nodes = xmlDoc.SelectNodes(xpath) CancelacionState = xmlDoc.GetElementsByTagName("EstatusUUID")(0).InnerText.ToEntero - + MsgCancelacion.AppendFormat("-3.4.2") xpath = "Acuse/Signature" nodes = xmlDoc.SelectNodes(xpath) - + MsgCancelacion.AppendFormat("-3.4.3") CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate Retorno = True Else + MsgCancelacion.AppendFormat("-3.5") CancelacionAcuse = resp.NumeroError + CancelacionMensaje = resultadoCancelacion.Xml Retorno = False End If diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 1aa05cd8a..9832061b6 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -50,10 +50,10 @@ Namespace Extensiones Public Function CadenaConexion() As String Dim BaseDatos As String = "Ventas" - If Not IsNothing(System.Web.HttpContext.Current) AndAlso Not IsNothing(System.Web.HttpContext.Current.Session) Then + 'If Not IsNothing(System.Web.HttpContext.Current) AndAlso Not IsNothing(System.Web.HttpContext.Current.Session) Then - BaseDatos = CType(System.Web.HttpContext.Current.Session("UsuarioSIG"), Usuario).Empresa.BaseDatosNombre - End If + ' BaseDatos = CType(System.Web.HttpContext.Current.Session("UsuarioSIG"), Usuario).Empresa.BaseDatosNombre + 'End If Return String.Format("Data Source=192.168.0.2;Initial Catalog={0};User Id=JCaudillo;Password=JCau127*953;pooling=True; Min Pool Size=10;Application Name=SIG;", BaseDatos) diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index 97adc819d..8a81cd9fa 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -1562,34 +1562,34 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState HttpContext.Current.Application("GlobalDTSATUsosCFDI") = value End Set End Property - Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedida = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTUnidadesMedida") = value - End Set - End Property - Property GlobalDTUnidadesMedidaAlias(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedidaAlias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedidaAlias = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias") = value - End Set - End Property + 'Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + ' Get + ' If CveEmpresa <> -1 Then + ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + ' GlobalDTUnidadesMedida = Dv.ToTable + ' Dv.Dispose() + ' Else + ' GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedida"), DataTable) + ' End If + ' End Get + ' Set(value As DataTable) + ' HttpContext.Current.Application("GlobalDTUnidadesMedida") = value + ' End Set + 'End Property + 'Property GlobalDTUnidadesMedidaAlias(Optional CveEmpresa As Integer = -1) As DataTable + ' Get + ' If CveEmpresa <> -1 Then + ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + ' GlobalDTUnidadesMedidaAlias = Dv.ToTable + ' Dv.Dispose() + ' Else + ' GlobalDTUnidadesMedidaAlias = DirectCast(HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias"), DataTable) + ' End If + ' End Get + ' Set(value As DataTable) + ' HttpContext.Current.Application("GlobalDTUnidadesMedidaAlias") = value + ' End Set + 'End Property Property GlobalDTEstatusOrdenCompra() As DataTable Get GlobalDTEstatusOrdenCompra = DirectCast(HttpContext.Current.Application("GlobalDTEstatusOrdenCompra"), DataTable) @@ -1657,44 +1657,44 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState HttpContext.Current.Application("GlobalDTProyectos") = value End Set End Property - Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - Get + 'Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + ' Get - If DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then - Dim P As New ClsSubProyectos - If P.GetSubProyectos Then - HttpContext.Current.Application("GlobalDTSubProyectos") = P.DtResultados - End If - P.Dispose() + ' If DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then + ' Dim P As New ClsSubProyectos + ' If P.GetSubProyectos Then + ' HttpContext.Current.Application("GlobalDTSubProyectos") = P.DtResultados + ' End If + ' P.Dispose() - Dim msg As String = "aqui no se carga subproyectos" + ' Dim msg As String = "aqui no se carga subproyectos" - End If + ' End If - If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + ' If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then + ' Dim StrSQL As New StringBuilder + ' If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) + ' If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) + ' If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) + ' If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTSubProyectos = Dv.ToTable - Dv.Dispose() + ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + ' GlobalDTSubProyectos = Dv.ToTable + ' Dv.Dispose() - Else - GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) - End If + ' Else + ' GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) + ' End If - End Get - Set(ByVal value As DataTable) - If value Is Nothing OrElse value.Rows.Count = 0 Then - Dim msg As String = "aqui no se carga subproyectos" + ' End Get + ' Set(ByVal value As DataTable) + ' If value Is Nothing OrElse value.Rows.Count = 0 Then + ' Dim msg As String = "aqui no se carga subproyectos" - End If - HttpContext.Current.Application("GlobalDTSubProyectos") = value - End Set - End Property + ' End If + ' HttpContext.Current.Application("GlobalDTSubProyectos") = 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 @@ -2085,48 +2085,61 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState 'Cliente Property GlobalDTCliente(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados + ObjClientes.Dispose() + End If + + If CveEmpresa <> -1 Then Dim StrSQL As New StringBuilder StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) If Estatus >= 0 Then StrSQL.AppendFormat(" AND EstatusBool = {0} ", Estatus) - If HttpContext.Current.Application("GlobalDTCliente") Is Nothing Then - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then HttpContext.Current.Application("GlobalDTCliente") = ObjClientes.DtResultados Else HttpContext.Current.Application("GlobalDTCliente") = Nothing - ObjClientes.Dispose() - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCliente"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCliente = Dv.ToTable - Dv.Dispose() - - Else - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTCliente"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCliente = Dv.ToTable - Dv.Dispose() - End If + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) + GlobalDTCliente = Dv.ToTable + Dv.Dispose() Else - GlobalDTCliente = DirectCast(HttpContext.Current.Application("GlobalDTCliente"), DataTable) + GlobalDTCliente = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - HttpContext.Current.Application("GlobalDTCliente") = value + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + 'Dim ObjClientes As New ClsClientes + 'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then Application(AppNombre) = ObjClientes.DtResultados + 'ObjClientes.Dispose() End Set End Property Property GlobalDTClienteClasificaciones(CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClienteClasificacion(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados + ObjClientes.Dispose() + End If If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTClienteClasificaciones"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) GlobalDTClienteClasificaciones = Dv.ToTable Dv.Dispose() Else - GlobalDTClienteClasificaciones = DirectCast(HttpContext.Current.Application("GlobalDTClienteClasificaciones"), DataTable) + GlobalDTClienteClasificaciones = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - HttpContext.Current.Application("GlobalDTClasificacionesCliente") = value + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + 'Dim ObjClientes As New ClsClientes + 'If ObjClientes.GetClienteClasificacion(CveEmpresa) Then Application(AppNombre) = ObjClientes.DtResultados + 'ObjClientes.Dispose() End Set End Property Property GlobalDTEstatusOrdenServicios(CveEmpresa As Integer) As DataTable diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 0dc50dcd3..b24cd113d 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -182,22 +182,38 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState context.Response.Write("") Else CveEmpresa = usuario.CveEmpresa - Dim Name = IfNull(context.Request("Name"), "-1").ToString - Dim dt As DataTable = DirectCast(context.Application("GlobalDTCliente"), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") - If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - DtRetorno = dt.FiltraParametros($"NombreComercial like '%{Name}%'") - End If - End If - - If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then - DtRetorno.Columns("CveCliente").ColumnName = "id" - DtRetorno.Columns("NombreComercial").ColumnName = "text" - retorno = JsonConvert.SerializeObject(DtRetorno).ToString - context.Response.Write(retorno) - Else - context.Response.Write("[]") - End If - + Dim Name = IfNull(context.Request("Name"), "-1").ToString + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + 'sino existe, recarga los datos + If context.Application(AppNombre) Is Nothing Then + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then + context.Application(AppNombre) = ObjClientes.DtResultados + End If + ObjClientes.Dispose() + End If + + 'Dim ObjClientes As New ClsClientes + 'If ObjClientes.GetClientes(-1, Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then + ' DtRetorno = ObjClientes.DtResultados + 'End If + 'ObjClientes.Dispose() + + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") + If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then + DtRetorno = dt.FiltraParametros($"NombreComercial like '%{Name}%'") + End If + End If + + If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then + DtRetorno.Columns("CveCliente").ColumnName = "id" + DtRetorno.Columns("NombreComercial").ColumnName = "text" + retorno = JsonConvert.SerializeObject(DtRetorno).ToString + context.Response.Write(retorno) + Else + context.Response.Write("[]") + End If + Return retorno End Function #End Region @@ -213,22 +229,37 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState context.Response.Write("") Else CveEmpresa = usuario.CveEmpresa - Dim Name = IfNull(context.Request("Name"), "-1").ToString - Dim dt As DataTable = DirectCast(context.Application("GlobalDTCompProveedores"), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") - If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - DtRetorno = dt.FiltraParametros($"RazonSocial like '%{Name}%'") - End If - End If - - If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then - DtRetorno.Columns("CveProveedor").ColumnName = "id" - DtRetorno.Columns("RazonSocial").ColumnName = "text" - retorno = JsonConvert.SerializeObject(DtRetorno).ToString - context.Response.Write(retorno) - Else - context.Response.Write("[]") - End If - + Dim Name = IfNull(context.Request("Name"), "-1").ToString + Dim AppNombre As String = String.Format("GlobalDTCompProveedores{0}", CveEmpresa) + 'sino existe, recarga los datos + If context.Application(AppNombre) Is Nothing Then + Dim ObjProveedores As New ClsCompProveedores + If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then + context.Application(AppNombre) = ObjProveedores.DtResultados + End If + ObjProveedores.Dispose() + End If + + 'Dim ObjProveedores As New ClsCompProveedores + 'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then + ' DtRetorno = ObjProveedores.DtResultados + 'End If + 'ObjProveedores.Dispose() + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") + If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then + DtRetorno = dt.FiltraParametros($"RazonSocial like '%{Name}%'") + End If + End If + + If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then + DtRetorno.Columns("CveProveedor").ColumnName = "id" + DtRetorno.Columns("RazonSocial").ColumnName = "text" + retorno = JsonConvert.SerializeObject(DtRetorno).ToString + context.Response.Write(retorno) + Else + context.Response.Write("[]") + End If + Return retorno End Function #End Region @@ -345,90 +376,99 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If If UsaGlobal Then + 'se recarga el global, y el clspaginas, son los unicos 2 lugares + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa) + If context.Application(String.Format("GlobalDTPSSimplificado{0}", CveEmpresa)) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSSimplificado(CveEmpresa) Then context.Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() + ObjPS.Dispose() + + End If + + + Dim DTPS = DirectCast(context.Application(AppNombre), EnumerableRowCollection(Of DataRow)) + 'Dim DTPS = ClsPaginas.GlobalDTPSSimplificado(CveEmpresa).AsEnumerable + + If DTPS IsNot Nothing Then + + + 'APLICACION DE FILTROS + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) + If Estatus = 1 Then + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveEstado) = 1)) + ElseIf Estatus = -1 Then + + End If + + 'If FuePorXml >= 0 Then + ' DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!FuePorXML) = FuePorXml)) + 'End If + + If Name <> "-1" Then + If PSCodigoDescripcion = "PSCodigo" Then + DTPS = DTPS.Where((Function(a) a!PSCodigo.ToString.ToLower Like ("*" + Name.ToLower + "*"))) + Else + DTPS = DTPS.Where((Function(a) a!PSCodigoClasificacion.ToString.ToLower Like ("*" + Name.ToLower + "*"))) + End If + End If + + If CveClasificacion > 0 Then + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) + ElseIf CveClasificacion = -1 Then + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveClasificacion) >= 0)) + End If + + If AplicaParaVenta > 0 Then + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = 1)) + End If + + 'If CveSubFamilia > 0 Then + ' DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveSubFamilia) = CveSubFamilia)) + ' 'ElseIf CveSubFamilia = -1 Then + ' 'DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveSubFamilia) > 0)) + 'End If + + If CveClasificacionPresupuesto > 0 Then + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveClasificacionPresupuesto) = CveClasificacionPresupuesto)) + End If + + If UsoClasificacion > 0 Then DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!UsoClasificacion) = UsoClasificacion)) + + If Pagina <> "-1" Then + If Pagina = "Compras" Then + DTPS = DTPS.Where((Function(a) a!CveTipoPS = 1 AndAlso a!CveEstado = 1)) + ElseIf Pagina = "Compras2" Then + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveTipoPS) = 1 AndAlso (Convert.ToInt32(a!CveEstado) = 1 OrElse Convert.ToInt32(a!CveEstado) = 2))) + ElseIf Pagina = "Inventarios" Then + DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveTipoPS) = 2)) + End If + End If + + 'Try, generado para cuando el resultado no tiene valores(The source contains no DataRows.), no detenga la ejecucion, no se le puso un count previo, porque el costo se duplica, al preguntar y luego ordenar y convertir a datatable + Try + DtPSRetorno = New DataView(DTPS.OrderBy(Function(a) a!PSCodigo).CopyToDataTable).ToTable(True, {"CvePS", "PSCodigo", "PSCodigoClasificacion"}) + + Catch ex As Exception + DtPSRetorno = Nothing + End Try + + End If + End If + If DtPSRetorno IsNot Nothing AndAlso DtPSRetorno.Rows.Count > 0 Then + DtPSRetorno.Columns("CvePS").ColumnName = "id" + DtPSRetorno.Columns(PSCodigoDescripcion).ColumnName = "text" + If PSCodigoDescripcion = "PSCodigo" Then + DtPSRetorno.Columns().Remove("PSCodigoClasificacion") + Else + DtPSRetorno.Columns().Remove("PSCodigo") + End If + retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString + context.Response.Write(retorno) + Else + context.Response.Write("[]") + End If + End If - 'Dim DTPS = DirectCast(context.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) - Dim DTPS = ClsPaginas.GlobalDTPSSimplificado(CveEmpresa).AsEnumerable - - If DTPS IsNot Nothing Then - - - 'APLICACION DE FILTROS - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) - If Estatus = 1 Then - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveEstado) = 1)) - ElseIf Estatus = -1 Then - - End If - - 'If FuePorXml >= 0 Then - ' DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!FuePorXML) = FuePorXml)) - 'End If - - If Name <> "-1" Then - If PSCodigoDescripcion = "PSCodigo" Then - DTPS = DTPS.Where((Function(a) a!PSCodigo.ToString.ToLower Like ("*" + Name.ToLower + "*"))) - Else - DTPS = DTPS.Where((Function(a) a!PSCodigoClasificacion.ToString.ToLower Like ("*" + Name.ToLower + "*"))) - End If - End If - - If CveClasificacion > 0 Then - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) - ElseIf CveClasificacion = -1 Then - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveClasificacion) >= 0)) - End If - - If AplicaParaVenta > 0 Then - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = 1)) - End If - - 'If CveSubFamilia > 0 Then - ' DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveSubFamilia) = CveSubFamilia)) - ' 'ElseIf CveSubFamilia = -1 Then - ' 'DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveSubFamilia) > 0)) - 'End If - - If CveClasificacionPresupuesto > 0 Then - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveClasificacionPresupuesto) = CveClasificacionPresupuesto)) - End If - - If UsoClasificacion > 0 Then DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!UsoClasificacion) = UsoClasificacion)) - - If Pagina <> "-1" Then - If Pagina = "Compras" Then - DTPS = DTPS.Where((Function(a) a!CveTipoPS = 1 AndAlso a!CveEstado = 1)) - ElseIf Pagina = "Compras2" Then - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveTipoPS) = 1 AndAlso (Convert.ToInt32(a!CveEstado) = 1 OrElse Convert.ToInt32(a!CveEstado) = 2))) - ElseIf Pagina = "Inventarios" Then - DTPS = DTPS.Where((Function(a) Convert.ToInt32(a!CveTipoPS) = 2)) - End If - End If - - 'Try, generado para cuando el resultado no tiene valores(The source contains no DataRows.), no detenga la ejecucion, no se le puso un count previo, porque el costo se duplica, al preguntar y luego ordenar y convertir a datatable - Try - DtPSRetorno = New DataView(DTPS.OrderBy(Function(a) a!PSCodigo).CopyToDataTable).ToTable(True, {"CvePS", "PSCodigo", "PSCodigoClasificacion"}) - - Catch ex As Exception - DtPSRetorno = Nothing - End Try - - End If - End If - If DtPSRetorno IsNot Nothing AndAlso DtPSRetorno.Rows.Count > 0 Then - DtPSRetorno.Columns("CvePS").ColumnName = "id" - DtPSRetorno.Columns(PSCodigoDescripcion).ColumnName = "text" - If PSCodigoDescripcion = "PSCodigo" Then - DtPSRetorno.Columns().Remove("PSCodigoClasificacion") - Else - DtPSRetorno.Columns().Remove("PSCodigo") - End If - retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString - context.Response.Write(retorno) - Else - context.Response.Write("[]") - End If - End If - Return retorno End Function #End Region @@ -574,17 +614,12 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim CveSucursal = IfNull(context.Request("cvesucursal"), "-1").ToString.ToEntero Dim CveSubProyecto = IfNull(context.Request("cvesubproyecto"), "-1").ToString.ToEntero Dim UsoClasificacion = IfNull(context.Request("usoclasificacion"), "-1").ToString.ToEntero - Dim UsaGlobal As Boolean = True - - - - + Dim UsaGlobal As Boolean = True + + If UsaGlobal Then - - - Dim DTPS = ClsPaginas.GlobalDTPSSimplificado(CveEmpresa).AsEnumerable ' DirectCast(context.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) - + Dim DTPS = DirectCast(context.Application(String.Format("GlobalDTPSSimplificado{0}", CveEmpresa)), EnumerableRowCollection(Of DataRow)) If DTPS IsNot Nothing Then diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 5e5d27d25..c86542405 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -496,7 +496,7 @@ Partial Class Bancos_ProveedoresAbonar ViewState("CveCuentaComplementaria") = ObjProveedor.CveCuentaProveedoresComplementaria If Serie <> "" AndAlso Serie <> "-1" Then - Dim dr As DataRow = GlobalDTProveedorSucursales(CveProveedor).FiltroPrimero(String.Format("Serie = '{0}'", Serie)) + Dim dr As DataRow = GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("Serie = '{0}'", Serie)) If dr IsNot Nothing Then TxtObservaciones.Text = String.Format("Suc. {0}", dr("ProveedorSucursal")) HdnObs.Value = TxtObservaciones.Text diff --git a/Bancos/RepCobradoDetalle.aspx.vb b/Bancos/RepCobradoDetalle.aspx.vb index 049cdeff8..90671a616 100644 --- a/Bancos/RepCobradoDetalle.aspx.vb +++ b/Bancos/RepCobradoDetalle.aspx.vb @@ -112,7 +112,7 @@ Partial Class Ventas_RepRecuperacionDetalle DivProveedores.Visible = True Dim ObjProveedores As New ClsCompProveedores - If ObjProveedores.GetSucursales(CveProveedor) Then + If ObjProveedores.GetSucursales(CveProveedor, UsuarioActual.CveEmpresa) Then If ObjProveedores.DtResultados.Rows.Count > 0 Then DdlProveedorSucursal.DataSource = ObjProveedores.DtResultados End If diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 1137e4f71..6586f85fa 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4140,8 +4140,9 @@ Partial Class Compras_Compras 'si hay necesidad de actualizar el globaldtps If RegeneraPS Then - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) + 'Hilo.Start() + GeneraGlobalDT(Nothing) End If Dim CvePlantillaPrePoliza As Integer @@ -17504,15 +17505,17 @@ Partial Class Compras_Compras End Sub Private Sub RecargaGlobalEquivalencias() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalEquivalencias) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalEquivalencias) + 'Hilo.Start() + GeneraGlobalEquivalencias() End Sub Private Sub GeneraGlobalEquivalencias() - Dim ObjPS = New ClsProductosServicios - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados - End If - ObjPS.Dispose() + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS = New ClsProductosServicios + 'If ObjPS.GetPSEquivalencias(-1, -1) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados + 'End If + 'ObjPS.Dispose() End Sub #End Region @@ -17664,23 +17667,26 @@ Partial Class Compras_Compras End Sub Private Sub RecargaGlobalUM() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalUM) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalUM) + 'Hilo.Start() + GeneraGlobalUM() End Sub - Private Sub GeneraGlobalUM() - Dim ObjPS = New ClsProductosServicios - Dim OjbUM As New ClsUnidadesMedida - - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados - End If - - If OjbUM.GetUnidadesMedidaAlias(-1) Then - GlobalDTUnidadesMedidaAlias = OjbUM.DtResultados - End If - - ObjPS.Dispose() - OjbUM.Dispose() + Private Sub GeneraGlobalUM() + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing + GlobalDTUnidadesMedidaAlias(UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS = New ClsProductosServicios + 'Dim OjbUM As New ClsUnidadesMedida + + 'If ObjPS.GetPSEquivalencias(-1, -1) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados + 'End If + + 'If OjbUM.GetUnidadesMedidaAlias(-1) Then + ' GlobalDTUnidadesMedidaAlias = OjbUM.DtResultados + 'End If + + 'ObjPS.Dispose() + 'OjbUM.Dispose() End Sub #End Region @@ -19068,7 +19074,7 @@ Partial Class Compras_Compras RecargaPSGlobal() End Sub Private Sub RecargaPSGlobal() - GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + 'GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing 'Dim ObjPS As New ClsProductosServicios 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index 389ffd36f..859af37e3 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -1498,7 +1498,7 @@ Partial Class Compras_Proveedores Next End If - If ObjProveedores.GetSucursales(-1) Then Application("GlobalDTProveedorSucursales") = ObjProveedores.DtResultados + GlobalDTProveedorSucursales(-1, UsuarioActual.CveEmpresa) = Nothing End If Next End If @@ -1533,8 +1533,8 @@ Partial Class Compras_Proveedores If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() 'ACTUALIZAR GLOBAL - If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then - GlobalDTCompProveedores(-1) = ObjProveedores.DtResultados + If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + GlobalDTCompProveedores(UsuarioActual.CveEmpresa) = ObjProveedores.DtResultados Else ErrorBancos = True End If @@ -1617,8 +1617,8 @@ Partial Class Compras_Proveedores If tIdContaProveedor > 0 AndAlso CreoCuenta Then ObjProveedores.UpdateProveedorIdCuentaAC(CveProveedor, tIdContaProveedor) - If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then - GlobalDTCompProveedores(-1) = ObjProveedores.DtResultados + If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + GlobalDTCompProveedores(UsuarioActual.CveEmpresa) = ObjProveedores.DtResultados End If Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) @@ -2016,7 +2016,7 @@ Partial Class Compras_Proveedores Public Sub CargaProveedorSucursales() CveTempSucursal = -1 - TempDTSucursales = GlobalDTProveedorSucursales(CveProveedor) + TempDTSucursales = GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa) TempDTSucursales.Columns.Add("CveSucursalTemp", GetType(String)) TempDTSucursalesOrigin = TempDTSucursales.Copy() GVSucursales.DataSource = TempDTSucursales @@ -2081,7 +2081,7 @@ Partial Class Compras_Proveedores If EsEditarSucursal = 0 Then If ObjProveedor.AddSucursal(CveProveedor, TxtProveedorSucursal2.Text.Trim, TextSucursalDireccion.Text.Trim, TextSucursalTelefono.Text.Trim, TxtSucursalSerie.Text.Trim, TxtContactoSucursal.Text, TxtCorreoSucursal.Text, UsuarioActual.CveUsuario, TxtLimiteCreditoSuc.Text.ToDouble, TxtPlazoCobranzaSuc.Text.ToEntero) Then 'recargo el globaldt - If ObjProveedor.GetSucursales(-1) Then Application("GlobalDTProveedorSucursales") = ObjProveedor.DtResultados + GlobalDTProveedorSucursales(-1, UsuarioActual.CveEmpresa) = Nothing Alert("La nueva Sucursal del Proveedor se guardó correctamente.", TipoMensaje.MsgInformacion) CargaProveedorSucursales() End If @@ -2089,7 +2089,7 @@ Partial Class Compras_Proveedores If CveProveedorSucursal > 0 And ObjProveedor.UpdateSucursal(TxtProveedorSucursal2.Text, TextSucursalDireccion.Text.Trim, TextSucursalTelefono.Text.Trim, TxtSucursalSerie.Text, False, TxtCorreoSucursal.Text, TxtContactoSucursal.Text, CveProveedorSucursal, CveProveedor, TxtLimiteCreditoSuc.Text.ToDouble, TxtPlazoCobranzaSuc.Text.ToEntero) Then 'recargo el globaldt - If ObjProveedor.GetSucursales(-1) Then Application("GlobalDTProveedorSucursales") = ObjProveedor.DtResultados + GlobalDTProveedorSucursales(-1, UsuarioActual.CveEmpresa) = Nothing CargaProveedorSucursales() Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) End If @@ -2149,7 +2149,7 @@ Partial Class Compras_Proveedores If ObjProveedor.RemoveProveedorContacto(-1, CveProveedorSucursal) Then If ObjProveedor.RemoveSucursal(CveProveedor, CveProveedorSucursal) Then 'GVSucursales.EditIndex = -1 - If ObjProveedor.GetSucursales(-1) Then Application("GlobalDTProveedorSucursales") = ObjProveedor.DtResultados + GlobalDTProveedorSucursales(-1, UsuarioActual.CveEmpresa) = Nothing CargaProveedorSucursales() CargaContactos(ObjProveedor) Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) @@ -3162,7 +3162,7 @@ Partial Class Compras_Proveedores End Sub Protected Sub MostrarFiltro() - If GlobalDTProveedorSucursales(CveProveedor).Rows.Count > 1 Then + If GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa).Rows.Count > 1 Then 'tHistorial.Visible = True 'tCxP.Visible = True 'tAnticipos.Visible = True @@ -3187,7 +3187,7 @@ Partial Class Compras_Proveedores End If End Sub Protected Sub CargaRB(R As DropDownList) - R.DataSource = GlobalDTProveedorSucursales(CveProveedor) + R.DataSource = GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa) R.DataBind() R.Items.Insert(0, New ListItem("Todas", "-1")) If CveProveedorSucursal > 0 Then R.SelectedValue = CveProveedorSucursal.ToString Else R.SelectedValue = "-1" diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb index 8e01e82c8..d4594f75c 100644 --- a/Contratos/Contrato.aspx.vb +++ b/Contratos/Contrato.aspx.vb @@ -1679,7 +1679,7 @@ Partial Class Contratos_Default End Sub Private Sub ElProductoChange() DdlUM.Items.Clear() - DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductows.SelectedValue.ToEntero, -1) + DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductows.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUM.DataBind() UpTitulos.Update() End Sub @@ -1711,7 +1711,7 @@ Partial Class Contratos_Default End Sub Private Sub ElProductoChangeInsumos() DdlUMInsumos.Items.Clear() - DdlUMInsumos.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductowsInsumos.SelectedValue.ToEntero, -1) + DdlUMInsumos.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductowsInsumos.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUMInsumos.DataBind() UpTitulos.Update() End Sub @@ -1913,7 +1913,7 @@ Partial Class Contratos_Default End If End If If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1) + e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlUMEdit").DataBind() e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM") End If @@ -2099,7 +2099,7 @@ Partial Class Contratos_Default End If If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1) + e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlUMEdit").DataBind() e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM") End If diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index b78138a65..930cd697c 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -725,7 +725,7 @@ Partial Class General_SaldosIniciales If Not CveUnidadMedida > 0 AndAlso UnidadMedida <> "" Then If ObjUM.AddUnidadMedida(UnidadMedida, UnidadMedida, "", "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).ToEntero > 0 Then - If ObjUM.GetUnidadesMedida() Then Application("GlobalDTUnidadesMedida") = ObjUM.DtResultados + If ObjUM.GetUnidadesMedida(UsuarioActual.CveEmpresa) Then GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) = Nothing CveUnidadMedida = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}'").ToString.ToEntero End If End If @@ -1179,8 +1179,9 @@ Partial Class General_SaldosIniciales If Not ErrorClientes Then - ObjClientes.Commit() - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCliente") = ObjClientes.DtResultados + ObjClientes.Commit() + 'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCliente") = ObjClientes.DtResultados + GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing If Contador > 0 Then Alert(String.Format("Se agregaron: {0} Clientes correctamente.
Se Omitieron: {1} Clientes ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) Else diff --git a/Global.asax b/Global.asax index b5dc90938..ebb88fa8b 100644 --- a/Global.asax +++ b/Global.asax @@ -480,8 +480,9 @@ Dim ObjAcumuladores As New ClsAcumuladores() If ObjAcumuladores.TamañoGet(-1, -1) Then Application("GlobalDTAcumTamaños") = ObjAcumuladores.DtResultados Else Application("GlobalDTAcumTamaños") = Nothing - If ObjAcumuladores.TiposDefectoGet(-1, -1) Then Application("GlobalDTAcumTiposDefecto") = ObjAcumuladores.DtResultados Else Application("GlobalDTAcumTiposDefecto") = Nothing - If ObjAcumuladores.TiposUsoGet(-1, -1) Then Application("GlobalDTAcumTiposUso") = ObjAcumuladores.DtResultados Else Application("GlobalDTAcumTiposUso") = Nothing + If ObjAcumuladores.TiposDefectoGet(-1, -1) Then Application("GlobalDTAcumTiposDefecto") = ObjAcumuladores.DtResultados Else Application("GlobalDTAcumTiposDefecto") = Nothing + If ObjAcumuladores.TiposUsoGet(-1, -1) Then Application("GlobalDTAcumTiposUso") = ObjAcumuladores.DtResultados Else Application("GlobalDTAcumTiposUso") = Nothing + 'If ObjAcumuladores.GarantiasMesesGet(-1, -1) Then Application("GlobalDTAcumGarantiasMesesTipoUso") = ObjAcumuladores.DtResultados.FiltraParametros("", DistinctColumns:={"CveMarca", "CveTipoUso", "TipoUso"}) Else Application("GlobalDTAcumGarantiasMesesTipoUso") = Nothing ObjAcumuladores.Dispose() '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/Inventarios/Consignaciones.aspx.vb b/Inventarios/Consignaciones.aspx.vb index 7706639b3..e39887743 100644 --- a/Inventarios/Consignaciones.aspx.vb +++ b/Inventarios/Consignaciones.aspx.vb @@ -1431,7 +1431,7 @@ Partial Class Inventarios_Consignaciones HFProducto.Value = DdlProducto.SelectedValue End If - DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(HFProducto.Value.ToEntero, -1) + DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(HFProducto.Value.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() UpDatos.Update() End Sub diff --git a/Inventarios/Equivalencias.aspx.vb b/Inventarios/Equivalencias.aspx.vb index 6ce650e01..b35114939 100644 --- a/Inventarios/Equivalencias.aspx.vb +++ b/Inventarios/Equivalencias.aspx.vb @@ -193,11 +193,11 @@ Partial Class Inventarios_Equivalencias #Region " RECARGA GLOBAL " Private Sub RecargaGlobal() - Dim equivalencias As New ClsProductosServicios - If equivalencias.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = equivalencias.DtResultados - End If - equivalencias.Dispose() + 'Dim equivalencias As New ClsProductosServicios + 'If equivalencias.GetPSEquivalencias(-1, -1) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1) = equivalencias.DtResultados + 'End If + 'equivalencias.Dispose() End Sub #End Region diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index 6a63652a6..229a2ddb1 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -128,7 +128,7 @@ Partial Class Inventarios_KardexAlmacen Dim CveAlmacen As Integer = ddlAlmacen.SelectedValue.ToEntero Dim CveProveedorCompra As Integer = If(DdlProveedor.SelectedValue.ToEntero > 0, DdlProveedor.SelectedValue.ToEntero, -1) - If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, CveAlmacen, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), If(ChkIncluyeTransitorios.Checked, 1, 0), DdlClasificacion_SelectedIndexChanged.selectedvalue.toentero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue) Then + If ObjMovimientos.GetKardexAlmacenHorizontal(CvePS, FechaF, CveAlmacen, DdlUnidadMedida.SelectedValue.ToEntero, CveProveedorCompra, DdlTipoAlmacen.SelectedValue.ToEntero(), If(ChkIncluyeTransitorios.Checked, 1, 0), DdlClasificacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CondicionExistencias:=DdlExistencia.SelectedValue) Then If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then dt = ObjMovimientos.DtResultados Dim ListaBorrar As New List(Of DataColumn) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 48d9ecba0..44e5f7e9c 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -2137,7 +2137,7 @@ Partial Class Inventarios_RecepcionAlmacen If EntregaDirecta Then If Not ErrorMovInv Then Dim CveVenta As Integer = 0 - Dim Dt As DataTable + Dim Dt As DataTable = Nothing If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then If ObjInventario.DtResultados.Rows.Count > 0 Then diff --git a/Inventarios/TrasladoSolicitud.aspx.vb b/Inventarios/TrasladoSolicitud.aspx.vb index ecb98f793..50115c258 100644 --- a/Inventarios/TrasladoSolicitud.aspx.vb +++ b/Inventarios/TrasladoSolicitud.aspx.vb @@ -863,7 +863,7 @@ Partial Class Inventarios_TrasladoSolicitud Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProductoServicio.SelectedValue.ToEntero).FiltroPrimero("") DdlUM.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then - DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductoServicio.SelectedValue.ToEntero, -1) + DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductoServicio.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Else DdlUM.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) End If diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index f4ee07ca2..dc43dc101 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -803,7 +803,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim CveAlmacenVirtual As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero() - CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtual, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/V") + CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtual, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/V", CveMovimientoRelacionado:=CveMovimientoSalida) FolioVirtualSalida = ObjInventario.Folio Dim dtvirtual As DataTable = Nothing @@ -1617,24 +1617,31 @@ Partial Class Inventarios_TraspasoAlmacen Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen =24 AND CveSubProyecto={CveSubProyecto}").ToEntero() - CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 2, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S") - FolioVirtualEntrada = ObjInventario.Folio - Dim dtvirtual As DataTable = Nothing + If CveAlmacenVirtual > 0 Then - If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then - dtvirtual = ObjInventario.DtResultados - For Each RowVirtual As DataRow In dtvirtual.Rows - Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() - Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble() - Dim PU As Double = RowVirtual("PU").ToString().ToDouble() - Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 2, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S2") + FolioVirtualEntrada = ObjInventario.Folio + Dim dtvirtual As DataTable = Nothing - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - ErrorMovInv = True - Exit For - End If - Next + If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + dtvirtual = ObjInventario.DtResultados + For Each RowVirtual As DataRow In dtvirtual.Rows + Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble() + Dim PU As Double = RowVirtual("PU").ToString().ToDouble() + Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next + Else + TextoError = "No se pudo registrar el movimiento virtual" + ErrorMovInv = True + End If Else + TextoError = "La Sucursal no tiene creado un almacen virtual" ErrorMovInv = True End If End If @@ -1712,7 +1719,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim Mensaje As StringBuilder = New StringBuilder Mensaje.AppendFormat("Se realizo correctamente la recepción.
Folio de Entrada: {0}", Folio, CveMovimientoSalida) Mensaje.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) 'onclick='ImprimirTraslado()' - If CveMovimientoVirtualEntrada > 0 Then Mensaje.AppendFormat("
{2}Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtualEntrada)), CveMovimientoVirtualEntrada, FolioVirtualEntrada) 'onclick='ImprimirTraslado()' + If CveMovimientoVirtualEntrada > 0 Then Mensaje.AppendFormat("

Virtual{2}Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtualEntrada)), CveMovimientoVirtualEntrada, FolioVirtualEntrada) 'onclick='ImprimirTraslado()' Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 32f164658..968a7bc62 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -1299,7 +1299,7 @@ Partial Class OC 'CARGAMOS LA SUCURSAL SI NO EXISTE SE AGREGA MATRIZ Dim CveProveedorSucursal As Integer = IIf(objOC.CveProveedorSucursal.ToEntero = -1, 0, objOC.CveProveedorSucursal.ToEntero).ToString.ToEntero DivProveedorSucursal.Visible = True - DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(objOC.CveProveedor) + DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(objOC.CveProveedor, UsuarioActual.CveEmpresa) DdlProveedorSucursal.DataBind() DdlProveedorSucursal.Items.Insert(0, New ListItem("Matriz", "0")) DdlProveedorSucursal.SelectedValueExist(CveProveedorSucursal) @@ -1334,7 +1334,7 @@ Partial Class OC If objOC.CveProveedorSucursal.ToEntero > 0 Then DivProveedorSucursal.Visible = True - DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(objOC.CveProveedor) + DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(objOC.CveProveedor, UsuarioActual.CveEmpresa) DdlProveedorSucursal.DataBind() DdlProveedorSucursal.SelectedValueExist(objOC.CveProveedorSucursal.ToString) End If @@ -1830,7 +1830,7 @@ Partial Class OC If Cvepsgvd > 0 Then Dim CboUM As DropDownList = Gvr.FCDropDownList("CboUnidadMedidaEdit") Dim TxtPU As TextBox = Gvr.FCTextBox("TxtImporteEdit") - CboUM.DataSource = GlobalDTProductosServiciosEquivalencias(Cvepsgvd, -1) + CboUM.DataSource = GlobalDTProductosServiciosEquivalencias(Cvepsgvd, -1, UsuarioActual.CveEmpresa) CboUM.DataBind() End If End Sub @@ -1879,7 +1879,7 @@ Partial Class OC CboUnidadMedida.Items.Clear() - CboUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(DdlP2.SelectedValue.ToEntero, -1) + CboUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(DdlP2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) CboUnidadMedida.DataBind() If CveEmpresaActual = 119 Then @@ -5131,7 +5131,7 @@ Partial Class OC DivProveedorSucursal.Visible = False DivProveedorContacto.Visible = False Else - If Objeto.GetSucursales(DdlProveedores.SelectedValue.ToEntero) Then + If Objeto.GetSucursales(DdlProveedores.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then If Objeto.DtResultados.Rows.Count > 0 Then DivProveedorSucursal.Visible = True DdlProveedorSucursal.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -5597,7 +5597,7 @@ Partial Class OC Dim Body As String = GeneraCorreoProveedor(CveOrdenCompra, CveProveedor) 'genero los datos de la OC Dim Correo As String = "" 'si tiene seleccionada una sucursal, obtengo su correo, sino tiene especificado tomo el correo principal del proveedor - If DdlProveedorSucursal.SelectedValue.ToEntero > 0 Then Correo = GlobalDTProveedorSucursales(CveProveedor).FiltroPrimeroValor("Correo", $"CveProveedorSucursal={DdlProveedorSucursal.SelectedValue}") + If DdlProveedorSucursal.SelectedValue.ToEntero > 0 Then Correo = GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa).FiltroPrimeroValor("Correo", $"CveProveedorSucursal={DdlProveedorSucursal.SelectedValue}") If Correo = "" Then Correo = GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {CveProveedor}")(0)("ContactoMail").ToString Try @@ -7315,10 +7315,10 @@ Partial Class OC RecargaPSGlobal() End Sub Private Sub RecargaPSGlobal() - GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + 'GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing 'Dim ObjPS As New ClsProductosServicios - 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() + 'If ObjPS.GetPSSimplificado(UsuarioActual.CveEmpresa) Then Application(String.Format("GlobalDTPSSimplificado{0}", UsuarioActual.CveEmpresa)) = ObjPS.DtResultados.AsEnumerable() 'ObjPS.Dispose() End Sub @@ -7329,11 +7329,12 @@ Partial Class OC Hilo.Start() End Sub Private Sub GeneraGlobalEquivalencias() - Dim ObjPS = New ClsProductosServicios - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados - End If - ObjPS.Dispose() + 'Dim dtt As DataTable = GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) + 'Dim ObjPS = New ClsProductosServicios + 'If ObjPS.GetPSEquivalencias(-1, UsuarioActual.CveEmpresa) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados + 'End If + 'ObjPS.Dispose() End Sub #End Region diff --git a/PyME/Sistemas/WizardRegistro.aspx.vb b/PyME/Sistemas/WizardRegistro.aspx.vb index 23848c795..15c8a9d38 100644 --- a/PyME/Sistemas/WizardRegistro.aspx.vb +++ b/PyME/Sistemas/WizardRegistro.aspx.vb @@ -326,7 +326,7 @@ Partial Class Sistemas_WizardRegistro End If CargaGVClasificacion() - If objunidadesMedida.GetUnidadesMedida() Then + If objunidadesMedida.GetUnidadesMedida(CveEmpresa) Then DtUM = objunidadesMedida.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) GvUM.DataSource = DtUM GvUM.DataBind() @@ -1259,7 +1259,7 @@ Partial Class Sistemas_WizardRegistro Else Dim ObjFolio As New ClsGralFolios If ModalidadModal = "Insertar" Then - If ObjFolio.AddFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.ToEntero, TxtFolioInicial.Text.ToEntero, TxtFolioFinal.Text.ToEntero, "", 100, CveEmpresa) Then + If ObjFolio.AddFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, "", TxtFolioInicial.Text.ToEntero, TxtFolioInicial.Text.ToEntero, TxtFolioFinal.Text.ToEntero, "", 100, CveEmpresa) Then Alert("El Folio se agrego correctamente.", TipoMensaje.MsgInformacion) RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolio")) End If @@ -1267,7 +1267,7 @@ Partial Class Sistemas_WizardRegistro If ModalidadModal = "Actualizar" Then If CveModal > 0 Then Dim CveFolio = CveModal - If ObjFolio.UpdateFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.ToEntero, TxtFolioActual.Text.ToEntero, TxtFolioFinal.Text.ToEntero, "", If(ChkEstatus.Checked, True, False), 100, CveFolio) Then + If ObjFolio.UpdateFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, "", TxtFolioInicial.Text.ToEntero, TxtFolioActual.Text.ToEntero, TxtFolioFinal.Text.ToEntero, "", If(ChkEstatus.Checked, True, False), 100, CveFolio) Then Alert("El Folio se actualizo correctamente.", TipoMensaje.MsgInformacion) RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolio")) End If @@ -1781,7 +1781,7 @@ Partial Class Sistemas_WizardRegistro Private Sub CargaDdlUM() DdlUM.Items.Clear() Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida() Then + If ObjUM.GetUnidadesMedida(CveEmpresa) Then DdlUM.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlUM.DataSource = ObjUM.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) DdlUM.DataBind() @@ -1852,7 +1852,7 @@ Partial Class Sistemas_WizardRegistro Alert(String.Format("Se agregaron: {0} Unidades de Medida correctamente.", NumRows), TipoMensaje.MsgInformacion) - If ObjUnidadesMedida.GetUnidadesMedida() Then + If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then GvUM.DataSource = ObjUnidadesMedida.DtResultados.FiltraParametros($"CveEmpresa = {CveEmpresa}") GvUM.DataBind() End If @@ -1893,7 +1893,7 @@ Partial Class Sistemas_WizardRegistro Private Sub CargaGVUM() Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida() Then + If ObjUM.GetUnidadesMedida(CveEmpresa) Then GvUM.DataSource = ObjUM.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) GvUM.DataBind() End If @@ -2063,7 +2063,7 @@ Partial Class Sistemas_WizardRegistro 'Obtengo Unidades de medida Dim ObjUM As New ClsUnidadesMedida Dim DTUM As New DataTable - If ObjUM.GetUnidadesMedida() Then + If ObjUM.GetUnidadesMedida(CveEmpresa) Then DTUM = ObjUM.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) End If ObjUM.Dispose() @@ -2780,7 +2780,8 @@ Partial Class Sistemas_WizardRegistro If Not ErrorClientes Then ObjClientes.Commit() - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCliente") = ObjClientes.DtResultados + 'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCliente") = ObjClientes.DtResultados + If Contador > 0 Then Alert(String.Format("Se agregaron: {0} Clientes correctamente.
Se Omitieron: {1} Clientes ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) Else @@ -2957,7 +2958,7 @@ Partial Class Sistemas_WizardRegistro ObjPS.Dispose() Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida() Then + If ObjUM.GetUnidadesMedida(CveEmpresa) Then CveUnidadMedida = ObjUM.DtResultados.FiltraParametros($"CveEmpresa={CveEmpresa}").FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero End If ObjUM.Dispose() @@ -3061,7 +3062,7 @@ Partial Class Sistemas_WizardRegistro ObjPS.Dispose() Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida() Then + If ObjUM.GetUnidadesMedida(CveEmpresa) Then CveUnidadMedida = ObjUM.DtResultados.FiltraParametros($"CveEmpresa={CveEmpresa}").FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero End If ObjUM.Dispose() diff --git a/Sistemas/CatSesiones.aspx.vb b/Sistemas/CatSesiones.aspx.vb index c60aab305..ea507a6fc 100644 --- a/Sistemas/CatSesiones.aspx.vb +++ b/Sistemas/CatSesiones.aspx.vb @@ -221,6 +221,7 @@ Partial Class Sistemas_CatSesiones Private Sub CargaProductosServiciosSimplificado() GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + Dim dt As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) 'Dim ObjPS As New ClsProductosServicios 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() Else Application("GlobalDTPSSimplificado") = Nothing 'ObjPS.Dispose() @@ -321,12 +322,13 @@ Partial Class Sistemas_CatSesiones Private Sub CargaSubProyectos() 'Carga SubProyectos + GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa) = Nothing Dim ObjSubProyectos As New ClsSubProyectos - If ObjSubProyectos.GetSubProyectos Then - Application("GlobalDTSubProyectos") = ObjSubProyectos.DtResultados - Else - Application("GlobalDTSubProyectos") = Nothing - End If + 'If ObjSubProyectos.GetSubProyectos Then + ' Application("GlobalDTSubProyectos") = ObjSubProyectos.DtResultados + 'Else + ' Application("GlobalDTSubProyectos") = Nothing + 'End If If ObjSubProyectos.GetSubProyectosUsuarios Then Application("GlobalDTProyectosUsuarios") = ObjSubProyectos.DtResultados.FiltraParametros("", "", {"Proyecto", "CveProyecto", "CveUsuario", "CveEmpresa", "CveEstatusProyecto"}) Application("GlobalDTSubProyectosUsuarios") = ObjSubProyectos.DtResultados @@ -447,7 +449,7 @@ Partial Class Sistemas_CatSesiones Dim ObjProveedores As New ClsCompProveedores If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCompProveedores") = ObjProveedores.DtResultados Else Application("GlobalDTCompProveedores") = Nothing If ObjProveedores.GetClasificacionProveedores Then Application("GlobalDTProveedorClasificacion") = ObjProveedores.DtResultados Else Application("GlobalDTProveedorClasificacion") = Nothing - If ObjProveedores.GetSucursales(-1) Then Application("GlobalDTProveedorSucursales") = ObjProveedores.DtResultados Else Application("GlobalDTProveedorSucursales") = Nothing + If ObjProveedores.GetSucursales(-1, -1) Then Application("GlobalDTProveedorSucursales") = ObjProveedores.DtResultados Else Application("GlobalDTProveedorSucursales") = Nothing ObjProveedores.Dispose() End Sub @@ -461,7 +463,15 @@ Partial Class Sistemas_CatSesiones End Sub Protected Sub BtnRefresh_Click(sender As Object, e As EventArgs) Handles BtnRefresh.Click - Gv.DataSource = DirectCast(Application(DdlVariable.SelectedValue), DataTable) + Dim dt As DataTable = Nothing + Select Case DdlVariable.SelectedValue + Case "" + dt = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + Case Else + dt = DirectCast(Application(DdlVariable.SelectedValue & UsuarioActual.CveEmpresa), DataTable) + End Select + + Gv.DataSource = dt Gv.DataBind() End Sub diff --git a/Ventas/CatUnidadesMedida.aspx.vb b/Ventas/CatUnidadesMedida.aspx.vb index 2120cc5da..6f6318edc 100644 --- a/Ventas/CatUnidadesMedida.aspx.vb +++ b/Ventas/CatUnidadesMedida.aspx.vb @@ -30,7 +30,7 @@ Partial Class CatUnidadesMedida Dim ObjUnidadesMedida As New ClsUnidadesMedida - If ObjUnidadesMedida.GetUnidadesMedida() Then + If ObjUnidadesMedida.GetUnidadesMedida(UsuarioActual.CveEmpresa) Then GlobalDTUnidadesMedida = ObjUnidadesMedida.DtResultados ViewState("DTUnidadesMedida") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) GvDatos.DataSource = ViewState("DTUnidadesMedida") @@ -81,7 +81,7 @@ Partial Class CatUnidadesMedida Dim ObjUnidadesMedida As New ClsUnidadesMedida - If ObjUnidadesMedida.GetUnidadesMedidaAlias(cve) Then + If ObjUnidadesMedida.GetUnidadesMedidaAlias(UsuarioActual.CveEmpresa, cve) Then ViewState("DTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) Else ViewState("DTUnidadesMedidaAlias") = Nothing diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 30ad1dc8b..d2d59eace 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -2597,19 +2597,21 @@ Partial Class Clientes #Region "G L O B L A L" Private Sub RecargaGlobal() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) + 'Hilo.Start() + GeneraGlobalDT() End Sub Private Sub GeneraGlobalDT() - Dim Objclientes As New ClsClientes - If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then - Application("GlobalDTCliente") = Objclientes.DtResultados - End If - Objclientes.Dispose() - End Sub + GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing + 'Dim Objclientes As New ClsClientes + 'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then + ' Application("GlobalDTCliente") = Objclientes.DtResultados + 'End If + 'Objclientes.Dispose() + End Sub #End Region - - + + #Region "G R I D V I E W S" Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index c63687031..e00126eae 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -2866,6 +2866,10 @@ Partial Class PV End If End If + If ChkAjuste.Checked Then + CalculaMesesUso() + UpAjuste.Update() + End If End If @@ -4662,9 +4666,19 @@ Partial Class PV RFVLocalidadC.Visible = False RFVEstadoC.Visible = False RFVPaisC.Visible = False + TxtNombreCliente.Focus() DdlMetodoCliente.SelectedValueExist(1) DdlFormaCliente.SelectedValueExist(1) + 'carga datos particulares de la sucursal + Dim dr As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero).FiltroPrimero("") + + If dr IsNot Nothing Then + TxtCPCliente.Text = dr("CP").ToString + TxtEstadoCliente.Text = dr("Estado").ToString + TxtCiudadCliente.Text = dr("Municipio").ToString + TxtLocalidadCliente.Text = dr("Localidad").ToString + End If Else Dim ObjCliente As New ClsClientes If ObjCliente.ValidaClienteRFC(TxtRFCCliente.Text, UsuarioActual.CveEmpresa) Then @@ -4914,15 +4928,17 @@ Partial Class PV End Sub Private Sub RecargaGlobalCliente() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente) + 'Hilo.Start() + GeneraGlobalDTCliente() End Sub - Private Sub GeneraGlobalDTCliente() - Dim Objclientes As New ClsClientes - If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then - Application("GlobalDTCliente") = Objclientes.DtResultados - End If - Objclientes.Dispose() + Private Sub GeneraGlobalDTCliente() + GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing + 'Dim Objclientes As New ClsClientes + 'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then + ' Application("GlobalDTCliente") = Objclientes.DtResultados + 'End If + 'Objclientes.Dispose() End Sub #End Region @@ -5198,13 +5214,19 @@ Partial Class PV Dim CvePSParametro As Integer = DdlPSAjuste.SelectedValue.ToEntero Dim PrecioSugerido As Decimal = 0 Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") + Dim CveMarca As Integer If drPS IsNot Nothing Then PrecioSugerido = drPS("Precio").ToString.ToDecimal + CveMarca = drPS("CveMarca").ToString.ToEntero End If TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2) + DdlTipoUso.Items.Clear() + DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca) + DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlTipoUso.DataBind() End If If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index a0ae980b3..02e41c2ce 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1326,11 +1326,12 @@ Partial Class ProductosyServicios #Region "G L O B L A L" Private Sub RecargaGlobal() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) + 'Hilo.Start() + GeneraGlobalDT() End Sub Private Sub GeneraGlobalDT() - GlobalDTPSAdicionales(-1, UsuarioActual.CveEmpresa) = Nothing + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa) = Nothing GlobalDTImpuestosLocales(-1, UsuarioActual.CveEmpresa) = Nothing @@ -1339,23 +1340,23 @@ Partial Class ProductosyServicios 'Dim ObjPS As New ClsProductosServicios - 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() + 'If ObjPS.GetPSSimplificado(UsuarioActual.CveEmpresa) Then Application(String.Format("GlobalDTPSSimplificado{0}", UsuarioActual.CveEmpresa)) = ObjPS.DtResultados.AsEnumerable() - 'If ObjPS.GetPSAlias(-1, -1) Then - ' GlobalDTProductosServiciosAlias(-1) = ObjPS.DtResultados + ''If ObjPS.GetPSAlias(-1, UsuarioActual.CveEmpresa) Then + ' GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa) = ObjPS.DtResultados 'End If - 'If ObjPS.GetPSImpuestosLocales(-1, -1) Then - ' GlobalDTImpuestosLocales(-1, -1) = ObjPS.DtResultados + 'If ObjPS.GetPSImpuestosLocales(-1, UsuarioActual.CveEmpresa) Then + ' GlobalDTImpuestosLocales(-1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados 'End If - 'If ObjPS.GetPSEquivalencias(-1, -1) Then + 'If ObjPS.GetPSEquivalencias(-1, UsuarioActual.CveEmpresa) Then ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados 'End If - ''If ObjPS.GetPSAdicionales(-1, -1) Then - '' GlobalDTPSAdicionales(-1, -1) = ObjPS.DtResultados - ''End If + 'If ObjPS.GetPSAdicionales(-1, UsuarioActual.CveEmpresa) Then + ' GlobalDTPSAdicionales(-1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados + 'End If 'ObjPS.Dispose() End Sub @@ -1401,8 +1402,9 @@ Partial Class ProductosyServicios End Sub Private Sub RecargaGlobalEquivalencias() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalEquivalencias) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalEquivalencias) + 'Hilo.Start() + GeneraGlobalEquivalencias() End Sub Private Sub GeneraGlobalEquivalencias() GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index cc817e97b..7e93f1483 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -5834,18 +5834,7 @@ - -
-
-
-
-
-
- ó -
-
-
-
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 389ef21b7..a7b9270a5 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9847,7 +9847,7 @@ Partial Class Ventas End If End If - If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then + If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then If ObjConta.ValorPolizaDescuadre > 0 Then 'ErrorPrepoliza = True GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas") @@ -15269,14 +15269,19 @@ Partial Class Ventas DtMovimientos = ObjInventario.DtResultados.FiltraParametros("", DistinctColumns:={"CveMovimiento"}) 'Si estamos facturando remisiones ajustamos por ventadetalle - If RemisionesLista.Count > 0 Then + If RemisionesLista.Count > 0 AndAlso DtRemisionesTmpDT IsNot Nothing AndAlso DtRemisionesTmpDT.Rows.Count > 0 AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then Dim resultados = From DtRemisiones In DtRemisionesTmpDT Join DtMovDet In ObjInventario.DtResultados.FiltraParametros("CvePS > 0") On DtRemisiones("CveVentaDetalleRemision").ToString.ToEntero Equals DtMovDet("CveVentaDetalle").ToString.ToEntero Select DtMovDet Try - DtMovimientosDetalles = resultados.CopyToDataTable + If resultados.Count > 0 Then + DtMovimientosDetalles = resultados.CopyToDataTable + Else + DtMovimientosDetalles = New DataTable + End If + Catch ex As Exception - GuardaLog($"LOG IPP: Ventas LN: 10033. - DtRemisionesTmpDT.Rows.Count: {DtRemisionesTmpDT.Rows.Count} - ObjInventario.DtResultados.FiltraParametros('CvePS > 0').Rows.Count: {ObjInventario.DtResultados.FiltraParametros("CvePS > 0").Rows.Count}") + GuardaLog($"LOG IPP: Ventas LN: 10033. - DtRemisionesTmpDT.Rows.Count: {DtRemisionesTmpDT.Rows.Count} - ObjInventario.DtResultados.FiltraParametros('CvePS > 0').Rows.Count: {ObjInventario.DtResultados.FiltraParametros("CvePS > 0").Rows.Count} Ex:{ex.Message}") DtMovimientosDetalles = New DataTable End Try Else @@ -17253,15 +17258,17 @@ Partial Class Ventas End Sub Private Sub RecargaGlobalCliente() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente) + 'Hilo.Start() + GeneraGlobalDTCliente() End Sub Private Sub GeneraGlobalDTCliente() - Dim Objclientes As New ClsClientes - If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then - Application("GlobalDTCliente") = Objclientes.DtResultados - End If - Objclientes.Dispose() + GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing + 'Dim Objclientes As New ClsClientes + 'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus:=-1, TipoCliente:=-1) Then + ' Application("GlobalDTCliente" & UsuarioActual.CveEmpresa) = Objclientes.DtResultados + 'End If + 'Objclientes.Dispose() End Sub #End Region @@ -19164,19 +19171,19 @@ Partial Class Ventas RecargaGlobal() End Sub Private Sub RecargaGlobal() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) - Hilo.Start() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) + 'Hilo.Start() + GeneraGlobalDT() End Sub Private Sub GeneraGlobalDT() + 'Dim dtt As DataTable GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing 'Dim ObjPS As New ClsProductosServicios - 'If (ObjPS.GetPSSimplificado(-1)) Then - ' Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable 'Cargamos el GlobalDTPSSimplificado - 'End If + 'If ObjPS.GetPSSimplificado(UsuarioActual.CveEmpresa) Then Application(String.Format("GlobalDTPSSimplificado{0}", UsuarioActual.CveEmpresa)) = ObjPS.DtResultados.AsEnumerable() - 'If ObjPS.GetPSEquivalencias(-1, -1) Then + 'If ObjPS.GetPSEquivalencias(-1, UsuarioActual.CveEmpresa) Then ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados 'End If @@ -20922,6 +20929,7 @@ Partial Class Ventas DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal)) DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer)) DtImpuestos.AcceptChanges() + Dim AcumuladoNC As Decimal = 0 If AplicaNCMasiva Then If NCDescuento Then @@ -20929,10 +20937,12 @@ Partial Class Ventas DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True), True, MissingSchemaAction.Ignore) Next Else + For Each Gvr As GridViewRow In GvCxC.Rows If Gvr.FCCheckBox("ChkCxC").Checked Then DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore) 'CARGA FACTURA A LA CUAL SE APLICA LA NC + AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal) End If Next @@ -20949,10 +20959,10 @@ Partial Class Ventas Into x = Group Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString.ToDecimal), ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString.ToDecimal), - ImporteIVA = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA, - ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA, - ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR, - ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS, + ImporteIVA = x.Sum(Function(s) Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)), ' Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA, + ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA, + ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR, + ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString.ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS, PorcentajeIVA = PorcentajeIVA, PorcentajeRetIVA = PorcentajeRetIVA, PorcentajeRetISR = PorcentajeRetISR, @@ -21001,11 +21011,23 @@ Partial Class Ventas If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta DdlTipoComprobante.SelectedValueExist("Egs") + 'verifica el total de multiples facturas + Dim Acumulado12 As Decimal = 0 + Dim UltimoRenglon As Integer = 1 + Dim Ajuste As Decimal = 0 For Each Dr As DataRow In DtImpuestos.Rows + Acumulado12 += Dr("ImportePU").ToString.ToDecimal.RoundSQL + Dr("ImporteIVA").ToString.ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString.ToDecimal + If UltimoRenglon = DtImpuestos.Rows.Count Then + 'ajusta 5 centavos de diferencia + If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then + Ajuste = Acumulado12 - AcumuladoNC + End If + End If + UltimoRenglon += 1 AgregaTempDT(TmpDT, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero, DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto, - TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal, + TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString.ToDecimal, "", "", -1, -1, DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1) Next @@ -21017,6 +21039,7 @@ Partial Class Ventas TrTipoRelacion.Visible = True DdlTiposRelacion.SelectedValueExist("1") + DdlSubProyectoDatos.Enabled = False 'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00 If Not AplicaNCMasiva Then @@ -21077,22 +21100,24 @@ Partial Class Ventas FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto")) Dr("ImporteTotal") = Math.Round(Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr)), 2) - Dr("ImporteIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * (1 + Dr("PorcentajeIEPS").ToString().ToDecimal()) * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2) - Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2) - Dr("ImporteRetISR") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2) - Dr("ImporteIEPS") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2) + 'Dr("ImporteIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2) + 'Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2) + 'Dr("ImporteRetISR") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2) + 'Dr("ImporteIEPS") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2) - 'Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}' "), 2) - 'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}' "), 2) - 'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}'"), 2) - 'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}'"), 2) + Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr), 2) + Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2) + Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2) + Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2) Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal) Next 'codigo para ajuste de centavo, si el importe total no cuadra con los totales Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) If Math.Abs(difTmp) >= 0.01 Then 'asusto la diferencia en el último concepto - DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp + Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp + DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = ImporteAjustado + DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImportePU") = ImporteAjustado End If If Not NCDescuento Then diff --git a/asmx/WSApp.asmx b/asmx/WSApp.asmx index 0c92d6bd9..10913c010 100644 --- a/asmx/WSApp.asmx +++ b/asmx/WSApp.asmx @@ -67,52 +67,52 @@ Public Class WSApp Application("GlobalDTVtaFormaPago") = value End Set End Property - Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - Get + 'Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + ' Get - If DirectCast(Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then - Dim P As New ClsSubProyectos - If P.GetSubProyectos Then - Application("GlobalDTSubProyectos") = P.DtResultados - End If - P.Dispose() + ' If DirectCast(Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then + ' Dim P As New ClsSubProyectos + ' If P.GetSubProyectos Then + ' Application("GlobalDTSubProyectos") = P.DtResultados + ' End If + ' P.Dispose() - Dim msg As String = "aqui no se carga subproyectos" - 'If Request IsNot Nothing Then - ' msg = msg & Request.ServerVariables("URL") - 'End If - msg.GuardaLog() + ' Dim msg As String = "aqui no se carga subproyectos" + ' 'If Request IsNot Nothing Then + ' ' msg = msg & Request.ServerVariables("URL") + ' 'End If + ' msg.GuardaLog() - End If + ' End If - If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + ' If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then + ' Dim StrSQL As New StringBuilder + ' If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) + ' If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) + ' If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) + ' If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTSubProyectos = Dv.ToTable - Dv.Dispose() + ' Dim Dv As New DataView(DirectCast(Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + ' GlobalDTSubProyectos = Dv.ToTable + ' Dv.Dispose() - Else - GlobalDTSubProyectos = DirectCast(Application("GlobalDTSubProyectos"), DataTable) - End If + ' Else + ' GlobalDTSubProyectos = DirectCast(Application("GlobalDTSubProyectos"), DataTable) + ' End If - End Get - Set(ByVal value As DataTable) - If value Is Nothing OrElse value.Rows.Count = 0 Then - Dim msg As String = "aqui no se carga subproyectos" - 'If Request IsNot Nothing Then - ' msg = msg & Request.ServerVariables("URL") - 'End If - msg.GuardaLog() + ' End Get + ' Set(ByVal value As DataTable) + ' If value Is Nothing OrElse value.Rows.Count = 0 Then + ' Dim msg As String = "aqui no se carga subproyectos" + ' 'If Request IsNot Nothing Then + ' ' msg = msg & Request.ServerVariables("URL") + ' 'End If + ' msg.GuardaLog() - End If - Application("GlobalDTSubProyectos") = value - End Set - End Property + ' End If + ' Application("GlobalDTSubProyectos") = value + ' End Set + 'End Property Property GlobalDTSATUsosCFDI(Optional EsPersonaFisica As Integer = -1) As DataTable Get If EsPersonaFisica <> -1 Then @@ -151,20 +151,20 @@ Public Class WSApp Application("GlobalDTUsuarios") = value End Set End Property - Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedida = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedida = DirectCast(Application("GlobalDTUnidadesMedida"), DataTable) - End If - End Get - Set(value As DataTable) - Application("GlobalDTUnidadesMedida") = value - End Set - End Property + 'Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + ' Get + ' If CveEmpresa <> -1 Then + ' Dim Dv As New DataView(DirectCast(Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + ' GlobalDTUnidadesMedida = Dv.ToTable + ' Dv.Dispose() + ' Else + ' GlobalDTUnidadesMedida = DirectCast(Application("GlobalDTUnidadesMedida"), DataTable) + ' End If + ' End Get + ' Set(value As DataTable) + ' Application("GlobalDTUnidadesMedida") = value + ' End Set + 'End Property Property GlobalDTGralCategorias(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then diff --git a/asmx/WSSIGApp.asmx b/asmx/WSSIGApp.asmx index febee922a..a1b647fbd 100644 --- a/asmx/WSSIGApp.asmx +++ b/asmx/WSSIGApp.asmx @@ -67,52 +67,52 @@ Public Class WSSIGApp Application("GlobalDTVtaFormaPago") = value End Set End Property - Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - Get + 'Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + ' Get - If DirectCast(Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then - Dim P As New ClsSubProyectos - If P.GetSubProyectos Then - Application("GlobalDTSubProyectos") = P.DtResultados - End If - P.Dispose() + ' If DirectCast(Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then + ' Dim P As New ClsSubProyectos + ' If P.GetSubProyectos Then + ' Application("GlobalDTSubProyectos") = P.DtResultados + ' End If + ' P.Dispose() - Dim msg As String = "aqui no se carga subproyectos" - 'If Request IsNot Nothing Then - ' msg = msg & Request.ServerVariables("URL") - 'End If - msg.GuardaLog() + ' Dim msg As String = "aqui no se carga subproyectos" + ' 'If Request IsNot Nothing Then + ' ' msg = msg & Request.ServerVariables("URL") + ' 'End If + ' msg.GuardaLog() - End If + ' End If - If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + ' If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then + ' Dim StrSQL As New StringBuilder + ' If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) + ' If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) + ' If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) + ' If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTSubProyectos = Dv.ToTable - Dv.Dispose() + ' Dim Dv As New DataView(DirectCast(Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + ' GlobalDTSubProyectos = Dv.ToTable + ' Dv.Dispose() - Else - GlobalDTSubProyectos = DirectCast(Application("GlobalDTSubProyectos"), DataTable) - End If + ' Else + ' GlobalDTSubProyectos = DirectCast(Application("GlobalDTSubProyectos"), DataTable) + ' End If - End Get - Set(ByVal value As DataTable) - If value Is Nothing OrElse value.Rows.Count = 0 Then - Dim msg As String = "aqui no se carga subproyectos" - 'If Request IsNot Nothing Then - ' msg = msg & Request.ServerVariables("URL") - 'End If - msg.GuardaLog() + ' End Get + ' Set(ByVal value As DataTable) + ' If value Is Nothing OrElse value.Rows.Count = 0 Then + ' Dim msg As String = "aqui no se carga subproyectos" + ' 'If Request IsNot Nothing Then + ' ' msg = msg & Request.ServerVariables("URL") + ' 'End If + ' msg.GuardaLog() - End If - Application("GlobalDTSubProyectos") = value - End Set - End Property + ' End If + ' Application("GlobalDTSubProyectos") = value + ' End Set + 'End Property Property GlobalDTSATUsosCFDI(Optional EsPersonaFisica As Integer = -1) As DataTable Get If EsPersonaFisica <> -1 Then @@ -151,20 +151,20 @@ Public Class WSSIGApp Application("GlobalDTUsuarios") = value End Set End Property - Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedida = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedida = DirectCast(Application("GlobalDTUnidadesMedida"), DataTable) - End If - End Get - Set(value As DataTable) - Application("GlobalDTUnidadesMedida") = value - End Set - End Property + 'Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + ' Get + ' If CveEmpresa <> -1 Then + ' Dim Dv As New DataView(DirectCast(Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + ' GlobalDTUnidadesMedida = Dv.ToTable + ' Dv.Dispose() + ' Else + ' GlobalDTUnidadesMedida = DirectCast(Application("GlobalDTUnidadesMedida"), DataTable) + ' End If + ' End Get + ' Set(value As DataTable) + ' Application("GlobalDTUnidadesMedida") = value + ' End Set + 'End Property Property GlobalDTGralCategorias(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then