Cancelacion del traspaso por cantidad especificada

This commit is contained in:
2023-02-10 18:26:15 -07:00
parent 788f3aa466
commit 7ff86b07b2

View File

@@ -1647,9 +1647,9 @@ Partial Class Inventarios_TraspasoAlmacen
'DEBE CONSIDERAR SOLO LAS FILAS QUE TENGA PRODUCTOS, NO EL TOTALIZADOR
If CvePS > 0 Then
CveMovimientoDetalleSalida = GvRow.DataKey("CveMovimientoDetalle").ToEntero
Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
If ChkRealizarDevolucion.Checked Then Cantidad = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal
'If ChkRealizarDevolucion.Checked Then Cantidad = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal
Dim PrecioUnitario As Decimal = GvRow.DataKey("PU").ToDecimal
If CveMovimientoDetalleSalida <= 0 Then
@@ -1657,7 +1657,16 @@ Partial Class Inventarios_TraspasoAlmacen
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
End If
If Cantidad <> 0 Then
Dim cantidadDisponibleValidacion As Decimal = GvRow.DataKey("Cantidad").ToDecimal - GvRow.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
If cantidadDisponibleValidacion < 0 Then
ErrorMovInv = True
TextoError = $"La cantidad a cancelar del producto '{GvRow.DataKey("Codigo")}-{GvRow.DataKey("PS")}' excede la del traspaso"
Exit For
End If
If Cantidad > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, GvRow.DataKey("CveUM").ToEntero, CvePS, PrecioUnitario, -1, -1, Serie:=GvRow.DataKey("Serie"), Lote:=GvRow.DataKey("Lote"), FechaCaducidad:=GvRow.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"