From 12957314cf6525d3bbb6c8298d58814f71e533d6 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 7 Mar 2024 17:03:31 -0700 Subject: [PATCH] =?UTF-8?q?-=20=20cambios=20en=20refacturaci=C3=B3n=20,=20?= =?UTF-8?q?que=20el=20pago=20sobre=20la=20nueva=20factura=20se=20utilice?= =?UTF-8?q?=20el=20pagoprepolizascompra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Compras/Compras.aspx.vb | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 3855b52f3..925c4074e 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -10,7 +10,6 @@ Imports System.Threading.Tasks Imports Newtonsoft.Json Imports Extensiones Imports MoreLinq -Imports ClbNegBICFDv3_3 Partial Class Compras_Compras Inherits ClsPaginas @@ -7035,7 +7034,7 @@ Partial Class Compras_Compras 'EMPIEZA REFACTURACION If Not ErrorPrepoliza AndAlso CveCompraRefacturacion > 0 Then - ErrorBitacora = GuardaRefacturacion(ObjCompras, ObjEventos, CvePrePoliza) + ErrorBitacora = GuardaRefacturacion(ObjCompras, ObjEventos, CvePrePoliza, ObjConta, CompraActual) If ErrorBitacora Then Alert("Ocurrió un error al hacer la Refacturación", TipoMensaje.MsgError) End If @@ -13098,7 +13097,7 @@ Partial Class Compras_Compras RegistraScript(String.Format("$('#{0}').modal('hide')", DivRefacturacion.ClientID)) End Sub - Private Function GuardaRefacturacion(ByRef ObjCompra As ClsCompras, ByRef ObjEventos As ClsOIEventos, CvePrePoliza As Integer) As Boolean + Private Function GuardaRefacturacion(ByRef ObjCompra As ClsCompras, ByRef ObjEventos As ClsOIEventos, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad, ByRef CompraActual As Compra) As Boolean Dim dr As DataRow = Nothing Dim ErrorBitacora As Boolean = False Dim IdPolizaAnterior As Integer = -1 @@ -13118,8 +13117,28 @@ Partial Class Compras_Compras If ChkRefacNC.Checked Then Tipo = 2 'CONTABILIZA REFACTURACION - If Not ObjCompra.Refacturacion(CveCompraRefacturacion, CveCompra, UsuarioActual.CveEmpresa, Tipo) Then + If ObjCompra.Refacturacion(CveCompraRefacturacion, CveCompra, UsuarioActual.CveEmpresa, Tipo) Then + Dim dttpagos As DataTable + If ObjCompra.GetComprasPagos(CveCompraRefacturacion, UsuarioActual.CveEmpresa) Then + dttpagos = ObjCompra.DtResultados + + For Each drp As DataRow In dttpagos.Rows + Dim Pago As New CompraPago + Pago.ImportePago = drp("ImporteMN").ToString.ToDecimal + Pago.CveIE = drp("CveIE").ToString.ToEntero + Pago.CveMonedaPago = 1 + Pago.CveCompraAmortizacion = -1 + Pago.TipoPago = If(drp("CveIE").ToString.ToEntero > 0, "B", "NC") + + Dim ErrorMovtosCxP As Boolean = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) + Next + + End If + + Else + ErrorBitacora = True + End If