Cancelacion de Traspaso, cancealar solo lo pendiente por recibir

This commit is contained in:
2020-04-06 12:11:57 -07:00
parent cf3006ca42
commit fc9bbb7702

View File

@@ -1550,28 +1550,53 @@ Partial Class Inventarios_TraspasoAlmacen
Else
Dim CveMovimientoDetalleSalida As Integer = 0
Dim importe As Double = 0
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
CveMovimientoDetalleSalida = Dr("CveMovimientoDetalle").ToString.ToEntero
Dim Cantidad As Double = Dr("Cantidad").ToString.ToDouble
Dim PrecioUnitario As Double = Dr("PU").ToString.ToDouble
If CveMovimientoDetalleSalida <= 0 Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
For Each GvRow As GridViewRow In GvDatosRecepcion.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
'DEBE CONSIDERAR SOLO LAS FILAS QUE TENGA PRODUCTOS, NO EL TOTALIZADOR
If CvePS > 0 Then
CveMovimientoDetalleSalida = GvRow.DataKey("CveMovimientoDetalle").ToString.ToEntero
Dim Cantidad As Double = GvRow.DataKey("Cantidad").ToString.ToDouble
Dim PrecioUnitario As Double = GvRow.DataKey("PU").ToString.ToDouble
If CveMovimientoDetalleSalida <= 0 Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, GvRow.DataKey("CveUM").ToEntero, CvePS, PrecioUnitario, GvRow.DataKey("CveAF").ToEntero, -1, GvRow.DataKey("SerieLote").ToString, Lote:=GvRow.DataKey("Lote"), Batch:=GvRow.DataKey("Batch"), CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
End If
importe += Cantidad * PrecioUnitario
End If
importe += Cantidad * PrecioUnitario
Next
Else
ErrorMovInv = True
TextoError = "Ocurrió un error al obtener los movimientos de salida"
End If
End If
Next
'If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
' For Each Dr As DataRow In ObjInventario.DtResultados.Rows
' CveMovimientoDetalleSalida = Dr("CveMovimientoDetalle").ToString.ToEntero
' Dim Cantidad As Double = Dr("Cantidad").ToString.ToDouble
' Dim PrecioUnitario As Double = Dr("PU").ToString.ToDouble
' If CveMovimientoDetalleSalida <= 0 Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al guardar los movimientos de salida"
' Exit For
' End If
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al guardar los movimientos de entrada"
' Exit For
' End If
' importe += Cantidad * PrecioUnitario
' Next
'Else
' ErrorMovInv = True
' TextoError = "Ocurrió un error al obtener los movimientos de salida"
'End If
If Not ErrorMovInv Then
Dim ImporteDecimal As Decimal = importe.ToDecimal.RoundSQL