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.
171 righe
7.8 KiB
171 righe
7.8 KiB
<? |
|
$error = true; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; |
|
include_once($configPath); |
|
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice)) { |
|
$enti = $_SESSION["utente"]->getEntiBeneficiari(false); |
|
if ($enti !== false) { |
|
if (count($enti) > 1 && !isset($_GET["ente"])) { |
|
$error = false; |
|
?> |
|
<div class="card"> |
|
<div class="card-header"> |
|
<span class="card-title"><?= __("Scegli l'ente") ?></span> |
|
</div> |
|
<div class="card-body"> |
|
<? if (!empty($enti[$_SESSION["ente"]->codice])) { ?> |
|
<button class="btn btn-primary btn-block" onClick="showModalWithURL('190/listXML.php?ente=0')"> |
|
<?= __("Generale") ?> |
|
</button> |
|
<? } ?> |
|
<? |
|
foreach($enti AS $id => $ente) { |
|
?> |
|
<button class="btn btn-primary btn-block" onClick="showModalWithURL('190/listXML.php?ente=<?= $ente["codice"] ?>')"> |
|
<?= $ente["denominazione"] ?> |
|
</button> |
|
<? |
|
} |
|
?> |
|
</div> |
|
</div> |
|
<? |
|
} else { |
|
$gestore = false; |
|
if (count($enti) === 1) { |
|
$ente = $_SESSION["ente"]->codice; |
|
} else { |
|
if (isset($_GET["ente"])) { |
|
if ($_GET["ente"] === "0") { |
|
$gestore = true; |
|
$ente = $_SESSION["ente"]->codice; |
|
} else { |
|
$ente = $enti[$_GET["ente"]]["codice"]; |
|
} |
|
} |
|
} |
|
if (isset($ente)) { |
|
$error = false; |
|
$selectAnni = "SELECT anno_riferimento FROM b_simog "; |
|
$selectLotti = "SELECT count(b_simog_lotti.codice) AS tot FROM b_simog_lotti JOIN b_simog ON b_simog_lotti.codice_simog = b_simog.codice |
|
WHERE b_simog.anno_riferimento = :anno AND b_simog_lotti.eliminato = 'N' AND b_simog.stato <> '90' "; |
|
if ($gestore) { |
|
$selectAnni .= " WHERE codice_gestore = :ente "; |
|
$selectLotti .= " AND b_simog.codice_gestore = :ente "; |
|
} else { |
|
$selectAnni .= " WHERE codice_ente = :ente "; |
|
$selectLotti .= " AND b_simog.codice_ente = :ente "; |
|
} |
|
$selectAnni .= " GROUP BY anno_riferimento ORDER BY anno_riferimento DESC"; |
|
$anni = $pdo->go($selectAnni,[":ente"=>$ente]); |
|
$lotti = $pdo->prepare($selectLotti); |
|
$lotti->bindValue(":ente",$ente); |
|
if ($anni->rowCount() > 0) { |
|
?> |
|
<h3><?= $enti[$ente]["denominazione"] ?></h3> |
|
<div class="table-responsive"> |
|
<table class="table table-striped table-bordered"> |
|
<thead> |
|
<tr> |
|
<th width="10"><?= __("Anno") ?></th> |
|
<th width="10"><?= __("Lotti") ?></th> |
|
<th>URL</th> |
|
<th width="150"></th> |
|
<th width="170"></th> |
|
<th width="170"></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? |
|
while($anno = $anni->fetch(PDO::FETCH_ASSOC)) { |
|
$anno = $anno["anno_riferimento"]; |
|
$lotti->bindValue(":anno",$anno); |
|
$lotti->execute(); |
|
if ($lotti->rowCount() > 0) { |
|
$path = anac::getXMLPath($ente,$anno,$gestore); |
|
?> |
|
<tr> |
|
<td class="text-center"><?= $anno ?></td> |
|
<td class="text-center"><?= $lotti->fetch(PDO::FETCH_ASSOC)["tot"] ?></td> |
|
<td class="text-center"> |
|
<? |
|
$generato = false; |
|
$update = false; |
|
if (is_file($path)) { |
|
adaptMemoryLimitToFile($path); |
|
$generato = true; |
|
echo anac::getURL190($ente,$anno,$gestore); |
|
$md5 = md5(file_get_contents($path)); |
|
$md5U = md5(anac::generaXML($ente,$anno,$gestore,true)); |
|
if ($md5 != $md5U) { $update = true; } |
|
} else { |
|
?> |
|
<div class="badge badge-info"><span class="fa fa-exclamation-triangle"></span> <?= __("File non generato") ?></div> |
|
<? |
|
} |
|
?> |
|
</td> |
|
<td class="text-center"> |
|
<? |
|
if ($generato) { |
|
$errors = anac::validateXML190($path); |
|
if (!empty($errors)) { |
|
?> |
|
<button class="btn btn-danger btn-block btn-sm" onClick="showModalWithURL('190/showErrors.php?ente=<?= $ente ?>&anno=<?= $anno ?>&gestore=<?= ($gestore ? 1 : 0) ?>')"> |
|
<span class="fa fa-exclamation-triangle"></span> <?= __("Errori") ?> <span class="badge"><?= count($errors) ?></span> |
|
</button> |
|
<? |
|
} else { |
|
?> |
|
<span class="fa fa-check text-success fa-2x"></span> |
|
<? |
|
} |
|
} |
|
?> |
|
</td> |
|
<td class="text-center"> |
|
<form action="190/downloadCSV.php" target="_blank" method="post"> |
|
<input type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input type="hidden" name="ente" value="<?= $ente ?>"> |
|
<input type="hidden" name="anno" value="<?= $anno ?>"> |
|
<input type="hidden" name="gestore" value="<?= ($gestore ? 1 : 0) ?>"> |
|
<button class="btn btn-sm btn-block btn-info"> |
|
<?= __("Download CSV") ?> |
|
</button> |
|
</form> |
|
</td> |
|
<td class="text-center"> |
|
<form action="190/generaXML.php" method="post"> |
|
<input type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input type="hidden" name="ente" value="<?= $ente ?>"> |
|
<input type="hidden" name="anno" value="<?= $anno ?>"> |
|
<input type="hidden" name="gestore" value="<?= ($gestore ? 1 : 0) ?>"> |
|
<button class="btn btn-sm btn-block btn-<?= ($generato) ? "warning" : "primary" ?>"> |
|
<?= ($generato) ? __("Aggiorna XML") : __("Genera XML") ?> |
|
</button> |
|
<? if ($update) { ?> |
|
<small class="badge badge-danger"><?= __("Richiesto Aggiornamento") ?></small> |
|
<? } ?> |
|
</form> |
|
</td> |
|
</tr> |
|
<? |
|
} |
|
} |
|
?> |
|
</tbody> |
|
</table> |
|
</div> |
|
<? |
|
} else { |
|
alertManager::printAlertBox(__("Nessun risultato")); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|