Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
113 righe
5.0 KiB
113 righe
5.0 KiB
<? if (isset($criterio) && isset($data) && isset($bozza)) { ?> |
|
<div class="card mb-2"> |
|
<div class="card-header"> |
|
<? |
|
if (!empty($criterio["codice_padre"])) { |
|
$padre = $this->getCriteri($criterio["codice_padre"])[0]; |
|
?> |
|
<small><?= $padre["denominazione"] ?></small><br> |
|
<? |
|
} |
|
?> |
|
<strong class="card-title"><?= $criterio["denominazione"] ?></strong><br> |
|
<?= $criterio["descrizione"] ?> |
|
<? if ($edit) { ?> |
|
<small class="float-right"> |
|
<?= tuttogareMath::getFormule()[$criterio["auto"]]["formula"] ?> |
|
</small> |
|
<? } ?> |
|
</div> |
|
<div class="card-body m-0 p-0"> |
|
<? |
|
$elencoPrezzi = $this->getElencoPrezzi($criterio["codice"]); |
|
if (!empty($elencoPrezzi)) { |
|
?> |
|
<table <?= ($edit) ? 'class="table table-striped table-condensed m-0 p-0"' : "style='width:100%'"; ?>> |
|
<thead> |
|
<tr> |
|
<th><?= __("Voce") ?></th> |
|
<th><?= __("Unità di misura") ?></th> |
|
<th><?= __("Tipo") ?></th> |
|
<th><?= __("Quantita") ?></th> |
|
<th><?= __("Offerta") ?></th> |
|
<th><?= __("Totale voce") ?></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? |
|
$totaleElenco = 0; |
|
foreach ($elencoPrezzi as $voce) { |
|
$value = $data[$criterio["codice"].".".$voce["codice"]] ?? ""; |
|
if ($value === "" && isset($dettagli)) { |
|
$dettagli->bindValue(":codice_dettaglio", $criterio["codice"] . "." . $voce["codice"]); |
|
$dettagli->execute(); |
|
$value = $dettagli->fetch(PDO::FETCH_ASSOC)["offerta"] ?? ""; |
|
} |
|
?> |
|
<tr> |
|
<td><?= $voce["descrizione"] ?></td> |
|
<td style="text-align:center"><?= $voce["unita"] ?></td> |
|
<td style="text-align:center"><?= ($voce["tipo"] == "corpo") ? __("A corpo") : __("A misura") ?></td> |
|
<td <?= ($edit) ? "id=\"quantita{$voce["codice"]}\"" : "" ?> style="text-align:center"><?= $voce["quantita"] ?></td> |
|
<td style="text-align:center"> |
|
<? if ($edit) { ?> |
|
<input type="text" rel="<?= ($bozza) ? "N" : "S" ?>;0;0;N" data-voce="<?= $voce["codice"] ?>" onChange="aggiornaTotale(<?= $criterio["codice"] ?>,<?= $criterio["decimali"] ?>)" class="voce-<?= $criterio["codice"] ?> offer-input form-control text-center" title="<?= $voce["descrizione"] ?>" name="offerta[<?= $criterio["codice"] ?>.<?= $voce["codice"] ?>][value]" id="offerta-<?= $criterio["codice"] ?>.<?= $voce["codice"] ?>" value="<?= $value ?>"> |
|
<? } else { |
|
if (is_numeric($value)) { |
|
?> |
|
<strong><?= number_format($value, $criterio["decimali"], ",", ".") ?></strong> |
|
<? |
|
} |
|
} |
|
if ($value > 0) { |
|
$unitario_arrotondato = number_format($value, $criterio["decimali"],".",""); |
|
$totaleVoce = $unitario_arrotondato * $voce["quantita"]; |
|
} else { |
|
$totaleVoce = 0; |
|
} |
|
$totaleElenco += $totaleVoce; |
|
?> |
|
</td> |
|
<td <?= ($edit) ? "class=\"totaleVoce{$criterio["codice"]}\" id=\"totaleVoce{$voce["codice"]}\"" : ""; ?> style='text-align:right'> |
|
<?= number_format($totaleVoce, $criterio["decimali"], ",", ".") ?> |
|
</td> |
|
</tr> |
|
<? } ?> |
|
</tbody> |
|
<tfoot> |
|
<tr> |
|
<td colspan="5" style="text-align:right"><?= __("Totale") ?></td> |
|
<td style='text-align:right' <?= ($edit) ? "id=\"totaleElenco{$criterio["codice"]}\"" : "" ?>> |
|
<?= number_format($totaleElenco, $criterio["decimali"], ",", ".") ?> |
|
</td> |
|
</tr> |
|
</tfoot> |
|
</table> |
|
<? if ($edit && !isset($funzioneTotaleEPDichiarata)) { |
|
$funzioneTotaleEPDichiarata = true; ?> |
|
<script> |
|
function aggiornaTotale(idCriterio,decimali) { |
|
var totaleElenco = 0; |
|
$(".voce-"+idCriterio).each(function() { |
|
if ($(this).val() !== "") { |
|
valida($(this)); |
|
idVoce = $(this).data('voce'); |
|
offerto = parseFloat($(this).val()); |
|
quantita = parseFloat($("#quantita"+idVoce).html()); |
|
totaleVoce = offerto * quantita; |
|
totaleElenco += totaleVoce; |
|
$("#totaleVoce"+idVoce).html(number_format(totaleVoce,decimali,",",".")); |
|
} |
|
}); |
|
$("#totaleElenco"+idCriterio).html(number_format(totaleElenco,decimali,",",".")); |
|
} |
|
</script> |
|
<? } ?> |
|
<? |
|
} else { |
|
alertManager::printAlertBox(__("Errore configurazione Elenco prezzi")); |
|
} |
|
?> |
|
</div> |
|
</div> |
|
<? } ?>
|