2
Hello, I am trying to assemble this code, however it is not working properly, if possible analyze because I did not find the errors...
<script src="jscripts/jquery.min.js" type="text/javascript"></script>
<script>
function AtualizaMensalidade(tributacao, tipo_emp, fat_mes, qt_func, bcos_contas, LabelID)
{
tributacao = $('#tributacao').val();
tipo_emp = $('#tipo_emp').val();
fat_mes = $('#fat_mes').val();
qt_func = $('#qt_func').val();
bcos_contas = $('#bcos_contas').val();
var MesCalc = (qt_func * 20) + tipo_emp + fat_mes + tributacao;
if (isNaN(MesCalc)) {
document.getElementById(LabelID).innerHTML = "- -";
}
else {
document.getElementById(LabelID).innerHTML = formatDinheiro(MesCalc, "R$");
}
}
function formatDinheiro(n, currency) {
return currency + " " + n.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
}
</script>
<div class="container">
<div class="col-md-4 alinha">
<label>Tipo de atividade</label>
<select id="tributacao" name="tributacao" class="form-control input" onchange="Mensalidade(this.value,'tributacao','tipo_emp','fat_mes','qt_func','bcos_contas','AtualizaMensalidade')" />>
<option value="0">Escolha</option>
<option value="49.90">MEI</option>
<option value="219">Simples Nacional</option>
<option value="319">Lucro Presumido</option>
<option value="2500">Lucro Real</option>
</select>
</div>
<div class="col-md-4 alinha">
<label>Tipo de atividade</label>
<select id="tipo_emp" name="tipo_emp" class="form-control input" onchange="Mensalidade(this.value,'tributacao','tipo_emp','fat_mes','qt_func','bcos_contas','AtualizaMensalidade')">
<option value="0">Escolha</option>
<option value="30">Serviços</option>
<option value="150">Industrial</option>
<option value="80">Comercial</option>
<option value="110">Serviços e Comercio</option>
</select>
</div>
<div class="col-md-4 alinha">
faturamento mes<br>
<input type="number" id="fat_mes" name="fat_mes" class="form-control input" onchange="Mensalidade(this.value,'tributacao','tipo_emp','fat_mes','qt_func','bcos_contas','AtualizaMensalidade')">
</div>
</div><br>
<div class="container">
<div class="col-md-4 alinha">
<label>Numero de Funcionarios</label>
<input type="number" id="qt_func" name="qt_func" class="form-control input" onchange="Mensalidade(this.value,'tributacao','tipo_emp','fat_mes','qt_func','bcos_contas','AtualizaMensalidade')">
</div>
<div class="col-md-4 alinha">
</label>Quantidade de contas</label>
<input type="number" id="bcos_contas" name="bcos_contas" value="0" class="form-control input" onchange="Mensalidade(this.value,'tributacao','tipo_emp','fat_mes','qt_func','bcos_contas','AtualizaMensalidade')">
</div>
<div class="alinha">Resultado: R$ <span id="AtualizaMensalidade">---</span></div>
</div>
It would be easier if you mentioned what is not working properly!
– Thiago Luiz Domacoski
Welcome to Sopt! Read on How to ask and mcve to know how to elaborate a question of easy understanding and so can be helped. For example, what error are you having in your code, what is working?
– carlosfigueira
Vinicius explain better to us, what you expected to happen and does not happen and what you have tried to do, if this code ai is yours or was already in production when you took the project... So we can help you better my friend. @Sergio has already published an answer that can solve your problem below.
– Paulo Roberto
the mistake I have is that the total value does not appear in the end, because I am new in this language... but I know that it is a simple account to do, but I am lost....
– Vinicius Nakamura