From b98f0362dda393e52904ae00098c952a49b82d6f Mon Sep 17 00:00:00 2001 From: janeth arvizu Date: Thu, 7 Nov 2019 12:43:23 -0700 Subject: [PATCH] Validacion de Recepcion de Usados --- Ventas/PV.aspx.vb | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index a76ce216c..da6b993e0 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -3482,13 +3482,50 @@ Partial Class PV Return False End If - Dim CantidadUsados As Decimal = 0 + + 'Validacion de Recepción de Usados + Dim Vendido As Decimal = 0 + Dim Entregado As Decimal = 0 + Dim UltimoEntregado As Decimal = 0 + For Each Gvr As GridViewRow In GvRecepcionUsados.Rows If Gvr.RowType = DataControlRowType.DataRow Then - CantidadUsados = CantidadUsados + Gvr.FCTextBox("TxtCantidad").Text.ToEntero() + If Gvr.FCTextBox("TxtCantidad").Text.ToEntero() > 0 Then + Entregado += (Gvr.FCTextBox("TxtCantidad").Text.ToEntero * Gvr.DataKey("Cargo").ToDecimal) + UltimoEntregado = Gvr.DataKey("Cargo").ToDecimal + End If End If Next + If Entregado > 0 Then + 'Calcular Vendido + Dim DTTamanios As New DataTable + Dim ObjAcum As New ClsAcumuladores + If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then + DTTamanios = ObjAcum.DtResultados + End If + ObjAcum.Dispose() + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + + If DTTamanios.Rows.Count > 0 And DTTamanios IsNot Nothing And DrPS("CveTamaño").ToString.ToEntero > 0 Then + Vendido = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { DrPS("CveTamaño") }").ToDecimal + End If + + If Entregado > Vendido Then + If (Entregado - Vendido) >= UltimoEntregado Then + Alert("No puede entregar un cargo mayor a lo Vendido", TipoMensaje.MsgAdvertencia) + Return False + End If + End If + End If + + 'Dim CantidadUsados As Decimal = 0 + 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows + ' If Gvr.RowType = DataControlRowType.DataRow Then + ' CantidadUsados = CantidadUsados + Gvr.FCTextBox("TxtCantidad").Text.ToEntero() + ' End If + 'Next + 'If CantidadUsados > TxtCantidad.Text.ToEntero() Then ' Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia) ' Return False