0
I would like to know how to calculate the values of a column and play in a field. They are automatically loaded
This is the table html. I want to add the column values valuables and play on the field qtdtotal just below.
<table class="table table-md-striped table-condensed" id="tblImpostos" tablename="tblImpostos" noaddbutton="true" nodeletebutton="true">
<thead>
<tr>
<th>Ano Competência</th>
<th>Mês Competência</th>
<th>Desconto</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input readonly type="text" class="form-control input-sm" name="anocompetenciaimpostos" id="anocompetenciaimpostos">
</td>
<td>
<input readonly type="text" class="form-control input-sm" name="mescompetenciaimpostos" id="mescompetenciaimpostos">
</td>
<td>
<input readonly type="text" class="form-control input-sm" name="descontoimpostos" id="descontoimpostos">
</td>
<td>
<input readonly type="text" class="form-control input-sm valor-calculado" name="valorimpostos" id="valorimpostos">
</td>
</tr>
</tbody>
</table>
<input readonly type="text" class="form-control input-sm" name="qtdtotal" id="qtdtotal">
This is the javascript that loads the data in the table
function getImpostos(){
if ($("#nmQtdListaImpostos").val() == "0"){
var chapafuncionario = $('#chapafuncionario').val();
var anoreferencia = $('#anoreferencia').val();
var mesreferencia = $('#mesreferencia').val();
var c1 = DatasetFactory.createConstraint("chapa", chapafuncionario, chapafuncionario, ConstraintType.MUST);
var c2 = DatasetFactory.createConstraint("anocomp", anoreferencia, anoreferencia, ConstraintType.MUST);
var c3 = DatasetFactory.createConstraint("mescomp", mesreferencia, mesreferencia, ConstraintType.MUST);
var constraints = new Array(c1, c2, c3);
var dataset = DatasetFactory.getDataset("dsImpostos", null, constraints, null);
for(var i = 0; i < dataset.values.length; i++) {
row = dataset.values[i];
linha = wdkAddChild('tblImpostos');
$("#nmQtdListaImpostos").val(linha);
$("#anocompetenciaimpostos___" + linha).val(row["ANOCOMP"]);
$("#mescompetenciaimpostos___" + linha).val(row["MESCOMP"]);
$("#descontoimpostos___" + linha).val(row["DESCRICAO"]);
$("#valorimpostos___" + linha).val(row["VALOR"]);
}
}
}