diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index 32b656103..e766e9edc 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -567,7 +567,7 @@ } - function SumaValores() { + function SumaValores(aplicaTC) { var Importe = 0; var Comision = 0.00; @@ -581,7 +581,13 @@ if (textBoxes[i].value != '') { idd = textBoxes[i].id.replace('C_GvCxP_TxtAbonar_', ''); Facturas = Facturas + (Importe == 0 ? '' : ', ') + $get("C_GvCxP_HplF_" + idd).innerText; - Importe = parseFloat(Importe) + parseFloat(textBoxes[i].value.split(',').join('')); + let importeFactura = 0; + if (aplicaTC && $get('TxtTC') != null) { + importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join('')); + } else { + importeFactura = parseFloat(textBoxes[i].value.split(',').join('')); + } + Importe = parseFloat(Importe) + importeFactura; } } if (textBoxes[i].id.indexOf('C_GvCxP_TxtComision') >= 0) { @@ -641,13 +647,15 @@ } function CambiaPesosDolares() { - $get('TxtImporte').value = FormatoNumero(SumaValores(), 2); - $('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2)) + let ImporteDolares = SumaValores(true); + + $get('TxtImporte').value = FormatoNumero(ImporteDolares, 2); + $('#LtlTotalMXN').text(FormatoNumero(ImporteDolares, 2)) if ($("#LbImporteME").length) { - $get('LbImporteME').innerHTML = '$ ' + $get('TxtImporte').value + ' USD'; - $get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) * ToDouble($get('TxtTC').value), 2); - $get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) * ToDouble($get('TxtTC').value), 2); + $get('LbImporteME').innerHTML = '$ ' + FormatoNumero(SumaValores(false),2) + ' USD'; + $get('TxtImporte').value = FormatoNumero(ToDouble(ImporteDolares), 2); + $get('LtlTotalMXN').value = FormatoNumero(ToDouble(ImporteDolares), 2); } if ($get('TxtTotal') != null) {