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 | }
|
---|
16 | global $dbi;
|
---|
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!");
|
---|
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);
|
---|
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 |
|
---|
48 | global $prefix, $dbi,$fascia,$limite,$genere,$votog;
|
---|
49 |
|
---|
50 |
|
---|
51 | if($genere!=0){
|
---|
52 | $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";
|
---|
53 | $res = $dbi->prepare("$sql");
|
---|
54 | $res->execute();
|
---|
55 | ####################### inserimento scrutinio in percentuale -- per i gruppi
|
---|
56 |
|
---|
57 | $sql="select sum(validi),sum(nulli+bianchi+contestati+voti_nulli) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
|
---|
58 | $resperc = $dbi->prepare("$sql");
|
---|
59 | $resperc->execute();
|
---|
60 | list($scruvalidi,$scrunulli)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
61 | $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 ";
|
---|
62 | $resperc = $dbi->prepare("$sql");
|
---|
63 | $resperc->execute();
|
---|
64 | list($totschede)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
65 | if($totschede)
|
---|
66 | $grpercscru=number_format(($scruvalidi+$scrunulli)*100/$totschede,2);
|
---|
67 | else $grpercscru=0;
|
---|
68 |
|
---|
69 | ################# calcolo voti di lista espressi
|
---|
70 | $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'";
|
---|
71 | $resperc = $dbi->prepare("$sql");
|
---|
72 | $resperc->execute();
|
---|
73 | list($scruvalidi,$scrunulli)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
74 |
|
---|
75 | if($totschede)
|
---|
76 | $listpercscru=number_format(($scruvalidi+$scrunulli)*100/$totschede,2);
|
---|
77 | else $listpercscru=0;
|
---|
78 | $listtotschede=$totschede;
|
---|
79 | $listtotvoti=($scruvalidi+$scrunulli);
|
---|
80 |
|
---|
81 | #################
|
---|
82 | echo "<table border=\"1\" cellpadding=\"5\"><tr align=\"middle\"><th colspan=\"5\">Riepilogo dei voti per gruppo e liste collegate</th></tr>";
|
---|
83 | 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>";
|
---|
84 | 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>";
|
---|
85 | $totl=0;$totg=0;$totsg=0;
|
---|
86 | while(list($id_gruppo,$votigruppo,$sologruppo)=$res->fetch(PDO::FETCH_NUM))
|
---|
87 | {
|
---|
88 | $totg+=$votigruppo; $totsg+=$sologruppo;
|
---|
89 | $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";
|
---|
90 | $res1 = $dbi->prepare("$sql");
|
---|
91 | $res1->execute();
|
---|
92 | $numliste=$resl->fetch(PDO::FETCH_NUM);
|
---|
93 | $sql="SELECT num_gruppo,descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
94 | $res2 = $dbi->prepare("$sql");
|
---|
95 | $res2->execute();
|
---|
96 | list($num_gruppo,$descrg)=$resg2->fetch(PDO::FETCH_NUM);
|
---|
97 |
|
---|
98 | 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>";
|
---|
99 | $currlst=0;
|
---|
100 | while (list($id_lista,$num_lista,$descrl)=$resl->fetch(PDO::FETCH_NUM))
|
---|
101 | {
|
---|
102 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_lista='$id_lista'";
|
---|
103 | $resl2 = $dbi->prepare("$sql");
|
---|
104 | $resl2->execute();
|
---|
105 | list($votilista)=$resl2->fetch(PDO::FETCH_NUM);
|
---|
106 | if($currlst) echo "<tr>"; else $currlst++;
|
---|
107 | $totl+=$votilista;
|
---|
108 | echo "<td>$num_lista) $descrl</td><td align=\"right\"><h2>".number_format($votilista,0,',','.')."</h2></td></tr>";
|
---|
109 | }
|
---|
110 | }
|
---|
111 | 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>";
|
---|
112 | echo "</table></br>";
|
---|
113 |
|
---|
114 | }
|
---|
115 |
|
---|
116 | echo "</table>";
|
---|
117 |
|
---|
118 | # if ($votog) echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
119 | # else echo "<fieldset><legend>"._GRUPPO."</legend>";
|
---|
120 |
|
---|
121 |
|
---|
122 | include ("footer.php");
|
---|
123 |
|
---|
124 | ?>
|
---|