Fix ricalcolo totali aggiunta registrazione contabile da bulk

This commit is contained in:
valentina 2024-07-29 11:29:35 +02:00
parent f6b7fedc09
commit a8b7ea98b1
1 changed files with 18 additions and 2 deletions

View File

@ -192,8 +192,8 @@ echo '
<table class="table table-bordered">
<tr>
<th class="text-right">'.tr('Totale').'</th>
<th class="text-right" width="20%">'.moneyFormat($totale_dare).'</th>
<th class="text-right" width="20%">'.moneyFormat($totale_avere).'</th>
<th id="totale_dare" class="text-right" width="20%">'.moneyFormat($totale_dare).'</th>
<th id="totale_avere" class="text-right" width="20%">'.moneyFormat($totale_avere).'</th>
</tr>
</table>';
@ -370,6 +370,22 @@ $(document).on("keyup change", "input[id*=avere]", function() {
}
});
$(document).on("change", "[id*=dare], [id*=avere]", function() {
var totalDare = 0;
var totalAvere = 0;
$("[id*=dare]").each(function() {
totalDare += parseFloat($(this).val()) || 0;
});
$("[id*=avere]").each(function() {
totalAvere += parseFloat($(this).val()) || 0;
});
$("#totale_dare").text(totalDare.toFixed(2));
$("#totale_avere").text(totalAvere.toFixed(2));
});
function visualizzaMovimenti(button) {
let id_conto = $(button).parent().parent().find("select").val();
openModal("'.tr('Ultimi 25 movimenti').'", "'.$module->fileurl('dettagli.php').'?id_module=" + globals.id_module + "&id_conto=" + id_conto);