api para empresa 72
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
|
||||
Reference in New Issue
Block a user