Changeset 265 for trunk/client/modules/Elezioni/affluenze.php
- Timestamp:
- Apr 13, 2019, 8:05:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/affluenze.php
r121 r265 19 19 if (isset($param['xls'])) $xls=intval($param['xls']); 20 20 if (isset($param['pdf'])) $pdf=intval($param['pdf']); 21 $res = mysql_query("SELECT t1.tipo_cons,t3.genere,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t3 where t1.tipo_cons=t3.tipo_cons and t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi); 22 list($tipo_cons,$genere,$id_cons) = mysql_fetch_row($res); 21 $sql="SELECT t1.tipo_cons,t3.genere,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t3 where t1.tipo_cons=t3.tipo_cons and t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'"; 22 $res = $dbi->prepare("$sql"); 23 $res->execute(); 24 list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM); 23 25 global $lang,$circo,$id_circ; 24 26 … … 31 33 include_once("modules/Elezioni/funzioni.php"); 32 34 33 $res = mysql_query("SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ", $dbi); 34 list($descr_com) = mysql_fetch_row($res); 35 $sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' "; 36 $res = $dbi->prepare("$sql"); 37 $res->execute(); 38 list($descr_com) = $res->fetch(PDO::FETCH_NUM); 35 39 $descr_com =stripslashes($descr_com); 36 40 $datipdf .= "<div style=\"margin:0px auto; text-align:center;\">"; … … 110 114 if (!IsSet($num_ref)) { 111 115 $num_ref=1; 112 $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons'", $dbi); 113 $num_refs= mysql_num_rows($resg); //quante pagine? 116 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons'"; 117 $resg = $dbi->prepare("$sql"); 118 $resg->execute(); 119 $num_refs= $resg->rowCount(); //quante pagine? 114 120 } 115 121 if($genere=='0'){ 116 $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' and num_gruppo='$num_ref'", $dbi); 117 list($id_gruppo)=mysql_fetch_array($resg); 122 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' and num_gruppo='$num_ref'"; 123 $resg = $dbi->prepare("$sql"); 124 $resg->execute(); 125 list($id_gruppo)=$resg->fetch(PDO::FETCH_NUM); 118 126 $posref="&num_ref=$num_ref&num_refs=$num_refs"; 119 127 … … 140 148 // descrizione 141 149 if ($genere==0){ 142 $des = mysql_query("select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'", $dbi); 143 list($descrizione)=mysql_fetch_array($des); 150 $sql="select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'"; 151 $des = $dbi->prepare("$sql"); 152 $des->execute(); 153 list($descrizione)=$des->fetch(PDO::FETCH_NUM); 144 154 if(!isset($html)) $html=''; 145 155 $html .= "<div><h4>$descrizione</h4></div>"; … … 151 161 152 162 153 $res = mysql_query("SELECT num_sez,id_sez,t1.id_sede, t2.id_circ,maschi,femmine,(maschi+femmine) as elettori 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", $dbi); 154 while ($linka[$i++] = mysql_fetch_array($res)); 163 $sql="SELECT num_sez,id_sez,t1.id_sede, t2.id_circ,maschi,femmine,(maschi+femmine) as elettori 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"; 164 $res = $dbi->prepare("$sql"); 165 $res->execute(); 166 while ($linka[$i++] = $res->fetch(PDO::FETCH_BOTH)); 155 167 # while (list($appo) = mysql_fetch_array($res)) {$i=$appo['num_sez']; $linka[$i] = $appo;echo "\nnum:$i:".$linka[$i]['num_sez'];}die(); 156 $num_sez = mysql_num_rows($res); //numero totale delle sezioni168 $num_sez = $res->rowCount(); //numero totale delle sezioni 157 169 $sez_da=$linka[1]['num_sez']; 158 170 $sez_a=$sez_da+$num_sez-1; … … 181 193 182 194 $perc_u=0;$perc_d=0;$perc_c=0; 183 # $resril = mysql_query("SELECT t1.data,t1.orario FROM ".$prefix."_ele_rilaff as t1 where t1.id_cons_gen='$id_cons_gen' and 0<(select count(0) from ".$prefix."_ele_voti_parziale as t2, ".$prefix."_ele_cons_comune as t3 where t3.id_cons_gen=t1.id_cons_gen and t3.id_cons=t2.id_cons and t2.data=t1.data and t2.orario=t1.orario) order by t1.data,t1.orario", $dbi); 184 $resril = mysql_query("SELECT t1.data,t1.orario FROM ".$prefix."_ele_rilaff as t1 left join ".$prefix."_ele_voti_parziale as t2 on t2.data=t1.data and t2.orario=t1.orario left join ".$prefix."_ele_cons_comune as t3 on t3.id_cons_gen=t1.id_cons_gen where t1.id_cons_gen='$id_cons_gen' and t3.id_cons=t2.id_cons group by t1.data,t1.orario order by t1.data,t1.orario", $dbi); 185 $num_ril= mysql_num_rows($resril); //numero delle rilevazioni previste 195 $sql="SELECT t1.data,t1.orario FROM ".$prefix."_ele_rilaff as t1 left join ".$prefix."_ele_voti_parziale as t2 on t2.data=t1.data and t2.orario=t1.orario left join ".$prefix."_ele_cons_comune as t3 on t3.id_cons_gen=t1.id_cons_gen where t1.id_cons_gen='$id_cons_gen' and t3.id_cons=t2.id_cons group by t1.data,t1.orario order by t1.data,t1.orario"; 196 $resril = $dbi->prepare("$sql"); 197 $resril->execute(); 198 $num_ril= $resril->rowCount(); //numero delle rilevazioni previste 186 199 if(!isset($html)) $html=''; 187 200 $html .= "<table class=\"td-89\">"; 188 201 $html .= "<tr class=\"bggray\"><td class=\"\">"._SEZIONI."</td><td>"._ISCR_SEZ."</td>"; 189 # $ressomma = mysql_query("SELECT data,orario,sum(voti_complessivi),sum(voti_uomini),sum(voti_donne) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons $cond group by data,orario,id_gruppo", $dbi); 190 191 $resuo = mysql_query("SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1", $dbi); 192 list($ultora,$ultdata)=mysql_fetch_row($resuo); 193 194 195 $ressomma = mysql_query("select t3.data,t3.orario,sum(t3.voti_complessivi),sum(t3.voti_uomini),sum(t3.voti_donne) 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 t3.id_cons='$id_cons' $circos $cond group by t3.data,t3.orario,t3.id_gruppo order by t3.data,t3.orario",$dbi); 196 197 #die("select t3.data,t3.orario,sum(t3.voti_complessivi),sum(t3.voti_uomini),sum(t3.voti_donne) 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 t3.id_cons='$id_cons' $circos group by t3.data,t3.orario,t3.id_gruppo "); 202 203 $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1"; 204 $resuo = $dbi->prepare("$sql"); 205 $resuo->execute(); 206 list($ultora,$ultdata)=$resuo->fetch(PDO::FETCH_NUM); 207 208 209 $sql="select t3.data,t3.orario,sum(t3.voti_complessivi),sum(t3.voti_uomini),sum(t3.voti_donne) 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 t3.id_cons='$id_cons' $circos $cond group by t3.data,t3.orario,t3.id_gruppo order by t3.data,t3.orario"; 210 $ressomma = $dbi->prepare("$sql"); 211 $ressomma->execute(); 212 213 198 214 $perc_u=array(); $perc_d=array(); $perc_c=array(); 199 while (list($data,$ora,$somma,$votiu,$votid) = mysql_fetch_row($ressomma)) {215 while (list($data,$ora,$somma,$votiu,$votid) = $ressomma->fetch(PDO::FETCH_NUM)) { 200 216 $perc_u[$data.$ora]=0; 201 217 $perc_d[$data.$ora]=0; … … 217 233 } 218 234 $ud=0;$ora_rif=""; 219 while (list($data1,$ora1) = mysql_fetch_row($resril))235 while (list($data1,$ora1) = $resril->fetch(PDO::FETCH_NUM)) 220 236 { 221 237 $ud++; … … 227 243 $data_a=form_data($data1); 228 244 $html .= "".$data_a."<br />"._ORE." ".$ora_ril; 229 $resaff = mysql_query("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", $dbi); 230 list($num_scr) = mysql_fetch_row($resaff); //numero delle sezioni inserite 245 $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"; 246 $resaff = $dbi->prepare("$sql"); 247 $resaff->execute(); 248 list($num_scr) = $resaff->fetch(PDO::FETCH_NUM); //numero delle sezioni inserite 231 249 $html .= "<br />"._SEZIONI." $num_scr "._SU." $num_sez"; 232 250 ## if ($ud==$num_ril and ($perc_u or $perc_d)) $html .= "<br /> … … 261 279 #foreach($ar[['num_sez'] as $i) 262 280 ########## 263 $resvoti = mysql_query("select t1.num_sez from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t2.id_cons='$id_cons' $circos order by t1.num_sez ",$dbi); 281 $sql="select t1.num_sez from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t2.id_cons='$id_cons' $circos order by t1.num_sez "; 282 $resvoti = $dbi->prepare("$sql"); 283 $resvoti->execute(); 284 264 285 ########### 265 286 # for ($i=$sez_da;$i<=$sez_a;$i++) 266 while (list($i)= mysql_fetch_row($resvoti))287 while (list($i)=$resvoti->fetch(PDO::FETCH_NUM)) 267 288 { 268 289 $ar[$i][$data1.$ora1]="<span style=\"color: rgb(255, 0, 0);\">non rilevata</span>"; … … 271 292 } 272 293 } 273 $ resvoti = mysql_query("select t3.data,t3.orario,t1.num_sez,voti_uomini, voti_donne, voti_complessivi 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 t3.id_cons='$id_cons' $circos $cond order by data,orario,t1.num_sez ",$dbi);274 275 # $resvoti = mysql_query("SELECT data,orario,t2.num_sez,voti_uomini, voti_donne, voti_complessivi 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 $cond order by data,orario,t2.num_sez", $dbi);294 $sql="select t3.data,t3.orario,t1.num_sez,voti_uomini, voti_donne, voti_complessivi 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 t3.id_cons='$id_cons' $circos $cond order by data,orario,t1.num_sez "; 295 $resvoti = $dbi->prepare("$sql"); 296 $resvoti->execute(); 276 297 $ud=0; 277 #die("select t3.data,t3.orario,t1.num_sez,voti_uomini, voti_donne, voti_complessivi 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 t3.id_cons='$id_cons' $circos $cond order by data,orario,t2.num_sez "); 278 while (list($data,$ora,$numsez,$uomini,$donne,$complessivi) = mysql_fetch_row($resvoti)) { 298 while (list($data,$ora,$numsez,$uomini,$donne,$complessivi) = $resvoti->fetch(PDO::FETCH_NUM)) { 279 299 # if ($ora_rif=="$data.$ora") 280 300 if(($uomini+$donne)>0)
Note:
See TracChangeset
for help on using the changeset viewer.