Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurM-web authored Jul 1, 2024
1 parent aa1766a commit ee2a26c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion codigo/AlugarxCompar/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ function calcularResultados() {
const outrosCustos = parseFloat(document.getElementById('outrosCustos').value);
const prazoFinanciamento = parseInt(document.getElementById('prazoFinanciamento').value);
const cet = parseFloat(document.getElementById('cet').value) / 100;



if (isNaN(valorCompra) || isNaN(valorAluguel) || isNaN(valorizacaoAnual) || isNaN(valorIGPM) || isNaN(entrada) || isNaN(outrosCustos) || isNaN(prazoFinanciamento) || isNaN(cet) ) {
alert("Por favor, preencha todos os campos.");
return;
}

const valorFinanciado = valorCompra - entrada + outrosCustos;
const jurosMensal = cet / 12;
Expand Down Expand Up @@ -42,4 +49,4 @@ function calcularResultados() {
document.getElementById('patrimonioTotalAlugInvestindo').value = patrimonioTotalAlugInvestindo.toFixed(2);
document.getElementById('totalPagoAluguel').value = valorTotalAluguel.toFixed(2);
document.getElementById('totalAportadoAlugInvestindo').value = totalAportadoAlugInvestindo.toFixed(2);
}
}

0 comments on commit ee2a26c

Please sign in to comment.