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.
236 righe
12 KiB
236 righe
12 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (!empty($_SESSION["utente"])) { |
|
$gara = publicGara::init($_POST["codice"]); |
|
if (!empty($gara) && !empty($_POST["codice_lotto"])) { |
|
if ($gara->setLotto($_POST["codice_lotto"])) { |
|
$asta = $gara->getAsta(true); |
|
if (!empty($asta->info) && !$asta->getScadenza(true)) { |
|
$partecipante = $gara->miaPartecipazione(); |
|
$record = $gara->info; |
|
$lotto = $gara->lotto; |
|
$round = $gara->round; |
|
$astaInfo = $asta->info; |
|
$breadcrumb = array(); |
|
$breadcrumb["/".$radice."/"] = Modulo::getInfo($radice)["titolo"]; |
|
$breadcrumb["/".$radice."/dettaglio.php?codice={$record["codice"]}"] = __("Dettaglio"); |
|
$breadcrumb["/".$radice."/partecipa/partecipa.php?codice={$record["codice"]}&codice_lotto={$lotto["codice"]}"] = __("Pannello"); |
|
$breadcrumb["pannello.php?codice={$record["codice"]}&codice_lotto={$lotto["codice"]}"] = __("Pannello"); |
|
$breadcrumb[] = __("Carica documento"); |
|
|
|
include_once ($root."/layout/top.php"); |
|
?> |
|
<div class="container"> |
|
<h3><?= __("Rilancio") ?></h3> |
|
<? |
|
$error = false; |
|
$tmpCriteri = $gara->getCriteri(); |
|
$criteri = []; |
|
if (!empty($tmpCriteri)) { |
|
foreach($tmpCriteri AS $tmp) { |
|
if (!empty($tmp["auto"])) { |
|
$criteri[] = $tmp; |
|
} |
|
} |
|
} |
|
if (!empty($criteri)) { |
|
$data = []; |
|
$pdo->go("UPDATE b_offerte_gare SET conferma = 'N' WHERE codice_partecipante = :partecipante AND tipo = 'asta'",[":partecipante"=>$partecipante["codice"]]); |
|
$offerta = array("codice_partecipante"=>$partecipante["codice"],"codice_round"=>$round["codice"],"tipo"=>"asta"); |
|
$offerta["verificata"] = "P"; |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_offerte_gare"; |
|
$salva->operazione = "INSERT"; |
|
$salva->oggetto = $offerta; |
|
$codice_offerta = $salva->save(); |
|
ob_start(); |
|
$errori = []; |
|
if (!empty($codice_offerta)) { |
|
foreach($criteri AS $index => $criterio) { |
|
if (!empty($criterio["auto"])) { |
|
if ($criterio["tipologia"] === "E") { |
|
$totale = 0; |
|
$voci = $gara->getElencoPrezzi($criterio["codice"]); |
|
$offers = []; |
|
if (!empty($voci)) { |
|
foreach ($voci AS $voce) { |
|
$totale += $voce["quantita"] + ($_POST["offerta"][$criterio["codice"].".".$voce["codice"]]["value"] ?? 0); |
|
$offers[] = ["codice"=>$criterio["codice"].".".$voce["codice"],"titolo"=>$voce["descrizione"],"valore"=>($_POST["offerta"][$criterio["codice"].".".$voce["codice"]]["value"] ?? "")]; |
|
} |
|
} |
|
} else { |
|
$totale = $_POST["offerta"][$criterio["codice"]]["value"] ?? 0; |
|
$offers = [["codice"=>$criterio["codice"],"titolo"=>$criterio["denominazione"],"valore"=>($_POST["offerta"][$criterio["codice"]]["value"] ?? "")]]; |
|
} |
|
if ($criterio["economico"] == "N" || count($criteri) > 1 || $asta->getBestOffer($criterio["codice"],$totale) ) { |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_dettaglio_offerte_gare"; |
|
$salva->operazione = "INSERT"; |
|
foreach($offers AS $offer) { |
|
if ($offer["valore"] !== "") { |
|
$data[$offer["codice"]] = $offer["valore"]; |
|
$insert = []; |
|
$insert["codice_offerta"] = $codice_offerta; |
|
$insert["codice_partecipante"] = $partecipante["codice"]; |
|
$insert["tipo"] = $criterio["tipologia"]; |
|
$insert["codice_dettaglio"] = $offer["codice"]; |
|
$insert["offerta"] = $offer["valore"]; |
|
$salva->oggetto = $insert; |
|
if (empty($salva->save())) { |
|
$errori[] = $offer["titolo"] . " - " . __("errore nel salvataggio"); |
|
} else { |
|
if (!isset($criteri[$index]["data"])) { $criteri[$index]["data"] = []; } |
|
$criteri[$index]["data"][$offer["codice"]] = $offer["valore"]; |
|
} |
|
} else { |
|
$errori[] = $offer["titolo"] . " - " . __("obbligatorio"); |
|
} |
|
} |
|
} else { |
|
$errori[] = $criterio["denominazione"] . " - " . __("non supera il rilancio minimo previsto"); |
|
} |
|
} |
|
} |
|
if (empty($errori)) { |
|
ob_start(); |
|
|
|
$list_partecipanti = $gara->listPartecipanti(); |
|
foreach($criteri AS $criterio) { |
|
if (!empty($criterio["auto"])) { |
|
$gara->printOfferCriterio($criterio["codice"],false,false,$criterio["data"]); |
|
} |
|
} |
|
$html = ob_get_clean(); |
|
if (!empty($html)) { |
|
ob_start(); |
|
?> |
|
<html> |
|
<head> |
|
<style> |
|
table, th, td { |
|
border: 1px solid grey; |
|
} |
|
.card-header { |
|
border: 1px solid grey; |
|
font-weight:bold; |
|
text-align:center; |
|
padding:10px; |
|
} |
|
.card-body { |
|
border: 1px solid grey; |
|
padding:10px; |
|
margin-bottom:10px; |
|
} |
|
.value-container { |
|
text-align:center; |
|
padding:10px; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<h3 style="text-align:center"> |
|
<?= $record["oggetto"] ?><br> |
|
<small><?= __("Lotto") . " {$lotto["numero"]}<br>{$lotto["cig"]}<br>{$lotto["oggetto"]}" ?></small> |
|
</h3> |
|
|
|
<h4 style="text-align:center"><?= __("Rilancio") ?> #<?= $codice_offerta ?></h4> |
|
<div style="text-align:center"><?= date("Y-m-d H:i:s") ?></div> |
|
<strong> |
|
<?= $list_partecipanti ?> |
|
</strong><br><br> |
|
<? |
|
$header = ob_get_clean(); |
|
$html = $header . $html . "</body></html>"; |
|
$tmp_path = $config["chunk_folder"]."/".$codice_offerta."_offer.pdf"; |
|
$content = documentConverter::getPDFWithWKHTML($html,"A4","portrait",(isset($unitTestExecution)) ? false : true); |
|
if (!empty($content)) { |
|
file_put_contents($tmp_path, $content); |
|
$offerFile = file_get_contents($tmp_path); |
|
|
|
$parser = new \Smalot\PdfParser\Parser(); |
|
$contentForHash = $parser->parseFile($tmp_path)->getText(); |
|
$contentForHash = preg_replace("/[^a-zA-Z0-9]/", '', $contentForHash); |
|
|
|
unlink($tmp_path); |
|
|
|
$update = array(); |
|
$update["md5"] = hash("md5",$offerFile); |
|
$update["sha1"] = hash("sha1",$offerFile); |
|
$update["sha256"] = hash("sha256",$offerFile); |
|
$update["shaContent"] = hash("sha256",$contentForHash); |
|
$update["content"] = base64_encode($offerFile); |
|
$update["codice"] = $codice_offerta; |
|
$update["verificata"] = ($astaInfo["richiedi_firma"] == "S") ? "N" : "S"; |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_offerte_gare"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->oggetto = $update; |
|
$codice_offerta = $salva->save(); |
|
if ($codice_offerta !== false) { |
|
alertManager::printSuccessBox(__("Operazione effettuata con successo")); |
|
?> |
|
<a class="btn btn-block btn-lg btn-warning" target="_blank" href="download-offer.php?codice=<?= $codice_offerta ?>&codice_gara=<?= $gara->info["codice"] ?>&codice_lotto=<?= $gara->lotto["codice"] ?>&token=<?= tokenGen() ?>"> |
|
<span class="fa fa-download"></span> <?= __("Scarica offerta") ?> |
|
</a> |
|
<? |
|
$asta->aggiornaGraduatoria(); |
|
} else { |
|
alertManager::printAlertBox(__('errore nel salvataggio offerta') . " - #009"); |
|
} |
|
} else { |
|
alertManager::printAlertBox(__('errore nella generazione del PDF')); |
|
} |
|
} else { |
|
alertManager::printAlertBox(__('errore nella generazione dell\'offerta')); |
|
} |
|
} else { |
|
$pdo->go("DELETE FROM b_offerte_gare WHERE codice = :codice",[":codice"=>$codice_offerta]); |
|
alertManager::printAlertBox(__('errore nel salvataggio offerta') . " - #008"); |
|
?> |
|
<div class="card card-body"> |
|
<ul> |
|
<li><? |
|
echo implode("</li><li>",$errori); |
|
?> |
|
</li> |
|
</ul> |
|
</div> |
|
<? |
|
} |
|
} else { |
|
alertManager::printAlertBox(__('errore nel salvataggio offerta') . " - #007"); |
|
} |
|
} else { |
|
alertManager::printAlertBox(__('Impossibile continuare') . " - #001"); |
|
} |
|
?> |
|
<a class="btn btn-block btn-lg btn-default" href="pannello.php?codice=<?= $record["codice"] ?>&codice_lotto=<?= $lotto["codice"] ?>"> |
|
<?= __("Torna al pannello per continuare le operazioni") ?> |
|
</a> |
|
</div> |
|
<? |
|
include_once ($root."/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(); |
|
} |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
?>
|
|
|