[2] | 1 | <?php
|
---|
| 2 | /************************************************************************/
|
---|
| 3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 4 | /* by Roberto Gigli & Luciano Apolito */
|
---|
| 5 | /* http://www.eleonline.it */
|
---|
| 6 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 7 | /************************************************************************/
|
---|
| 8 |
|
---|
| 9 | if (!defined('MODULE_FILE')) {
|
---|
| 10 | die ("You can't access this file dirrectly...");
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | global $op, $prefix, $dbi, $offset, $min,$descr_cons,$genere,$votog,$votol,$votoc,$circo, $id_cons,$tipo_cons,$id_comune,$id_cons_gen,$id_circ,$csv,$w,$l,$siteistat,$flash,$tour;
|
---|
| 14 |
|
---|
| 15 | if (isset($circo) and $circo) $circos="and t2.id_circ='$id_circ'";
|
---|
| 16 | else $circos='';
|
---|
| 17 |
|
---|
| 18 | //if ($genere==0) $tab="ref";elseif($genere=='4' || $votog) $tab="lista";
|
---|
| 19 | if($genere=='4' || $votog) $tab="lista";
|
---|
| 20 | else $tab="gruppo";
|
---|
| 21 | if ($genere==0) $tab="ref";
|
---|
| 22 |
|
---|
| 23 | $res = mysql_query("select t3.* from ".$prefix."_ele_voti_".$tab." as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' $circos group by t3.id_sez ",$dbi);
|
---|
| 24 | $numero=mysql_num_rows($res);
|
---|
| 25 | $res = mysql_query("select t1.* from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' $circos",$dbi);
|
---|
| 26 | $sezioni=mysql_num_rows($res);
|
---|
| 27 |
|
---|
| 28 | if ($numero!=0){
|
---|
| 29 |
|
---|
| 30 |
|
---|
| 31 | echo "<h5><b>"._DETTAGLIO." "._VOTIE."</b> - </h5>";
|
---|
| 32 | echo "<div style=\"text-align:center;\"><i> "._SEZSCRU." $numero "._SU." $sezioni </i></div>";
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 |
|
---|
| 37 | if ($genere!=0) {
|
---|
| 38 |
|
---|
| 39 | $res = mysql_query("select sum(t1.maschi+t1.femmine) from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' and validi>0 $circos",$dbi);
|
---|
| 40 | list($tot_aventi) = mysql_fetch_row($res);
|
---|
| 41 |
|
---|
| 42 | $res = mysql_query("select sum(t1.validi+t1.nulli+t1.bianchi+t1.contestati) as tot,
|
---|
| 43 | sum(t1.validi),sum(t1.nulli),sum(t1.bianchi),sum(t1.contestati), '0', '0', '0'
|
---|
| 44 | from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' and validi>0 $circos",$dbi);
|
---|
| 45 |
|
---|
| 46 | }else{
|
---|
| 47 | $res = mysql_query("SELECT sum(maschi+femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'",$dbi);
|
---|
| 48 | list($tot_aventi) = mysql_fetch_row($res);
|
---|
| 49 | $res = mysql_query("SELECT sum(validi+nulli+bianchi+contestati) as tot,
|
---|
| 50 | sum(validi),sum(nulli),sum(bianchi),sum(contestati), id_gruppo, sum(si), sum(no)
|
---|
| 51 | from ".$prefix."_ele_voti_ref where id_cons=$id_cons group by id_gruppo having tot>'0'",$dbi);
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | while (list($tot_votanti,$validi,$nulli,$bianchi,$contestati,$id,$si,$no) = mysql_fetch_row($res)){
|
---|
| 55 | $tot_votanti=$validi+$bianchi+$nulli+$contestati;
|
---|
| 56 | if($tot_votanti){
|
---|
| 57 | if($genere==0 and $validi) {$perc_si=number_format($si*100/$validi,2);$perc_no=number_format(100 - $si*100/$validi,2);}
|
---|
| 58 | else {$perc_si="0.00"; $perc_no="0.00";}
|
---|
| 59 | $perc_validi=number_format($validi*100/$tot_votanti,2);
|
---|
| 60 | $perc_nulli=number_format($nulli*100/$tot_votanti,2);
|
---|
| 61 | $perc_bianchi=number_format($bianchi*100/$tot_votanti,2);
|
---|
| 62 | $perc_conte=number_format($contestati*100/$tot_votanti,2);
|
---|
| 63 | }else {$perc_validi="0.00";$perc_nulli="0.00";$perc_bianchi="0.00";$perc_conte="0.00";}
|
---|
| 64 | if($tot_aventi)
|
---|
| 65 | $perc_votanti=number_format($tot_votanti*100/$tot_aventi,2);
|
---|
| 66 | else $perc_votanti="0.00";
|
---|
| 67 | $non_votanti=($tot_aventi - $tot_votanti);
|
---|
| 68 | $perc_non=100-$perc_votanti;
|
---|
| 69 |
|
---|
| 70 | if ($genere==0) {
|
---|
| 71 | $resg = mysql_query("SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo=$id",$dbi);
|
---|
| 72 | list($num_gruppo,$descr_gruppo) = mysql_fetch_row($resg);
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | echo "<table bgcolor=\"gray\" width=\"100%\" cellspacing=\"1\">";
|
---|
| 79 | if ($genere==0) {echo "<br/>Referendum n. <b>[$num_gruppo]</b><br/>";}
|
---|
| 80 | echo "
|
---|
| 81 | <tr bgcolor=\"#ffffff\"><td ><b>"._AVENTI."</b></td><td>$tot_aventi</td><td><span class=\"red\">100%</span></td></tr>
|
---|
| 82 |
|
---|
| 83 | <tr bgcolor=\"#ffffff\"><td><b>"._VOTANTI."</b></td><td>$tot_votanti</td><td><span class=\"red\">$perc_votanti%</span></td></tr>";
|
---|
| 84 | if ($genere==0){
|
---|
| 85 | echo "<tr bgcolor=\"#ffffff\"><td>"._SI."</td><td>$si</td><td><span class=\"red\">$perc_si%</span></td></tr>
|
---|
| 86 |
|
---|
| 87 | <tr bgcolor=\"#ffffff\"><td>"._NO."</td><td>$no</td><td><span class=\"red\">$perc_no%</span></td></tr>";
|
---|
| 88 | }
|
---|
| 89 | echo "<tr bgcolor=\"#ffffff\"><td>"._VALIDI."</td><td>$validi</td><td><span class=\"red\">$perc_validi%</span></td></tr>
|
---|
| 90 |
|
---|
| 91 | <tr bgcolor=\"#ffffff\"><td>"._NULLI."</td><td>$nulli</td><td><span class=\"red\">$perc_nulli%</span></td></tr>
|
---|
| 92 |
|
---|
| 93 | <tr bgcolor=\"#ffffff\"><td>"._BIANCHI."</td><td>$bianchi</td><td><span class=\"red\">$perc_bianchi%</span></td></tr>
|
---|
| 94 |
|
---|
| 95 | <tr bgcolor=\"#ffffff\"><td>"._CONTESTATI."</td><td>$contestati</td><td><span class=\"red\">$perc_conte%</span></td></tr>
|
---|
| 96 |
|
---|
| 97 | </table>";
|
---|
| 98 |
|
---|
| 99 | }
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | ?>
|
---|