--Validaciones en devoluciones

This commit is contained in:
2024-04-29 18:52:18 -07:00
parent 17428b548d
commit 1e4ad59344
2 changed files with 24 additions and 5 deletions

View File

@@ -1967,7 +1967,7 @@ Partial Class Inventarios_EntregaAlmacen
ValidaUsaConsola()
Dim CantidadVenta As Decimal = 0
'' INICIA: VALIDACIONES
'Valida el estatus de la Venta, si es = 5 O DevolucionVenta = 2, NO SE SURTE!
@@ -1975,6 +1975,7 @@ Partial Class Inventarios_EntregaAlmacen
If ObjVentaInv.GetEstatusVentaPorSurtir(CveVentaSurtir) Then
TipoEstatus = ObjVentaInv.TipoEstatus
EsDevolucionVenta = ObjVentaInv.EsDevolucionVenta
CantidadVenta = ObjVentaInv.CantidadVenta
End If
ObjVentaInv.Dispose()
@@ -2166,7 +2167,9 @@ Partial Class Inventarios_EntregaAlmacen
DtDatosVenta = ObjInventario.DtResultados
End If
Dim CantidadGV As Decimal = GvDatos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("CantidadF").ToDecimal)
If CantidadGV > DtDatosVenta.SUMD("CantidadF") Then
'VERIFICA SI LA CANTIDADES NOT SON MAYORES A LO ESTABLECIDO EN LA VENTA O LO QUE FALTA POR RECIBIR
If CantidadGV > DtDatosVenta.SUMD("CantidadF") OrElse Cantidad > CantidadVenta Then
ObjInventario.RollBack()
ObjInventario.Dispose()
ObjConta.Dispose()
@@ -2175,7 +2178,13 @@ Partial Class Inventarios_EntregaAlmacen
'' identificar que productos no están completos.
CargaVentaPorSurtir(CveVentaSurtir)
CargaPendientes()
Alert("Ha sido cambiada la informacion de existencias de la venta actual, se han recargado la información.", TipoMensaje.MsgAdvertencia)
If Cantidad > CantidadVenta Then
Alert("No se puede procesar una cantidad mayor a la que esta definida en la venta.", TipoMensaje.MsgAdvertencia)
Else
Alert("Ha sido cambiada la informacion de existencias de la venta actual, se han recargado la información.", TipoMensaje.MsgAdvertencia)
End If
Exit Sub
End If
@@ -3290,6 +3299,14 @@ Partial Class Inventarios_EntregaAlmacen
End If
End If
'SI YA FUE DEVUELTO LA CANTIDAD COMPLETA DE LA DEVOLUCION,MARCAR PARA QUE NO APAREZCA
If Not ErrorMovInv AndAlso Cantidad.RoundSQL(6) = CantidadVenta.RoundSQL(6) AndAlso TipoDocto = "Dev" Then
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVentaSurtir) Then
TextoError.AppendFormat("Ocurrió un error al actualizar la devolucion.")
ErrorMovInv = True
End If
End If
If Not ErrorMovInv Then
ObjInventario.Commit()