[139] | 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;
|
---|
[139] | 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);
|
---|
[139] | 35 |
|
---|
| 36 | include("modules/Elezioni/funzionidata.php");
|
---|
| 37 | include("modules/Elezioni/ele.php");
|
---|
| 38 | if (! get_magic_quotes_gpc()) $magic='addslashes'; else $magic='';
|
---|
| 39 | if (isset($param['ops'])) get_magic_quotes_gpc() ? $ops=$param['ops']:$ops=addslashes($param['ops']); else $ops='';
|
---|
| 40 | if (isset($param['pag'])) $pag=intval($param['pag']); else $pag=0;
|
---|
| 41 | if (isset($param['num_ref'])) $num_ref=intval($param['num_ref']);
|
---|
| 42 | if (isset($param['num_refs'])) $num_refs=intval($param['num_refs']);
|
---|
| 43 | ele();
|
---|
| 44 | //**************************************************************************
|
---|
| 45 | // ELE
|
---|
| 46 | //**************************************************************************
|
---|
| 47 |
|
---|
[257] | 48 | global $prefix, $dbi,$fascia,$limite,$genere,$votog;
|
---|
| 49 | $sql="SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'";
|
---|
| 50 | $res = $dbi->prepare("$sql");
|
---|
| 51 | $res->execute();
|
---|
| 52 | list($totm,$totf) = $res->fetch(PDO::FETCH_NUM);
|
---|
| 53 | $totel=$totm+$totf;
|
---|
| 54 | $sql="SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc, orario desc limit 0,1";
|
---|
| 55 | $res = $dbi->prepare("$sql");
|
---|
| 56 | $res->execute();
|
---|
| 57 | list($giorno,$ora)=$res->fetch(PDO::FETCH_NUM);
|
---|
| 58 | $sql="SELECT sum(voti_donne),sum(voti_uomini),sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$giorno' and orario='$ora'";
|
---|
| 59 | $res = $dbi->prepare("$sql");
|
---|
| 60 | $res->execute();
|
---|
| 61 | list($votf,$votm,$votc) = $res->fetch(PDO::FETCH_NUM);
|
---|
[250] | 62 | if($genere!=0){
|
---|
[257] | 63 | $sql="SELECT sum(solo_gruppo),sum(validi),sum(nulli),sum(bianchi),sum(contestati), sum(voti_nulli),sum(validi_lista),sum(voti_nulli_lista),sum(contestati_lista),sum(solo_lista) FROM ".$prefix."_ele_sezioni where id_cons=$id_cons";
|
---|
| 64 | $res = $dbi->prepare("$sql");
|
---|
| 65 | $res->execute();
|
---|
| 66 | list($sg,$validi,$nulli,$bianchi,$contestati,$votinulli,$validilista,$nullilista,$contestatilista,$sl)=$res->fetch(PDO::FETCH_NUM);
|
---|
[139] | 67 | echo "<center>";
|
---|
| 68 | echo "<fieldset><legend>"._VOTANTI."</legend>";
|
---|
| 69 | echo "<table border=\"1\" width=\"100%\"><tr><th>"._ISCRITTI."</TH><TH>"._UOMINI."</TH><TH>"._DONNE."</TH><TH>"._VOTIU."</TH><TH>"._VOTID."</TH><TH>"._VOTIE."</TH></TR>";
|
---|
| 70 | ECHO "<TR><TH>".number_format($totel,0,',','.')."</TH><TH>".number_format($totm,0,',','.')."</TH><TH>".number_format($totf,0,',','.')."</TH><TH>".number_format($votm,0,',','.')."</TH><TH>".number_format($votf,0,',','.')."</TH><TH>".number_format($votc,0,',','.')."</TH></TR></table><br/>";
|
---|
[257] | 71 | ECHO "</fieldset><br/><br/><br/>";
|
---|
[139] | 72 | $totnulli=$nulli+$bianchi+$contestati+$votinulli;
|
---|
[174] | 73 | if ($votog) echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
[257] | 74 | else echo "<fieldset><legend>"._GRUPPO."</legend>";
|
---|
[139] | 75 | echo "<table border=\"1\" width=\"100%\"><tr><th><b>"._VALIDI."</b></th><th>"._NULLI."</th><th>"._BIANCHI."</th><th>"._CONTESTATI."</th><th>"._VOTINULLI."</th><th>"._TOTNON."</th></TR>";
|
---|
| 76 | ECHO "<TR><TH>".number_format($validi,0,',','.')."</TH><TH>".number_format($nulli,0,',','.')."</TH><TH>".number_format($bianchi,0,',','.')."</TH><TH>".number_format($contestati,0,',','.')."</TH><TH>".number_format($votinulli,0,',','.')."</TH><TH>".number_format($totnulli,0,',','.')."</TH></TR></table><br/>";
|
---|
[257] | 77 | ECHO "</fieldset><br/><br/><br/>";
|
---|
| 78 | }else{
|
---|
| 79 | $sql="SELECT sum(si),sum(no),sum(validi),sum(nulli),sum(bianchi),sum(contestati),id_gruppo FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' group by id_gruppo";
|
---|
| 80 | $res = $dbi->prepare("$sql");
|
---|
| 81 | $res->execute();
|
---|
| 82 | while (list($si,$no,$validi,$nulli,$bianchi,$contestati,$idg) = $res->fetch(PDO::FETCH_NUM)){
|
---|
[258] | 83 | $sql="SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'";
|
---|
[257] | 84 | $resref = $dbi->prepare("$sql");
|
---|
| 85 | $resref->execute();
|
---|
| 86 | list($numgruppo,$descrizione) = mysql_fetch_row($resref);
|
---|
| 87 | echo "<fieldset><legend>"._GRUPPO."N. $numgruppo - $descrizione</legend>";
|
---|
| 88 | echo "<table border=\"1\" width=\"100%\"><tr><th><b> "._SI." </b></th><th><b>"._NO."</b></th><th><b>"._VALIDI."</b></th><th>"._NULLI."</th><th>"._BIANCHI."</th><th>"._CONTESTATI."</th><th>"._TOTNON."</th></TR>";
|
---|
| 89 | ECHO "<TR><TH>".number_format($si,0,',','.')."</TH><TH>".number_format($no,0,',','.')."</TH><TH>".number_format($validi,0,',','.')."</TH><TH>".number_format($nulli,0,',','.')."</TH><TH>".number_format($bianchi,0,',','.')."</TH><TH>".number_format($contestati,0,',','.')."</TH><TH>".number_format($nulli+$bianchi+$contestati,0,',','.')."</TH></TR></table><br/>";
|
---|
| 90 | # votanti-------------- <th><b>"._GRUPPO."</b></th><th><b>"._DESCR."</b></th> --- <TH>".$numgruppo."</TH><TH>".$descrizione."</TH>
|
---|
| 91 | $sql="SELECT sum(voti_donne),sum(voti_uomini),sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$giorno' and orario='$ora' and id_gruppo='$idg'";
|
---|
| 92 | $resv = $dbi->prepare("$sql");
|
---|
| 93 | $resv->execute();
|
---|
| 94 | list($votf,$votm,$votc) = $resv->fetch(PDO::FETCH_NUM);
|
---|
| 95 |
|
---|
| 96 | echo "<fieldset><legend>"._VOTANTI."</legend>";
|
---|
| 97 | echo "<table border=\"1\" width=\"100%\"><tr><th>"._ISCRITTI."</TH><TH>"._UOMINI."</TH><TH>"._DONNE."</TH><TH>"._VOTIU."</TH><TH>"._VOTID."</TH><TH>"._VOTIE."</TH></TR>";
|
---|
| 98 | ECHO "<TR><TH>".number_format($totel,0,',','.')."</TH><TH>".number_format($totm,0,',','.')."</TH><TH>".number_format($totf,0,',','.')."</TH><TH>".number_format($votm,0,',','.')."</TH><TH>".number_format($votf,0,',','.')."</TH><TH>".number_format($votc,0,',','.')."</TH></TR></table>";
|
---|
| 99 | ECHO "</fieldset><br/>";
|
---|
[250] | 100 | ECHO "</fieldset><br/><br/><br/>";
|
---|
| 101 |
|
---|
[257] | 102 | #-----------
|
---|
[250] | 103 | }
|
---|
[257] | 104 | }
|
---|
[235] | 105 |
|
---|
[257] | 106 | if ($genere==5 and !$votog) {
|
---|
| 107 | $totnullil=$nullilista+$contestatilista;
|
---|
| 108 | $id_conf=0;
|
---|
| 109 | $sql="SELECT t1.id_conf,t1.id_fascia, t2.limite, t1.solo_gruppo from ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_conf as t2 on t1.id_conf=t2.id_conf where t1.id_cons='$id_cons'";
|
---|
| 110 | $res = $dbi->prepare("$sql");
|
---|
| 111 | $res->execute();
|
---|
| 112 | if($res->rowCount()) list($id_conf,$fascia,$limite,$dettnulli) = $res->fetch(PDO::FETCH_NUM);
|
---|
| 113 | if ($id_conf and $fascia<=$limite) {
|
---|
[139] | 114 | echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
[208] | 115 | echo "<table border=\"1\" width=\"100%\"><tr><th><b>"._VALIDI."</b></th><th>"._NULLI."</th><th>"._BIANCHI."</th><th>"._CONTESTATI."</th><th>"._VOTINULLI."</th><th>"._TOTNON."</th></TR>";
|
---|
| 116 | ECHO "<TR><TH>".number_format($validi,0,',','.')."</TH><TH>".number_format($nulli,0,',','.')."</TH><TH>".number_format($bianchi,0,',','.')."</TH><TH>".number_format($contestati,0,',','.')."</TH><TH>".number_format($votinulli,0,',','.')."</TH><TH>".number_format($totnulli,0,',','.')."</TH></TR></table><br/>";
|
---|
| 117 | ECHO "</fieldset><br/><br/><br/>";
|
---|
[235] | 118 |
|
---|
[257] | 119 | }else{
|
---|
[254] | 120 | if ($dettnulli or $disgiunto){
|
---|
[257] | 121 | $sql="SELECT id_gruppo,num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_cons='$id_cons' order by num_gruppo";
|
---|
| 122 | $res = $dbi->prepare("$sql");
|
---|
| 123 | $res->execute();
|
---|
| 124 | echo "<fieldset><legend>"._GRUPPO."</legend>";
|
---|
| 125 | echo "<table border=\"1\" width=\"100%\"><tr><th colspan=\"2\" rowspan=\"2\" ALIGN=\"CENTER\"><b>Candidato</b></th><th rowspan=\"2\" ALIGN=\"CENTER\">"._VALIDI."</th><th colspan=\"2\" ALIGN=\"CENTER\">"._SOLO_GRUPPO."</th></tr><tr><th ALIGN=\"CENTER\">Senza indicazione di lista</th>";
|
---|
| 126 | if ($disgiunto) echo "<th>"._SOLOLIS."</th>"; else echo "<th>"._VOTINULLI." di Lista</th>";
|
---|
| 127 | echo "</TR>";
|
---|
[315] | 128 | $t_voti=0;$t_solo_gruppo=0;$t_nulli_lista=0;$t_perlista=0;
|
---|
[257] | 129 | while(list($id_gruppo,$num_gruppo,$desc) = $res->fetch(PDO::FETCH_NUM)){
|
---|
| 130 | $sql="SELECT sum(voti),sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo'";
|
---|
| 131 | $resv = $dbi->prepare("$sql");
|
---|
| 132 | $resv->execute();
|
---|
| 133 | list($voti,$solo_gruppo)=$resv->fetch(PDO::FETCH_NUM);
|
---|
| 134 | if($disgiunto){
|
---|
| 135 | $sql="SELECT sum(t1.solo_lista) from ".$prefix."_ele_voti_lista as t1 left join ".$prefix."_ele_lista as t2 on t1.id_lista=t2.id_lista where t2.id_gruppo='$id_gruppo'";
|
---|
| 136 | }else{
|
---|
| 137 | $sql="SELECT sum(t1.nulli_lista) from ".$prefix."_ele_voti_lista as t1 left join ".$prefix."_ele_lista as t2 on t1.id_lista=t2.id_lista where t2.id_gruppo='$id_gruppo'";
|
---|
| 138 | }
|
---|
| 139 | $resv = $dbi->prepare("$sql");
|
---|
| 140 | $resv->execute();
|
---|
| 141 | list($perlista)=$resv->fetch(PDO::FETCH_NUM);
|
---|
| 142 | $t_voti+=$voti;$t_solo_gruppo+=$solo_gruppo;$t_perlista+=$perlista;
|
---|
| 143 | ECHO "<TR><TD>".$num_gruppo."</TD><TD>".$desc."</TD><TD ALIGN=\"RIGHT\">".number_format($voti,0,',','.')."</TD><TD ALIGN=\"RIGHT\">".number_format($solo_gruppo,0,',','.')."</TD><TD ALIGN=\"RIGHT\">".number_format($perlista,0,',','.')."</TD></TD></TR>";
|
---|
[254] | 144 | }
|
---|
[257] | 145 | echo "<tr><th colspan=\"2\" rowspan=\"2\" ALIGN=\"CENTER\"><b>Totale</b></th><th rowspan=\"2\" ALIGN=\"RIGHT\">$t_voti</th><th ALIGN=\"RIGHT\">$t_solo_gruppo</th><th ALIGN=\"RIGHT\">$t_perlista</th></tr>";
|
---|
| 146 | ECHO "</table><br/></fieldset><br/><br/><br/>";
|
---|
[235] | 147 | }
|
---|
| 148 | echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
[163] | 149 | echo "<table border=\"1\" width=\"100%\"><tr><th>"._VALIDI."</th><th>"._VOTINULLI."</th><th>"._CONTESTATI."</th>";
|
---|
[174] | 150 | // if ($genere==5 and !$votog)
|
---|
[257] | 151 | echo "<th>"._SOLO_GRUPPO."</th>";
|
---|
[163] | 152 | echo "<th>"._TOTNON."</th></TR>";
|
---|
[257] | 153 | ECHO "<TR><TH>".number_format($validilista,0,',','.')."</TH><TH>".number_format($nullilista,0,',','.')."</TH><TH>".number_format($contestatilista,0,',','.')."</TH>";
|
---|
[163] | 154 | if($genere==5 and !$votog)
|
---|
| 155 | echo "<TH>".number_format($sg,0,',','.')."</TH>";
|
---|
| 156 | echo "<TH>".number_format($totnullil,0,',','.')."</TH></TR></table><br/>";
|
---|
[139] | 157 | ECHO "</fieldset>";
|
---|
[174] | 158 | }
|
---|
[257] | 159 | }
|
---|
| 160 | echo "</center>";
|
---|
[139] | 161 | echo "</table>\n</td></tr></table>\n";
|
---|
[257] | 162 | include ("footer.php");
|
---|
[139] | 163 |
|
---|
| 164 | ?>
|
---|