permission($radice)) { if (isset($_GET["draw"])) { $return = array(); $return["draw"] = (int)$_GET["draw"]; $return["recordsTotal"] = (int)0; $return["recordsFiltered"] = (int)0; $bind = array(":codice_gestore"=>$_SESSION["ente"]->codice); $sql = "SELECT b_simog.codice, b_simog.stato, b_simog.smart_cig, b_simog.oggetto, b_simog.anno_riferimento, b_simog.cf_utente_simog, b_simog.codice_ente FROM b_simog LEFT JOIN b_simog_lotti ON b_simog.codice = b_simog_lotti.codice_simog AND b_simog_lotti.eliminato = 'N' WHERE b_simog.codice_gestore = :codice_gestore "; if ($_SESSION["utente"]->gerarchia > 10) { $ids = Utente::getPermissionsInModulo($_SESSION["ente"]->codice,$_SESSION["utente"]->codice,"anac"); $ids = implode(",",$ids); $sql .= " AND b_simog.codice IN ({$ids}) "; } if (!$_SESSION["utente"]->fromHere()) { $sql .= " AND codice_ente = :codice_ente "; $bind[":codice_ente"] = $_SESSION["utente"]->codice_ente; } $risultati = $pdo->go($sql . " GROUP BY b_simog.codice",$bind); if ($risultati->rowCount() > 0) { $return["recordsTotal"] = (int)$risultati->rowCount(); $filterApplied = false; if (!empty($_GET["search"]["value"])) { $filterApplied = true; $sql .= " AND ( "; $suddivisione = suddivisione_pdo($_GET["search"]["value"],"b_simog.oggetto"); $sql .= "(" . $suddivisione["sql"] . ") OR "; $bind = array_merge($bind,$suddivisione["bind"]); $suddivisione = suddivisione_pdo($_GET["search"]["value"],"b_simog.cf_utente_simog"); $sql .= "(" . $suddivisione["sql"] . ") OR "; $bind = array_merge($bind,$suddivisione["bind"]); $suddivisione = suddivisione_pdo($_GET["search"]["value"],"b_simog_lotti.cig"); $sql .= "(" . $suddivisione["sql"] . ") OR "; $bind = array_merge($bind,$suddivisione["bind"]); $suddivisione = suddivisione_pdo($_GET["search"]["value"],"b_simog.cf_utente_simog"); $sql .= "(" . $suddivisione["sql"] . ") OR "; $bind = array_merge($bind,$suddivisione["bind"]); $suddivisione = suddivisione_pdo($_GET["search"]["value"],"b_simog_lotti.oggetto"); $sql .= "(" . $suddivisione["sql"] . ") "; $bind = array_merge($bind,$suddivisione["bind"]); $sql .= ") "; } if (isset($_GET["stato"]) && $_GET["stato"]!=="") { $filterApplied = true; $bind[":status"] = $_GET["stato"]; $sql .= " AND b_simog.stato = :status "; } $order = "b_simog.codice "; switch($_GET["order"][0]["column"]) { case "1": $order = "b_simog.codice "; break; case "2": $order = "b_simog.stato "; break; case "3": $order = "b_simog.oggetto "; break; case "4": $order = "b_simog.anno_riferimento "; break; case "6": $order = "b_simog.codice_ente "; break; } if ($_GET["order"][0]["dir"] == "desc") { $order.= "DESC "; } else { $order.= "ASC "; } $sql .= "GROUP BY b_simog.codice ORDER BY " . $order . ", b_simog.codice DESC "; $risultatiBeforLimit = $pdo->go($sql,$bind); if ($_GET["length"] !== "-1") { $sql.= "LIMIT ". (int)$_GET["start"] .", " . (int)$_GET["length"]; } $risultati = $pdo->go($sql,$bind); $anac = new anac; if ($risultati->rowCount() > 0) { if ($filterApplied) { $return["recordsFiltered"] = (int)$risultatiBeforLimit->rowCount(); } else { $return["recordsFiltered"] = $return["recordsTotal"]; } $return["data"] = array(); $stati = anac::getStati(); $ris_lotti = $pdo->prepare("SELECT codice, cig, 190data_inizio, 190data_fine, 190importoAggiudicato, 190liquidazioni FROM b_simog_lotti WHERE codice_simog = :simog AND eliminato = 'N' ORDER BY ordinamento"); while($record = $risultati->fetch(PDO::FETCH_ASSOC)) { $stato = $stati[$record["stato"]]; $row = array(); $row[] = '
'; $row[] = __($stato["titolo"]); ob_start(); if ($record["smart_cig"] == "S") { echo "" . __("SMART CIG") . ""; } ?>
bindValue(":simog",$record["codice"]); $ris_lotti->execute(); if ($ris_lotti->rowCount() > 0) { ?> rowCount() > 10) { ?>
" class="text-center rowCount() > 10) ? "collapse" : "" ?>"> fetch(PDO::FETCH_ASSOC)) { $btnStatus = "btn-info"; $icon = "fa fa-check"; $missing = $anac->check190Lotto($lotto); $tooltip = ""; if (!empty($missing)) { $icon = "fa fa-exclamation-triangle"; $btnStatus = "btn-danger"; foreach($missing AS $id) { $tooltip .= "
" . anac::labels190()[$id]; } } if (!empty($tooltip)) { $tooltip = "data-toggle='tooltip' data-placement='top' data-html='true' title='L.190/2012{$tooltip}'"; } $url = ($record["smart_cig"] == "N") ? "lotti/panel.php?codice_simog={$record["codice"]}&codice_lotto={$lotto["codice"]}" : "/backend/anac/panel.php?codice=".$record["codice"]; ?> class="btn btn-block btn-sm m-0 mb-1 p-0" href="">
"; $return["data"][] = $row; } } else { $return["data"] = array(); } } else { $return["data"] = array(); } echo json_encode($return); } } ?>