From d94eeeccc50b71c60a7f01c544c88e489dd7deab Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 3 May 2025 11:25:06 -0700 Subject: [PATCH] --FIX aplicar devolucion --- Ventas/Ventas.aspx.vb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index e8e0dc05c..4fe7cfcee 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -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