[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
|
---|
[257] | 69 | $sql="select sum(validi_lista),sum(nulli+bianchi+voti_nulli+contestati+contestati_lista+solo_gruppo+voti_nulli_lista) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
|
---|
| 70 | $resperc = $dbi->prepare("$sql");
|
---|
| 71 | $resperc->execute();
|
---|
| 72 | list($scruvalidi,$scrunulli)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
[254] | 73 |
|
---|
[257] | 74 | if($totschede)
|
---|
[254] | 75 | $listpercscru=number_format(($scruvalidi+$scrunulli)*100/$totschede,2);
|
---|
[257] | 76 | else $listpercscru=0;
|
---|
| 77 | $listtotschede=$totschede;
|
---|
| 78 | $listtotvoti=($scruvalidi+$scrunulli);
|
---|
[254] | 79 |
|
---|
| 80 | #################
|
---|
| 81 | echo "<table border=\"1\" cellpadding=\"5\"><tr align=\"middle\"><th colspan=\"5\">Riepilogo dei voti per gruppo e liste collegate</th></tr>";
|
---|
| 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>";
|
---|
| 83 | echo "<tr align=\"middle\"><td><b>Candidato Uninominale</b></td><td><b>Voti</b></td><td><b>Al solo</br>Candidato Uninominale</b></td><td><b>Lista</br>Collegata</b></td><td><b>Voti alla lista</b></td></tr>";
|
---|
| 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;
|
---|
[257] | 88 | $sql="SELECT id_lista,num_lista,descrizione FROM ".$prefix."_ele_lista where id_cons='$id_cons' and id_gruppo='$id_gruppo' group by id_lista order by num_lista";
|
---|
[315] | 89 | $resl = $dbi->prepare("$sql");
|
---|
| 90 | $resl->execute();
|
---|
| 91 | $numliste=$resl->rowCount();
|
---|
[257] | 92 | $sql="SELECT num_gruppo,descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
[315] | 93 | $resg2 = $dbi->prepare("$sql");
|
---|
| 94 | $resg2->execute();
|
---|
[257] | 95 | list($num_gruppo,$descrg)=$resg2->fetch(PDO::FETCH_NUM);
|
---|
[254] | 96 |
|
---|
| 97 | echo "<tr><td rowspan=\"$numliste\">$descrg</td><td rowspan=\"$numliste\" align=\"right\"><h2>".number_format($votigruppo,0,',','.')."</h2></td><td rowspan=\"$numliste\" align=\"right\"><h2>".number_format($sologruppo,0,',','.')."</h2></td>";
|
---|
| 98 | $currlst=0;
|
---|
[257] | 99 | while (list($id_lista,$num_lista,$descrl)=$resl->fetch(PDO::FETCH_NUM))
|
---|
[254] | 100 | {
|
---|
[257] | 101 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_lista='$id_lista'";
|
---|
| 102 | $resl2 = $dbi->prepare("$sql");
|
---|
| 103 | $resl2->execute();
|
---|
| 104 | list($votilista)=$resl2->fetch(PDO::FETCH_NUM);
|
---|
[254] | 105 | if($currlst) echo "<tr>"; else $currlst++;
|
---|
| 106 | $totl+=$votilista;
|
---|
| 107 | echo "<td>$num_lista) $descrl</td><td align=\"right\"><h2>".number_format($votilista,0,',','.')."</h2></td></tr>";
|
---|
| 108 | }
|
---|
| 109 | }
|
---|
| 110 | echo "<tr><td><b>Totale</b></td><td align=\"right\"><h1>".number_format($totg,0,',','.')."</h1></td><td align=\"right\"><h1>".number_format($totsg,0,',','.')."</h1></td><td></td><td align=\"right\"><h1>".number_format($totl,0,',','.')."</h1></td></tr>";
|
---|
| 111 | echo "</table></br>";
|
---|
| 112 |
|
---|
| 113 | }
|
---|
| 114 |
|
---|
| 115 | echo "</table>";
|
---|
| 116 |
|
---|
| 117 | # if ($votog) echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
| 118 | # else echo "<fieldset><legend>"._GRUPPO."</legend>";
|
---|
| 119 |
|
---|
| 120 |
|
---|
| 121 | include ("footer.php");
|
---|
| 122 |
|
---|
| 123 | ?>
|
---|