0
I have a tbody mixed tr of these:
<tr class="odd">
<td class="id-despesa">
<p class="orig">
<?php echo $exibe2->id ?>
</p>
</td>
<td class="data-despesa">
<p class="orig">
<?php echo $exibe2->data ?>
</p>
</td>
<td class="funcionario-despesa">
<p class="orig">
<?php echo $exibe2->funcionario ?>
</p>
</td>
<td class="valor-rep">
<p class="orig">
<?php echo $exibe2->valorRep ?>
</p>
</td>
</tr>
As you can see, the table data is being pulled from the BD, but finally, what I need is to add all the values of the td’s with class rep value where staff-expenditure is equal to "x". It would be the equivalent of this in PHP: SELECT value-rep FROM table WHERE employee-expense=='x' and then add up all the received values, I think they got to mean what I meant by that comparison.
I already have a function to add up all the values of rep value as you can see:
var valorComSoma = 0;
$('#boxCom .valor-rep').each(function (i) {
valorComSoma = parseFloat($(this).text().replace(/[^0-9]/g, '')) +valorComSoma;
});
I would need to sort of add a filter to that function or something like that, as I mentioned earlier.
Perfect Matthew Veloso, thank you very much!
– dalton gonzalo Fuentes