Changeset 368 for trunk/client/modules/Elezioni/grafici.php
- Timestamp:
- May 17, 2022, 10:59:01 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/grafici.php
r364 r368 42 42 <a href=\" modules.php?name=Elezioni&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&op=affluenze_graf&csv=1\">"._VER_STAMPA." <img class=\"image\" src=\"modules/Elezioni/images/printer.png\" alt=\"stampa\" /></a></div>"; 43 43 44 // circoscrizionali 45 46 // numero sezioni scrutinate 47 //if ($circo)$circos="and id_circ='$id_circ'"; 48 if (!isset($data1)) $data1=''; 49 if (!isset($ora_ril)) $ora_ril=''; 50 $sql="SELECT count(data) FROM ".$prefix."_ele_voti_parziale 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 t1.id_cons='$id_cons' and data='$data1' and orario='$ora_ril' $circos group by t3.id_gruppo"; 51 $res1 = $dbi->prepare("$sql"); 52 $res1->execute(); 53 54 # mysql_query("select * from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' $circos group by id_sez ",$dbi); 55 $numero=$res1->rowCount(); 56 $sql="SELECT t1.* FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos order by num_sez"; 57 $res2 = $dbi->prepare("$sql"); 58 $res2->execute(); 59 60 #mysql_query("select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' $circos",$dbi); 61 $sezioni=$res2->rowCount(); 62 63 64 65 44 $sql="SELECT t1.* FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos order by num_sez"; 45 $res2 = $dbi->prepare("$sql"); 46 $res2->execute(); 47 $sezioni=$res2->rowCount(); 66 48 67 49 // barre … … 74 56 // totali 75 57 76 if($tema=='tour') $andcond="select orario,data from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order by data desc,orario desc limit 0,1"; else $andcond="select orario,data from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' order by data,orario"; 77 58 if($tema=='tour') 59 $andcond="select orario,data from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order by data desc,orario desc limit 0,1"; 60 else 61 $andcond="select orario,data from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' order by data,orario"; 78 62 $sql="$andcond"; 79 63 $res = $dbi->prepare("$sql"); 80 64 $res->execute(); 81 82 while(list($orario,$data) = $res->fetch(PDO::FETCH_NUM)) { 83 list ($ore,$minuti,$secondi)=explode(':',$orario); 84 list ($anno,$mese,$giorno)=explode('-',$data); 85 $tot_v_m=0;$tot_v_d=0;$tot_t=0; 86 87 88 echo "<br /><div><h5>"._VOTANTI." "._ALLE." "._ORE." $ore,$minuti "._DEL." $giorno/$mese/$anno</h5></div>"; 89 65 while(list($orario,$data) = $res->fetch(PDO::FETCH_NUM)) { 66 list ($ore,$minuti,$secondi)=explode(':',$orario); 67 list ($anno,$mese,$giorno)=explode('-',$data); 68 $tot_v_m=0;$tot_v_d=0;$tot_t=0; 69 echo "<br /><div><h5>"._VOTANTI." "._ALLE." "._ORE." $ore,$minuti "._DEL." $giorno/$mese/$anno</h5></div>"; 90 70 $sql="SELECT count(data) FROM ".$prefix."_ele_voti_parziale 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 t1.id_cons='$id_cons' and data='$data' and orario='$orario' $circos group by t3.id_gruppo"; 71 $res1 = $dbi->prepare("$sql"); 72 $res1->execute(); 73 list($numero)=$res1->fetch(PDO::FETCH_NUM); 74 $sql="select sum(t3.voti_complessivi), t4.num_gruppo , t4.id_gruppo from ".$prefix."_ele_voti_parziale 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 left join ".$prefix."_ele_gruppo as t4 on (t3.id_gruppo=t4.id_gruppo) where t3.id_cons='$id_cons' and t3.orario='$orario' and t3.data='$data' $circos group by t4.num_gruppo, t4.id_gruppo order by t4.num_gruppo "; 91 75 $res1 = $dbi->prepare("$sql"); 92 76 $res1->execute(); 93 77 94 list($numero)=$res1->fetch(PDO::FETCH_NUM); 95 96 97 $sql="select sum(t3.voti_complessivi), t4.num_gruppo , t4.id_gruppo from ".$prefix."_ele_voti_parziale 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 left join ".$prefix."_ele_gruppo as t4 on (t3.id_gruppo=t4.id_gruppo) where t3.id_cons='$id_cons' and t3.orario='$orario' and t3.data='$data' $circos group by t4.num_gruppo, t4.id_gruppo order by t4.num_gruppo "; 98 $res1 = $dbi->prepare("$sql"); 99 $res1->execute(); 100 101 #mysql_query("select sum(t1.voti_complessivi), t2.num_gruppo , t2.id_gruppo from ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2 on (t1.id_gruppo=t2.id_gruppo) where t1.id_cons='$id_cons' and t1.orario='$orario' and t1.data='$data' group by t2.num_gruppo,t2.id_gruppo order by t2.num_gruppo " , $dbi); 102 103 104 105 106 107 while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) { 108 $query="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where orario='$orario' and data='$data' and id_cons='$id_cons'"; 109 110 if ($genere==0){$query.=" and id_gruppo=$id_gruppo";} 111 $sql=$query; 112 $res_aff = $dbi->prepare("$sql"); 113 $res_aff->execute(); 114 78 while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) { 79 $query="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where orario='$orario' and data='$data' and id_cons='$id_cons'"; 80 if ($genere==0){$query.=" and id_gruppo=$id_gruppo";} 81 $sql=$query; 82 $res_aff = $dbi->prepare("$sql"); 83 $res_aff->execute(); 115 84 $voti_numero=$res_aff->rowCount(); 116 $query="SELECT sum(maschi+femmine) FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos"; 117 #"select sum(maschi+femmine) from ".$prefix."_ele_voti_parziale as t1 , ".$prefix."_ele_sezioni as t2 where t1.id_cons=$id_cons and t1.id_sez=t2.id_sez and orario='$orario' and data='$data' $circos"; 118 119 120 # if ($genere==0){$query.=" and id_gruppo=$id_gruppo";} 121 $sql=$query; 122 $res1234 = $dbi->prepare("$sql"); 123 $res1234->execute(); 124 125 list($tot)=$res1234->fetch(PDO::FETCH_NUM); 126 127 $perc=number_format($voti_t*100/$tot,2); 128 echo "<table class=\"td-80\"><tr class=\"bggray\">"; 85 $query="SELECT sum(maschi+femmine) FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos"; 86 $sql=$query; 87 $res1234 = $dbi->prepare("$sql"); 88 $res1234->execute(); 89 list($tot)=$res1234->fetch(PDO::FETCH_NUM); 90 $perc=number_format($voti_t*100/$tot,2); 91 echo "<table class=\"td-80\"><tr class=\"bggray\">"; 129 92 if ($genere==0){echo "<td>Referendum N.</td>";} 130 131 93 echo "<td><b>"._VOTANTI."</b></td><td><b>"._PERCE."</b></td>"; 94 echo "<td><b>"._SEZIONI."</b></td>"; 132 95 echo "</tr>"; 133 echo "<tr class=\"bggray2\">"; 134 if ($genere==0){echo "<td><h2>$num_gruppo</h2></td>";} 135 echo "<td>$voti_t</td><td>$perc %</td><td>$numero</td> 136 </tr></table>"; 137 138 139 // barre 140 141 echo "<table><tr><td><table><tr><td> "._VOTANTI." : </td><td> 142 <img src=\"modules/Elezioni/images/barre/leftbar2.gif\" height=\"$l_size2[1]\" width=\"$l_size2[0]\" alt=\"votanti\" /><img src=\"modules/Elezioni/images/barre/mainbar2.gif\" alt=\"votanti\" height=\"$m_size2[1]\" width=\"". ($perc * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar2.gif\" height=\"$r_size2[1]\" width=\"$r_size2[0]\" alt=\"votanti\" /><span class=\"red\"> $perc</span> % ($voti_t)<br /></td></tr>\n"; 143 144 $tot_gen=$tot; 145 146 147 echo "<tr><td> "._AVENTI.": </td><td><img src=\"modules/Elezioni/images/barre/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" alt=\"elettori\" /><img src=\"modules/Elezioni/images/barre/mainbar.gif\" alt=\"elettori\" height=\"$m_size[1]\" width=\"".(100 * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" alt=\"elettori\" /> 100 % ($tot_gen)</td></tr></table>"; 148 echo "</td></tr></table>"; 149 150 } 151 152 } 96 echo "<tr class=\"bggray2\">"; 97 if ($genere==0){echo "<td><h2>$num_gruppo</h2></td>";} 98 echo "<td>$voti_t</td><td>$perc %</td><td>$numero</td></tr></table>"; 99 // barre 100 echo "<table><tr><td><table><tr><td> "._VOTANTI." : </td><td><img src=\"modules/Elezioni/images/barre/leftbar2.gif\" height=\"$l_size2[1]\" width=\"$l_size2[0]\" alt=\"votanti\" /><img src=\"modules/Elezioni/images/barre/mainbar2.gif\" alt=\"votanti\" height=\"$m_size2[1]\" width=\"". ($perc * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar2.gif\" height=\"$r_size2[1]\" width=\"$r_size2[0]\" alt=\"votanti\" /><span class=\"red\"> $perc</span> % ($voti_t)<br /></td></tr>\n"; 101 $tot_gen=$tot; 102 echo "<tr><td> "._AVENTI.": </td><td><img src=\"modules/Elezioni/images/barre/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" alt=\"elettori\" /><img src=\"modules/Elezioni/images/barre/mainbar.gif\" alt=\"elettori\" height=\"$m_size[1]\" width=\"".(100 * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" alt=\"elettori\" /> 100 % ($tot_gen)</td></tr></table>"; 103 echo "</td></tr></table>"; 104 } 105 } 153 106 } 154 107
Note:
See TracChangeset
for help on using the changeset viewer.