From c239685e1cb193c3c6ff08f02a292094ade28e36 Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Tue, 22 Jun 2021 14:09:02 -0700 Subject: [PATCH] api para empresa 72 --- Ashx/E72.ashx | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Ashx/E72.ashx diff --git a/Ashx/E72.ashx b/Ashx/E72.ashx new file mode 100644 index 000000000..78d0e2c55 --- /dev/null +++ b/Ashx/E72.ashx @@ -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 \ No newline at end of file