-cambios en globalsDT2

This commit is contained in:
janeth arvizu
2020-01-02 12:55:04 -07:00
parent 7dcdf8bc22
commit b9f942cb72
30 changed files with 878 additions and 649 deletions

View File

@@ -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

View File

@@ -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