diff --git a/Contratos/RepPedidosDevolucionesXContrato.aspx b/Contratos/RepPedidosDevolucionesXContrato.aspx index 834e5f7d5..335c87aea 100644 --- a/Contratos/RepPedidosDevolucionesXContrato.aspx +++ b/Contratos/RepPedidosDevolucionesXContrato.aspx @@ -140,7 +140,8 @@ - + + @@ -180,7 +181,8 @@ - + + diff --git a/Contratos/RepPedidosDevolucionesXContrato.aspx.vb b/Contratos/RepPedidosDevolucionesXContrato.aspx.vb index dcaf3497f..0c7ce6161 100644 --- a/Contratos/RepPedidosDevolucionesXContrato.aspx.vb +++ b/Contratos/RepPedidosDevolucionesXContrato.aspx.vb @@ -111,7 +111,8 @@ Partial Class Ventas_RepPedidosDevolucionesXContrato e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") e.Row.Cells(1).Text = "" e.Row.Cells(5).Text = "" - e.Row.Cells(6).Text = "" + e.Row.Cells(6).Text = "" + e.Row.Cells(7).Text = "" Dim Texto = $"Pedido: {e.Row.DBCampo("SerieFolio")} | " Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") @@ -134,7 +135,8 @@ Partial Class Ventas_RepPedidosDevolucionesXContrato e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;") e.Row.Cells(1).Text = "" e.Row.Cells(5).Text = "" - e.Row.Cells(6).Text = "" + e.Row.Cells(6).Text = "" + e.Row.Cells(7).Text = "" Dim Texto = $"Devolución: {e.Row.DBCampo("SerieFolio")} | " Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") diff --git a/asmx/WSApp.asmx b/asmx/WSApp.asmx index 7917b12e9..df4519040 100644 --- a/asmx/WSApp.asmx +++ b/asmx/WSApp.asmx @@ -43,6 +43,7 @@ Public Class WSApp ObjPS.Dispose() End Get End Property + Property GlobalDTMonedas() As DataTable Get GlobalDTMonedas = DirectCast(Application("GlobalDTMonedas"), DataTable) @@ -326,33 +327,42 @@ Public Class WSApp Application("GlobalDTCompProveedores") = value End Set End Property - Property GlobalDTProductosServicios(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional CveClasificacionCosto As Integer = -1, Optional Estatus As Integer = 1, Optional CvePS As Integer = -1, Optional AplicaParaVenta As Integer = -1, Optional CveTipoPS As Integer = -1) As DataTable - Get - If CveEmpresa = -1 Then - GlobalDTProductosServicios = DirectCast(Application("GlobalDTProductosServicios"), EnumerableRowCollection(Of DataRow)).CopyToDataTable - Else - - Dim Cons = DirectCast(Application("GlobalDTProductosServicios"), EnumerableRowCollection(Of DataRow)) - Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) - If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) - If CveClasificacionCosto >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacionCosto) = CveClasificacionCosto)) - If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) - If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS)) - If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) - If CveTipoPS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveTipoPS) = CveTipoPS)) - - '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 - GlobalDTProductosServicios = Cons.OrderBy(Function(a) a!PS).CopyToDataTable - Catch ex As Exception - GlobalDTProductosServicios = New DataTable - End Try - End If - - End Get - Set(value As DataTable) - Application("GlobalDTProductosServicios") = value - End Set + Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) + If CveEmpresa <> -1 Then + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSSimplificado(CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() + ObjPS.Dispose() + + End If + + + Dim Cons = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)) + + Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) + If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) + If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo)) + If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) + If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) + If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS)) + + Try + GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable + Catch ex As Exception + GlobalDTPSSimplificado = New DataTable + End Try + + Else + GlobalDTPSSimplificado = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) + Application(AppNombre) = value + End Set End Property Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable Get @@ -715,26 +725,39 @@ Public Class WSApp End If If ListaPS IsNot Nothing Then Dim Continuar As Boolean = False - Dim ObjPS As New ClsProductosServicios - For Each PS In ListaPS - If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then - If ObjPS.DtResultados.Rows.Count > 0 Then - Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal() - Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero() - - Continuar = (CveTipoPS = 2 AndAlso Existencia > 0) OrElse (CveTipoPS = 1) - - If Not Continuar Then - Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.") - Exit For - End If - Else - Continuar = False - Retorno.Mensajes.Add("No se pudo comprobar la existencia.") - Exit For - End If - End If - Next + Dim ObjPS As New ClsProductosServicios + Try + For Each PS In ListaPS + Dim CveTipoPS As Integer = GlobalDTPSSimplificado(CveEmpresa, CvePS:=PS.CvePS).FiltroPrimeroValor("CveTipoPS").ToEntero() + If CveTipoPS > 0 Then + If CveTipoPS = 2 Then + If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then + If ObjPS.DtResultados.Rows.Count > 0 Then + Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal() + 'Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero() + + Continuar = Existencia > 0 + + If Not Continuar Then + Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.") + Exit For + End If + Else + Continuar = False + Retorno.Mensajes.Add("No se pudo comprobar la existencia.") + Exit For + End If + End If + End If + Else + Continuar = False + Retorno.Mensajes.Add("No se pudo comprobar si es producto o servicio.") + End If + Next + Catch ex As Exception + OnError("Ocurrió un error al consultar la existencia", ex) + Continuar = False + End Try ObjPS.Dispose() If Continuar Then @@ -1374,8 +1397,8 @@ Public Class WSApp Row("Total") = (PS.Cantidad.Value * PS.Precio) Row("TotalImporte") = Math.Round(PS.Cantidad.Value * PS.Precio, 2) - - Row("SATClaveProdServ") = DrPS("SATClavePS") + + Row("SATClaveProdServ") = DrPS("SATClavePS") Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") Row("EntregaDirecta") = EntregaDirecta