Validacion de Recepcion de Usados

This commit is contained in:
janeth arvizu
2019-11-07 12:43:23 -07:00
parent 47d0527f0c
commit b98f0362dd

View File

@@ -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