From b1d44befb371406529f8e5be60b7a431fdd63c08 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 22 Aug 2023 09:36:03 -0700 Subject: [PATCH] =?UTF-8?q?Correcci=C3=B3n=20Proveedores=20Abonar=20Descue?= =?UTF-8?q?ntos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bancos/ProveedoresAbonar.aspx | 13 ++++++++++--- Bancos/ProveedoresAbonar.aspx.vb | 19 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index 6546eea32..bc26fee0c 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -346,11 +346,13 @@ - + + + @@ -723,7 +725,7 @@ } } - function calculaDescuentoEscalonado(saldo, TxtDescuento, TxtAbonar) { + function calculaDescuentoEscalonado(saldo, TxtDescuento, TxtAbonar, chk,Text,Tipo) { let idTxtDescuento = TxtDescuento.id let idTxtAbonar = TxtAbonar.id @@ -738,17 +740,20 @@ if (isNaN(parseFloat(descuentoParts[0])) || descuentoParts[0] == "0") { $("#" + idTxtAbonar).val(saldo.toFixed(2)); + FnCambia(chk, TxtAbonar, saldo, 1, Text, Tipo); } else { let descuento = saldo * (parseFloat(descuentoParts[0]) / 100); abonarConDescuento = saldo - descuento; $("#" + idTxtAbonar).val(FormatoNumero(abonarConDescuento.toFixed(2),2)); + FnCambia(chk, TxtAbonar, saldo, 1, Text, Tipo); } } else if (descuentoParts.length === 2) { if (isNaN(parseFloat(descuentoParts[0]))) { $("#" + idTxtAbonar).val(""); + FnCambia(chk, TxtAbonar, saldo, 1, Text, Tipo); return; } @@ -759,7 +764,7 @@ let descuento = saldo * (parseFloat(descuentoParts[0]) / 100); abonarConDescuento = saldo - descuento; $("#" + idTxtAbonar).val(FormatoNumero(abonarConDescuento.toFixed(2), 2)); - + FnCambia(chk, TxtAbonar, saldo, 1, Text, Tipo); return; } @@ -769,10 +774,12 @@ let abonarConDescuento2 = abonarConDescuento - (abonarConDescuento * (parseFloat(descuentoParts[1]) / 100)); $("#" + idTxtAbonar).val(FormatoNumero(abonarConDescuento2.toFixed(2), 2)); + FnCambia(chk, TxtAbonar, saldo, 1, Text, Tipo); } else { $("#" + idTxtAbonar).val(""); + FnCambia(chk, TxtAbonar, saldo, 1, Text, Tipo); } } diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index b6fb5f55b..8499fa339 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -4,6 +4,7 @@ Option Strict On Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms +Imports Stimulsoft.Report.StiOptions.Export Partial Class Bancos_ProveedoresAbonar Inherits ClsPaginas @@ -316,7 +317,8 @@ Partial Class Bancos_ProveedoresAbonar End If If UsuarioActual.CveRol = 1 Then - GvCxP.Columns(11).Visible = True + 'GvCxP.Columns(11).Visible = True + chkaplicaDescuento.Visible = True End If End If @@ -504,6 +506,8 @@ Partial Class Bancos_ProveedoresAbonar e.Row.FCLiteral("LtlAux").Text = String.Format("Ir", e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveCompra")) e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',1);{3}", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", FiltroInv)) + + If Not PermiteModificarImporte Then e.Row.FCTextBox("TxtAbonar").Enabled = False If e.Row.DBCampo("CveCompraNC").ToEntero > 0 Then e.Row.FCHyperLink("HplNC").Visible = True @@ -537,7 +541,7 @@ Partial Class Bancos_ProveedoresAbonar e.Row.FCCheckBox("Chk").Enabled = False End If - e.Row.FCTextBox("TxtDescuento").Attributes.Add("onkeyup", $"calculaDescuentoEscalonado({e.Row.DBCampo("Saldo")},{e.Row.FCTextBox("TxtDescuento").ClientID},{e.Row.FCTextBox("TxtAbonar").ClientID})") + e.Row.FCTextBox("TxtDescuento").Attributes.Add("onkeyup", $"calculaDescuentoEscalonado({e.Row.DBCampo("Saldo")},{e.Row.FCTextBox("TxtDescuento").ClientID},{e.Row.FCTextBox("TxtAbonar").ClientID},{e.Row.FCCheckBox("Chk").ClientID},'El Importe no debe de exceder el saldo',1)") Else e.Row.FCTextBox("TxtDescuento").Visible = False @@ -848,8 +852,8 @@ Partial Class Bancos_ProveedoresAbonar Dim ImporteME As Decimal = 0 If Pago.CveMonedaPago = 2 Then ImporteME = Pago.ImportePago If Not UsaComplementariaBancos And Pago.CveMonedaPago = 2 Then - ImporteME = tImporteMN - tImporteMN = (tImporteMN * Pago.TCPago).RoundSQL + ImporteME = tImporteMN + tImporteMN = (tImporteMN * Pago.TCPago).RoundSQL End If If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, tImporteMN, 30, Referencia, ConceptoMovimiento, CveIE:=CveIE, CveProveedor:=CveProveedor, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto, ImporteME:=ImporteME) Then @@ -1658,5 +1662,12 @@ Partial Class Bancos_ProveedoresAbonar End Sub + + Protected Sub chkaplicaDescuento_CheckedChanged(sender As Object, e As EventArgs) + + GvCxP.Columns(11).Visible = chkaplicaDescuento.Checked + UPCompras.Update() + + End Sub End Class