[254] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /************************************************************************/
|
---|
| 4 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 5 | /* by Roberto Gigli & Luciano Apolito */
|
---|
| 6 | /* http://www.eleonline.it */
|
---|
| 7 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 8 | /************************************************************************/
|
---|
| 9 | /* Modulo Controllo dei voti */
|
---|
| 10 | /* Amministrazione */
|
---|
| 11 | /************************************************************************/
|
---|
| 12 |
|
---|
| 13 | if (!defined('ADMIN_FILE')) {
|
---|
| 14 | die ("You can't access this file directly...");
|
---|
| 15 | }
|
---|
[257] | 16 | global $dbi;
|
---|
[254] | 17 | $aid=$_SESSION['aid'];
|
---|
| 18 | $prefix=$_SESSION['prefix'];
|
---|
| 19 | $currentlang=$_SESSION['lang'];
|
---|
| 20 | $id_comune=$_SESSION['id_comune'];
|
---|
| 21 | $id_cons_gen=$_GET['id_cons_gen'];
|
---|
| 22 | $bgcolor1=$_SESSION['bgcolor1'];
|
---|
| 23 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
| 24 |
|
---|
| 25 | $perms=ChiSei($id_cons_gen);
|
---|
| 26 | if ($perms<16 or !$id_cons_gen) die("$perms Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
|
---|
[257] | 27 | $sql="SELECT t1.tipo_cons,t2.id_cons,t2.solo_gruppo,t2.disgiunto FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'";
|
---|
| 28 | $res = $dbi->prepare("$sql");
|
---|
| 29 | $res->execute();
|
---|
| 30 | list($tipo_cons,$id_cons,$dettnulli,$disgiunto) = $res->fetch(PDO::FETCH_NUM);
|
---|
| 31 | $sql="SELECT genere,voto_g,voto_l FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' ";
|
---|
| 32 | $res = $dbi->prepare("$sql");
|
---|
| 33 | $res->execute();
|
---|
| 34 | list($genere,$votog,$votol) = $res->fetch(PDO::FETCH_NUM);
|
---|
[254] | 35 |
|
---|
| 36 | include("modules/Elezioni/funzionidata.php");
|
---|
| 37 | include("modules/Elezioni/ele.php");
|
---|
[344] | 38 | if (isset($param['ops'])) $ops=addslashes($param['ops']); else $ops='';
|
---|
[254] | 39 | if (isset($param['pag'])) $pag=intval($param['pag']); else $pag=0;
|
---|
| 40 | if (isset($param['num_ref'])) $num_ref=intval($param['num_ref']);
|
---|
| 41 | if (isset($param['num_refs'])) $num_refs=intval($param['num_refs']);
|
---|
| 42 | ele();
|
---|
| 43 | //**************************************************************************
|
---|
| 44 | // ELE
|
---|
| 45 | //**************************************************************************
|
---|
| 46 |
|
---|
| 47 | global $prefix, $dbi,$fascia,$limite,$genere,$votog;
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | if($genere!=0){
|
---|
[257] | 51 | $sql="SELECT t1.id_gruppo,sum(t1.voti),sum(t1.solo_gruppo) FROM ".$prefix."_ele_voti_gruppo as t1 left join ".$prefix."_ele_gruppo as t2 on t1.id_gruppo=t2.id_gruppo where t1.id_cons='$id_cons' group by t1.id_gruppo order by t2.num_gruppo";
|
---|
| 52 | $res = $dbi->prepare("$sql");
|
---|
| 53 | $res->execute();
|
---|
[254] | 54 | ####################### inserimento scrutinio in percentuale -- per i gruppi
|
---|
| 55 |
|
---|
[257] | 56 | $sql="select sum(validi),sum(nulli+bianchi+contestati+voti_nulli) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
|
---|
| 57 | $resperc = $dbi->prepare("$sql");
|
---|
| 58 | $resperc->execute();
|
---|
| 59 | list($scruvalidi,$scrunulli)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
| 60 | $sql="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' group by data,orario order by data desc, orario desc limit 0,1 ";
|
---|
| 61 | $resperc = $dbi->prepare("$sql");
|
---|
| 62 | $resperc->execute();
|
---|
| 63 | list($totschede)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
| 64 | if($totschede)
|
---|
[254] | 65 | $grpercscru=number_format(($scruvalidi+$scrunulli)*100/$totschede,2);
|
---|
[257] | 66 | else $grpercscru=0;
|
---|
[254] | 67 |
|
---|
| 68 | ################# calcolo voti di lista espressi
|
---|
[424] | 69 | $sql="select sum(validi_lista),sum(nulli+bianchi+voti_nulli+contestati+solo_gruppo),sum(voti_nulli_lista),sum(contestati_lista),sum(solo_gruppo) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
|
---|
[257] | 70 | $resperc = $dbi->prepare("$sql");
|
---|
| 71 | $resperc->execute();
|
---|
[424] | 72 | list($scruvalidi,$scrunulli,$nullista,$contlista,$sgs)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
[254] | 73 |
|
---|
[257] | 74 | if($totschede)
|
---|
[362] | 75 | $listpercscru=number_format(($scruvalidi+$scrunulli+$nullista+$contlista)*100/$totschede,2);
|
---|
[257] | 76 | else $listpercscru=0;
|
---|
| 77 | $listtotschede=$totschede;
|
---|
[362] | 78 | $listtotvoti=($scruvalidi+$scrunulli+$nullista+$contlista);
|
---|
[254] | 79 |
|
---|
| 80 | #################
|
---|
[362] | 81 | echo "<table border=\"1\" cellpadding=\"5\" style=\"border-collapse: collapse; outline: thin solid;\"><tr align=\"middle\"><th colspan=\"5\">Riepilogo dei voti per gruppo e liste collegate</th></tr>";
|
---|
[254] | 82 | echo "<tr align=\"middle\"><td colspan=\"3\"><b>Scrutinate $listtotvoti schede su $listtotschede ($listpercscru %)</b></td><td colspan=\"2\"><b>Scrutinate $listtotvoti schede su $listtotschede ($listpercscru %)</b></td></tr>";
|
---|
[362] | 83 | echo "<tr align=\"middle\"><td><b>"._GRUPPO."</b></td><td><b>Voti</b></td><td><b>Al solo</br>"._GRUPPO."</b></td><td><b>Lista</br>Collegata</b></td><td><b>Voti alla lista</b></td></tr>";
|
---|
[254] | 84 | $totl=0;$totg=0;$totsg=0;
|
---|
[257] | 85 | while(list($id_gruppo,$votigruppo,$sologruppo)=$res->fetch(PDO::FETCH_NUM))
|
---|
[254] | 86 | {
|
---|
| 87 | $totg+=$votigruppo; $totsg+=$sologruppo;
|
---|
[364] | 88 | $sql="SELECT id_lista,num_lista,descrizione FROM ".$prefix."_ele_lista where id_cons='$id_cons' and id_gruppo='$id_gruppo' order by num_lista";
|
---|
[315] | 89 | $resl = $dbi->prepare("$sql");
|
---|
| 90 | $resl->execute();
|
---|
| 91 | $numliste=$resl->rowCount();
|
---|
[362] | 92 | if(!$numliste) $numliste=1;
|
---|
[257] | 93 | $sql="SELECT num_gruppo,descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
[315] | 94 | $resg2 = $dbi->prepare("$sql");
|
---|
| 95 | $resg2->execute();
|
---|
[257] | 96 | list($num_gruppo,$descrg)=$resg2->fetch(PDO::FETCH_NUM);
|
---|
[254] | 97 |
|
---|
[424] | 98 | echo "<tr style=\"border-top: 2px solid;\"><td rowspan=\"$numliste\">$descrg</td><td rowspan=\"$numliste\" align=\"right\"><h2>".number_format($votigruppo,0,',','.')."</h2></td><td rowspan=\"$numliste\" align=\"right\"><h2>";
|
---|
| 99 | if($sologruppo) echo number_format($sologruppo,0,',','.');
|
---|
| 100 | echo "</h2></td>";
|
---|
[254] | 101 | $currlst=0;
|
---|
[257] | 102 | while (list($id_lista,$num_lista,$descrl)=$resl->fetch(PDO::FETCH_NUM))
|
---|
[254] | 103 | {
|
---|
[257] | 104 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_lista='$id_lista'";
|
---|
| 105 | $resl2 = $dbi->prepare("$sql");
|
---|
| 106 | $resl2->execute();
|
---|
| 107 | list($votilista)=$resl2->fetch(PDO::FETCH_NUM);
|
---|
[254] | 108 | if($currlst) echo "<tr>"; else $currlst++;
|
---|
| 109 | $totl+=$votilista;
|
---|
| 110 | echo "<td>$num_lista) $descrl</td><td align=\"right\"><h2>".number_format($votilista,0,',','.')."</h2></td></tr>";
|
---|
| 111 | }
|
---|
[362] | 112 | if(!$currlst) echo "<td></td><td></td></tr>";
|
---|
[254] | 113 | }
|
---|
[424] | 114 | if(!$totsg)$totsg=$sgs;
|
---|
[362] | 115 | echo "<tr style=\"border-top: 2px solid;\"><td rowspan=\"3\"><b>Totale</b></td><td rowspan=\"3\" align=\"right\"><h1>".number_format($totg,0,',','.')."</h1></td><td rowspan=\"3\" align=\"right\"><h1>".number_format($totsg,0,',','.')."</h1></td><td align=\"right\"><b>Validi di lista</b></td><td align=\"right\"><h1>".number_format($totl,0,',','.')."</h1></td></tr><tr><td align=\"right\"><b>Nulli di lista</b></td><td align=\"right\"><h1>".number_format($nullista,0,',','.')."</h1></td></tr><tr><td align=\"right\"><b>Contestati di lista</b></td><td align=\"right\"><h1>".number_format($contlista,0,',','.')."</h1></td></tr>";
|
---|
[254] | 116 | echo "</table></br>";
|
---|
| 117 |
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | echo "</table>";
|
---|
| 121 |
|
---|
| 122 | # if ($votog) echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
| 123 | # else echo "<fieldset><legend>"._GRUPPO."</legend>";
|
---|
| 124 |
|
---|
| 125 |
|
---|
| 126 | include ("footer.php");
|
---|
| 127 |
|
---|
| 128 | ?>
|
---|