Corrección Proveedores Abonar Descuentos

This commit is contained in:
rakcsle
2023-08-22 09:36:03 -07:00
parent 94f63102f7
commit b1d44befb3
2 changed files with 25 additions and 7 deletions

View File

@@ -346,11 +346,13 @@
<td style="text-align: right; width: 25%">
<asp:CheckBox Text=" Seguir Registrando Pagos" ID="ChkSeguirRegistrando" CssClass="md-checksd" runat="server" Checked="true" />
</td>
<td style="text-align: left; width: 30%">
<td style="text-align: left; width: 45%">
<asp:Button ID="BtnIEGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar" class="btn btn-primary" />
<asp:CheckBox Text=" No Validar ante SAT" ID="ChkNoValidaSAT" CssClass="md-checksd" runat="server" Checked="false" Visible="false" />
<asp:ValidationSummary ID="VS" runat="server" DisplayMode="BulletList" ShowSummary="true" ValidationGroup="GrpGuardar" />
<asp:CheckBox Text="Descuento" ID="chkaplicaDescuento" CssClass="md-checksd" runat="server" Checked="false" OnCheckedChanged="chkaplicaDescuento_CheckedChanged" AutoPostBack="true" Visible="false" />
</td>
</tr>
</table>
@@ -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);
}
}

View File

@@ -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("<a Class=""Texto thickbox"" href=""/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxPProveedor&CveProveedor={0}&CveCompra={1}&TB_iframe=true&height=370&width=900"" />Ir</a>", 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