From ffca4c6e6be1d43081bbc6967b089803120bc569 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 13 Jun 2023 18:42:48 -0700 Subject: [PATCH] Actulizar TC de prepoliza al timbrar si se cambio el TC. --- Ventas/Ventas.aspx.vb | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9b7a3efa4..059d0372e 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2209,6 +2209,16 @@ Partial Class Ventas ViewState("EsGarantia") = value End Set End Property + + Private Property TipoCambioOriginal As Decimal + Get + Return (IfNull(ViewState("TipoCambioOriginal"), 0, ViewState("TipoCambioOriginal"))).ToString().ToDecimal() + End Get + Set(value As Decimal) + ViewState("TipoCambioOriginal") = value + End Set + End Property + Private Property DtMercancias As DataTable Get Return If(IsNothing(ViewState("DtMercancias")), Nothing, CType(ViewState("DtMercancias"), DataTable)) @@ -4780,6 +4790,7 @@ Partial Class Ventas HdnCveVenta.Value = CveVenta.ToString() Me.EsGarantia = CBool(DbRowVenta("EsGarantia")) + Me.TipoCambioOriginal = DbRowVenta("TipoCambioOriginal").ToString().ToDecimal() RFCReceptorVenta = DbRowVenta("RFCReceptor").ToString() 'Adjuntar archivo @@ -17102,7 +17113,24 @@ Partial Class Ventas End If End If - If ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then + Dim SeTimbro As Boolean = False + + Try + SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) + Catch ex As Exception + SeTimbro = False + End Try + + 'SI SE TIMBRO CON UN TIPO DE CAMBIO DISTINCTO, DEBE ACTUALIZAR LA PREPOLIZA + If SeTimbro AndAlso ChkEmitirComercioExterior.Checked AndAlso DdlTipoComprobante.SelectedValue = "Ing" AndAlso DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso TxtTipoCambio.Text.ToDecimal() > 1 AndAlso (TxtTipoCambio.Text.ToDecimal() <> TipoCambioOriginal) Then + Using ObjVentas As New ClsVentas + If ObjVentas.UpdateVentaTC(Me.CveVenta, UsuarioActual.CveEmpresa, TxtTipoCambio.Text.ToDecimal()) Then + Alert("Se actualizó el tipo de cambio del documento") + End If + End Using + End If + + If SeTimbro Then 'MENSAJE PRINCIPAL MensajeAlert = New StringBuilder