Merge ClsVentas
This commit is contained in:
71
Ashx/E72.ashx
Normal file
71
Ashx/E72.ashx
Normal file
@@ -0,0 +1,71 @@
|
||||
<%@ WebHandler Language="VB" Class="E72" %>
|
||||
|
||||
Imports System
|
||||
Imports System.Web
|
||||
Imports System.Data
|
||||
Imports Newtonsoft.Json
|
||||
Imports Extensiones
|
||||
Imports System.IO
|
||||
|
||||
Public Class E72 : Implements IHttpHandler, IRequiresSessionState
|
||||
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
||||
Get
|
||||
Return False
|
||||
End Get
|
||||
End Property
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
|
||||
Try
|
||||
Select Case context.Request("metodo")
|
||||
Case "contratoexistencia"
|
||||
contratoexistencia(context)
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
ex.GuardaLog(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function contratoexistencia(ByVal context As HttpContext) As String
|
||||
Try
|
||||
|
||||
|
||||
Dim retorno As String = ""
|
||||
Dim ObjInv As New ClsInventarios
|
||||
ObjInv.GetRepEntradasSalidasXContrato(72, -1, MinFecha, Date.Now, -1, -1, 17, -1, -1, 3, -1, 1158)
|
||||
Dim DtRepEntradasSalidasXContrato As DataTable = ObjInv.DtResultados.FiltraParametros("CvePS > 0")
|
||||
|
||||
ObjInv.ApartadosRep(-1, 70437, 259, 72, -1, MinFecha, Date.Now)
|
||||
Dim DtApartados As DataTable = ObjInv.DtResultados.FiltraParametros("CvePS > 0", "", {"CvePS", "Cantidad"})
|
||||
Dim asd As Integer = DtApartados.Rows.Count
|
||||
|
||||
Dim DTapartado = From row In DtApartados.AsEnumerable
|
||||
Group row By CvePS = row.Field(Of Integer)("CvePS") Into CvePSGroup = Group
|
||||
Select New With {
|
||||
Key CvePS,
|
||||
.Cantidad = CvePSGroup.Sum(Function(r) r.Field(Of Decimal)("Cantidad"))
|
||||
}
|
||||
|
||||
Dim DtTemp = From entradas In DtRepEntradasSalidasXContrato
|
||||
Join apartados In DTapartado
|
||||
On entradas.Field(Of Integer)("CvePS") Equals apartados.CvePS
|
||||
Select New With {
|
||||
.Codigo = entradas.Field(Of String)("Codigo"),
|
||||
.Existencia = entradas.Field(Of Double)("SaldoFCant"),
|
||||
.AlmacenAlt = apartados.Cantidad,
|
||||
.Precio = entradas.Field(Of Double)("PrecioVenta")
|
||||
}
|
||||
|
||||
|
||||
|
||||
retorno = JsonConvert.SerializeObject(DtTemp).ToString
|
||||
context.Response.Write(retorno)
|
||||
ObjInv.Dispose()
|
||||
Return retorno
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
101
Ashx/SIGWeb.ashx
101
Ashx/SIGWeb.ashx
@@ -35,11 +35,33 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
context.Response.Close()
|
||||
context.Response.End()
|
||||
Else
|
||||
context.Response.ContentType = "text/plain"
|
||||
If context.Request("metodo").Contiene("Contabilizapoliza", "RevisaConexion") Then
|
||||
context.Response.ContentType = "text/json"
|
||||
Else
|
||||
context.Response.ContentType = "text/plain"
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Try
|
||||
Select Case context.Request("metodo")
|
||||
Case "Contabilizapoliza"
|
||||
Dim CvePrePoliza As Integer = context.Request("CvePrePoliza").ToString().ToEntero()
|
||||
Dim CveUsuario As Integer = context.Request("CveUsuario").ToString().ToEntero()
|
||||
Dim CveEmpresa As Integer = context.Request("CveEmpresa").ToString().ToEntero()
|
||||
GuardaLog(String.Format("?metodo=Contabilizapoliza&CvePrePoliza={0}&CveUsuario={1}&CveEmpresa ={2}", CvePrePoliza, CveUsuario, CveEmpresa))
|
||||
ActualizaPrePoliza(context)
|
||||
Dim obj As New ADSNetLibrary.SIGAPI.Models.ResponseModel(Of Object)()
|
||||
obj.Result = DateTime.Now.ToString()
|
||||
Dim retorno = JsonConvert.SerializeObject(obj).ToString()
|
||||
context.Response.Write(retorno)
|
||||
context.Response.StatusCode = 200
|
||||
Case "RevisaConexion"
|
||||
Dim obj As New ADSNetLibrary.SIGAPI.Models.ResponseModel(Of Object)()
|
||||
obj.Result = DateTime.Now.ToString()
|
||||
Dim retorno = JsonConvert.SerializeObject(obj).ToString()
|
||||
context.Response.Write(retorno)
|
||||
context.Response.StatusCode = 200
|
||||
Case "getps"
|
||||
GETPS(context)
|
||||
Case "getps2"
|
||||
@@ -70,6 +92,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
ActualizaPrePoliza(context)
|
||||
Case "getpersonal"
|
||||
getpersonal(context)
|
||||
Case "getcuentascontables"
|
||||
GetCuentasContables(context)
|
||||
Case "getcontratos"
|
||||
GetContratos(context)
|
||||
Case "GettingCURP"
|
||||
@@ -558,6 +582,15 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
'Dim i As Integer = 0 'limpieza de columnas
|
||||
'While i < DtRetorno.Columns.Count
|
||||
' If Not DtRetorno.Columns(i).ColumnName.Contiene("CveProveedor", "NombreCortoProveedor") Then
|
||||
' DtRetorno.Columns.RemoveAt(i)
|
||||
' Else
|
||||
' i = i + 1
|
||||
' End If
|
||||
'End While
|
||||
|
||||
DtRetorno.Columns("CveCliente").ColumnName = "id"
|
||||
DtRetorno.Columns(ColumnaNombre).ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
@@ -593,11 +626,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
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(String.Format("CveEmpresa = {0}", CveEmpresa))
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
DtRetorno = dt.FiltraParametros(String.Format("NombreCortoProveedor like '%{0}%'", Name))
|
||||
@@ -606,14 +634,24 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
Dim i As Integer = 0 'limpieza de columnas
|
||||
While i < DtRetorno.Columns.Count
|
||||
If Not DtRetorno.Columns(i).ColumnName.Contiene("CveProveedor", "NombreCortoProveedor") Then
|
||||
DtRetorno.Columns.RemoveAt(i)
|
||||
Else
|
||||
i = i + 1
|
||||
End If
|
||||
End While
|
||||
|
||||
DtRetorno.Columns("CveProveedor").ColumnName = "id"
|
||||
DtRetorno.Columns("NombreCortoProveedor").ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
context.Response.Write(retorno)
|
||||
DtRetorno.Dispose()
|
||||
Else
|
||||
context.Response.Write("[]")
|
||||
End If
|
||||
DtRetorno.Dispose()
|
||||
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
@@ -1147,11 +1185,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
ObjPersonal.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($"NombreCompleto like '%{Name}%'")
|
||||
@@ -1159,6 +1192,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
|
||||
DtRetorno.Columns("CvePersonal").ColumnName = "id"
|
||||
DtRetorno.Columns("NombreCompleto").ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
@@ -1205,4 +1239,47 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Get Cuentas"
|
||||
Private Function GetCuentasContables(ByVal context As HttpContext) As String
|
||||
Dim retorno As String = ""
|
||||
Dim DtRetorno As DataTable = Nothing
|
||||
|
||||
Dim usuario As Usuario = UsuarioActual(context)
|
||||
Dim CveEmpresa As String
|
||||
If IsNothing(usuario) Then
|
||||
context.Response.Write("")
|
||||
Else
|
||||
CveEmpresa = usuario.CveEmpresa
|
||||
|
||||
Dim Name = IfNull(context.Request("Name"), "-1").ToString
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
If ObjConta.GetCuentas(-1, "-1", 1, CveEmpresa, Nombre:=Name) Then
|
||||
DtRetorno = ObjConta.DtResultados
|
||||
End If
|
||||
ObjConta.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
Dim i As Integer = 0 'limpieza de columnas
|
||||
While i < DtRetorno.Columns.Count
|
||||
If Not DtRetorno.Columns(i).ColumnName.Contiene("CveCuenta", "CtaCodigo") Then
|
||||
DtRetorno.Columns.RemoveAt(i)
|
||||
Else
|
||||
i = i + 1
|
||||
End If
|
||||
End While
|
||||
DtRetorno.Columns("CveCuenta").ColumnName = "id"
|
||||
DtRetorno.Columns("CtaCodigo").ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
context.Response.Write(retorno)
|
||||
Else
|
||||
context.Response.Write("[]")
|
||||
End If
|
||||
|
||||
DtRetorno.Dispose()
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user