--FIX aplicar devolucion

This commit is contained in:
2025-05-03 11:25:06 -07:00
parent fbc7db868e
commit d94eeeccc5

View File

@@ -39674,19 +39674,35 @@ Partial Class Ventas
Dim SaldoAlmacen As Decimal = 0
Dim PermiteCancelar As Boolean = True
Dim tCveVentaDevolucion As Integer = CveVenta
If CveVentaPadre > 0 Then
tCveVentaDevolucion = CveVentaPadre
DevolucionAlmacen = 0
End If
Dim CveTipoRelacion As Integer = -1
Using ObjVentas As New ClsVentas
If ObjVentas.GetVenta(tCveVentaDevolucion, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal()
CveTipoRelacion = RowVenta("CveTipoRelacion").ToString().ToEntero()
End If
End If
End Using
'SI ES REFACTURACION, TOMAR EXISTENCIA DE LA ORIGINAL
If CveTipoRelacion.Contiene(4) Then
If CveVentaPadre > 0 Then
tCveVentaDevolucion = CveVentaPadre
DevolucionAlmacen = 0
Using ObjVentas As New ClsVentas
If ObjVentas.GetVenta(tCveVentaDevolucion, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal()
End If
End If
End Using
End If
End If
Dim PuedeAplicarDevolucion As Boolean = False
'código temporal RMF. para devoluciones de facturas cargadas de saldos iniciales.
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso (TxtFecha.Text.ToDate.Year < 2025 OrElse CveVentaPadre > 0) Then