gestione gare pubbliche
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.
 
 
 
 
 

293 righe
13 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$id_modulo = "risultati";
$cmd_info = gara::getInfoModulo($id_modulo);
if (!empty($_SESSION["utente"]) && ($_SESSION["utente"]->permission($cmd_info["modulo_riferimento"],$_GET["codice"],$id_modulo) || !empty($reportGeneration))) {
if (!isset($gara)) {
$codice_round = $_GET["codice_round"] ?? NULL;
$gara = gara::init($_GET["codice"],$codice_round);
}
if (!empty($gara)) {
$record = $gara->info;
$round = $gara->round;
$titolo_modulo = __($cmd_info["titolo"]);
$breadcrumb = array();
$breadcrumb["/".$radice."/"] = Modulo::getInfo($radice)["titolo"];
$breadcrumb["/".$radice."/panel.php?codice=".$record["codice"]."&codice_round=".$round["codice"]] = __("Pannello");
if (!empty($_GET["codice_lotto"]) && count($gara->getLotti()) > 1) {
$breadcrumb["/gare/provvisoria/grid.php?codice=".$record["codice"]."&codice_round=".$round["codice"]] = __("Scelta lotto");
}
$breadcrumb[""] = $titolo_modulo;
if (empty($_GET["pdf"]) && empty($_GET["odt"]) && empty($reportGeneration)) {
include_once ($beRoot."/layout/top.php");
?><h1><?= $titolo_modulo ?></h1><?
}
$gara->printSelectLottiConditions = ["hasAggiudicatari"];
if ($gara->chooseLotto($_GET["codice_lotto"] ?? false,"{$_SERVER["PHP_SELF"]}?codice=".$record["codice"]."&codice_round=".$round["codice"])) {
$lock = $gara->checkLock($cmd_info["id"]);
$partecipanti = $gara->getGraduatoria();
$criteri = $gara->getCriteriValutabili();
$tecnici = $gara->getCriteriTecnici();
$economici = $gara->getCriteriEconomici();
$showManodopera = false;
if (count($economici) === 1 && $gara->getInterpretazioneArt41() === "scorporato" && !empty($gara->getCriteriEconomiciValutabili())) {
$showManodopera = true;
$criterio = reset($economici);
$offerte = $gara->getOfferte($criterio["codice"]);
$costi = $gara->getCostiManodoperaPartecipanti();
}
if (!empty($partecipanti)) {
ob_start();
$infoAnomalia = json_decode($gara->getExtraInfo()["lotto"]["info-anomalia-{$round["codice"]}"]??"",true);
if (!empty($infoAnomalia["riepilogo"])) {
alertManager::printInfoBox(__("Riepilogo anomalia"),$infoAnomalia["riepilogo"]);
}
?>
<div class="card">
<div class="card-body p-0">
<div class="table-responsive">
<table style="width:100%" class="table table-striped">
<thead>
<tr>
<th width="10">#</th>
<th width="10"></th>
<th colspan="2"><?= __("Partecipante") ?></th>
<?
if (count($criteri) > 1) {
$cont = "A";
for($i = 0;$i<count($criteri);$i++) {
?>
<th class="text-center" width="10"><?= $cont ?></th>
<?
$cont++;
}
}
?>
<? if (!empty($tecnici)) { ?><th class="text-center" width="10"><?= __("Tecnico") ?></th><? } ?>
<? if ($showManodopera) { ?>
<th class="text-center" width="10"><?= __("Offerta") ?></th>
<th class="text-center" width="10"><?= __("Manodopera") ?></th>
<? } ?>
<? if (!empty($economici)) { ?><th class="text-center" width="10"><?= __("Economico") ?></th><? } ?>
<? if (count($criteri) > 1) { ?><th class="text-center" width="10"><?= __("Totale") ?></th><? } ?>
</tr>
</thead>
<tbody>
<?
$i = 1;
$totaleSpesa = 0;
$aggiudicatari = 0;
foreach($partecipanti AS $partecipante) {
$offertaEconomica = 0;
if (isset($offerteEconomiche[$partecipante["codice"]])) {
$offertaEconomica = $offerteEconomiche[$partecipante["codice"]];
}
$infoOE = oeManager::getOE($partecipante["codice_operatore"]);
$class="";
$icon="";
if ($partecipante["aggiudicatario"] == "S") {
$aggiudicatari++;
$icon = "<span class=\"fa fa-trophy\"></span>";
$class = "bg-success";
$totaleSpesa += $offertaEconomica;
} else if ($partecipante["escluso"] == "S") {
$icon = "<span class=\"fa fa-times\"></span>";
$class = "bg-danger";
} else if ($partecipante["anomalia"] == "S") {
$icon = "<span class=\"fa fa-exclamation\"></span>";
$class = "bg-warning";
}
?>
<tr class="<?= $class ?>">
<td><strong><?= $i ?></strong></td>
<td><?= $icon ?></td>
<td width="120"><?= $partecipante["codice_fiscale"] ?></td>
<td>
<?= $partecipante["ragione_sociale"] ?>
<? if ($class == "bg-danger") { ?>
<br><small><?= $partecipante["motivazione"] ?></small>
<? } else if ($class == "bg-warning") { ?>
<br><small><?= $partecipante["motivazione_anomalia"] ?></small>
<? } ?>
</td>
<?
if (count($criteri) > 1) {
foreach($criteri AS $criterio) {
?><td class="text-center" width="10"><?
$punti = 0;
$sql = "SELECT * FROM b_gare_punteggi_partecipanti WHERE codice_criterio = :codice_criterio AND codice_partecipante = :codice_partecipante ";
$ris = $pdo->go($sql,array(":codice_criterio"=>$criterio["codice"],":codice_partecipante"=>$partecipante["codice"]));
if ($ris->rowCount() == 1) {
$punti = $ris->fetch(PDO::FETCH_ASSOC);
if (!empty($punti)) {
$punti = $punti["valore"];
}
}
echo $punti;
?></td><?
}
}
?>
<? if (!empty($tecnici)) { ?><td class="text-center"><strong><?= (!empty($partecipante["totaleTecnico"])) ? $partecipante["totaleTecnico"] : __("Escluso") ?></strong></td><? } ?>
<? if ($showManodopera) { ?>
<td class="text-center" width="10"><?= (!empty($partecipante["totaleEconomico"])) ? $offerte[$partecipante["codice"]] : __("Escluso") ?></td>
<td class="text-center" width="10"><?= (!empty($partecipante["totaleEconomico"])) ? number_format($costi[$partecipante["codice"]],2,",",".") : __("Escluso") ?></td>
<? } ?>
<? if (!empty($economici)) { ?><td class="text-center"><strong><?= (!empty($partecipante["totaleEconomico"])) ? $partecipante["totaleEconomico"] : __("Escluso") ?></strong></td><? } ?>
<? if (count($criteri) > 1) { ?><td class="text-center"><strong><?= (!empty($partecipante["totale"])) ? $partecipante["totale"] : __("Escluso") ?></strong></td><? } ?>
</tr>
<?
$i++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="card mt-5">
<div class="card-header">
<span class="card-title"><?= __("Criteri di valutazione") ?></span>
</div>
<div class="card-body p-0">
<table style="width:100%" class="table table-striped">
<thead>
<tr>
<th width="10">#</th>
<th><?= __("Criteri") ?></th>
<th width="10" class="text-center"><?= __("Peso") ?></th>
</thead>
<tbody>
<?
$cont = "A";
foreach($criteri AS $criterio) {
$padre = "";
if (!empty($criterio["codice_padre"])) {
$padre = $gara->getCriteri($criterio["codice_padre"])[0]["denominazione"] . " - ";
}
?>
<tr>
<td width="10"><?= $cont ?></td>
<td>
<strong><?= $padre . $criterio["denominazione"] ?></strong><br>
<small><?= $criterio["descrizione"] ?></small>
</td>
<td width="10" class="text-center"><?= $criterio["peso"] ?></td>
</tr>
<?
$cont++;
}
?>
</tbody>
</table>
</div>
</div>
<?
$table = ob_get_clean();
if (empty($_GET["pdf"]) && empty($_GET["odt"]) && empty($reportGeneration)) {
echo $table;
$_GET["pdf"] = true;
$query_string = http_build_query($_GET);
?><br>
<a target="_blank" href="grid.php?<?= $query_string ?>" class="btn btn-block btn-danger">
<span class="far fa-file-pdf"></span> <?= __("Esporta PDF") ?>
</a>
<?
} else if (!empty($_GET["pdf"]) || !empty($_GET["odt"])) {
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title><?= __("Graduatoria") ?></title>
<style type="text/css">
html, body {
margin: 0px;
padding: 0px;
}
body {
font-family: "Helvetica", sans-serif;
font-size: 10pt;
padding-top: 1cm;
}
.card {
margin:0.1cm 0.5cm;
padding:0.5cm;
}
.text-center {
text-align:center
}
.bg-success {
background-color:#0C0;
}
.bg-danger {
background-color:#C00;
}
table {
width: 100%;
border-spacing: 0;
border-collapse: collapse;
}
th {
background-color:#CCC;
}
td,th {
border: 1px solid #666;
margin:0;
padding: 0.2cm;
}
</style>
</head>
<body>
<div style="margin-left:0.5cm">
<h1><?= $record["oggetto"] ?> - <?= __("Fase") ?> <?= $round["numero"] ?></h1>
<h3><?= __("Lotto") ?> <?= $gara->lotto["numero"] ?> - <?= $gara->lotto["cig"] ?></h3>
</div>
<?
$table = ob_get_clean() . $table;
$table .= "</body></html>";
if (!empty($_GET["pdf"])) {
$content = documentConverter::getPDFWithDOMPDF($table,"A3","landscape");
$fileName = 'Graduatoria.pdf';
if (!empty($content)) {
$error = false;
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename={$fileName}");
echo $content;
}
} else {
$table = documentConverter::cleanHTML($table);
if (documentConverter::generateODT($table,"Graduatoria")) {
$error = false;
} else {
?>
<h1><?= __("Si è verificato un errore durante la generaione del documento") ?></h1>
<?
}
}
}
} else {
alertManager::printWarningBox(__("Nessun risultato"));
}
}
if (empty($_GET["pdf"]) && empty($_GET["odt"]) && empty($reportGeneration)) { include_once ($beRoot."/layout/bottom.php"); }
} else {
echo '<meta http-equiv="refresh" content="0;URL=/index.php">';
die();
}
} else {
echo '<meta http-equiv="refresh" content="0;URL=/index.php">';
die();
}
?>