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 diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index e6384aa58..c5002a274 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -463,6 +463,14 @@ Partial Class OC ViewState("CveConfianzaProveedor") = value End Set End Property + Private Property CveProveedorOrignal As Integer + Get + Return IfNull(ViewState("CveProveedorOrignal"), -1).ToString().ToEntero() + End Get + Set(value As Integer) + ViewState("CveProveedorOrignal") = value + End Set + End Property Private Property CveEstatusSupervisada As Integer Get Return IfNull(ViewState("CveEstatusSupervisada"), -1).ToString().ToEntero() @@ -1431,6 +1439,7 @@ Partial Class OC DdlProveedores.SelectedValue = objOC.CveProveedor.ToString If DdlProveedores.SelectedValue.ToEntero > 0 Then + CveProveedorOrignal = DdlProveedores.SelectedValue.ToEntero DdlProveedores.SelectedText = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveProveedor = {objOC.CveProveedor}").Rows(0)("RazonSocial").ToString Else DdlProveedores.SelectedText = "-" @@ -2718,8 +2727,10 @@ Partial Class OC DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)) Then - If Not ObjConta.UpdateProveedorPoliza(CveOrdenCompra, CveProveedor, Proveedor) Then - TieneError = True + If CveProveedorOrignal <> CveProveedor Then + If Not ObjConta.UpdateProveedorPoliza(CveOrdenCompra, CveProveedor, Proveedor) Then + TieneError = True + End If End If Else TieneError = True