Changeset 356 for trunk/client/modules/Elezioni/gruppo.php
- Timestamp:
- Sep 28, 2021, 10:33:21 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/gruppo.php
r353 r356 172 172 } 173 173 $condcirc=''; 174 $condcircns=""; 174 175 if ($circo){ //gestione circoscrizionali 175 176 if(!$id_circ){ … … 186 187 list($num_circ)=$res_cir->fetch(PDO::FETCH_NUM); 187 188 $condcirc="and id_circ=$id_circ"; //variabile aggiunta nelle select per le circ. 189 $condcircns="and t2.id_circ=$id_circ"; 188 190 $sql="SELECT count(t1.num_sez),min(t1.num_sez),max(t1.num_sez) from ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons=$id_cons and t1.id_sede=t2.id_sede and t2.id_circ=$id_circ"; 189 191 $res_sez = $dbi->prepare("$sql"); … … 197 199 } 198 200 elseif (strstr( $op,'circo')){ 199 $sql="SELECT count(num_circ),min(num_circ),max(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons ";201 $sql="SELECT count(num_circ),min(num_circ),max(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons $condcirc"; 200 202 $res_sez = $dbi->prepare("$sql"); 201 203 $res_sez->execute(); 202 204 } 203 205 else{ 204 $sql="SELECT count(num_sez),min(num_sez),max(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons ";206 $sql="SELECT count(num_sez),min(num_sez),max(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons $condcirc"; 205 207 $res_sez = $dbi->prepare("$sql"); 206 208 $res_sez->execute(); … … 208 210 if($res_sez->rowCount()) list($tot_sez,$numsezmin,$numsezmax)=$res_sez->fetch(PDO::FETCH_NUM); 209 211 else {$tot_sez=0;$numsezmin=0;$numsezmax=0;} 210 $sql="SELECT count( num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons";212 $sql="SELECT count(t1.num_sez) 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 $condcircns"; 211 213 $res_sez = $dbi->prepare("$sql"); 212 214 $res_sez->execute(); … … 276 278 // dei voti di lista...oltre naturalmnte alle condizioni messe in variabile 277 279 // 4 aprile 2006 by luc 280 #echo "TEST; Condizione scelta lista/gruppo: if ($votog && $tab==gruppo)<br>circo: $circo -- condcirc: $condcirc<br>"; 281 $tabns=$tab; 278 282 if ($votog && $tab=="gruppo"){ // camera e senato 2006 279 283 $t="t9"; 280 284 $tab="lista"; 285 $tabns=$tab; 281 286 $tab15="gruppo"; 282 287 $add_1= ",".$prefix."_ele_gruppo as t9"; … … 288 293 $and_1=''; 289 294 } 295 if(($genere==5 and $circo)) $condcircns="and ".$prefix."_ele_$tabns.id_circ=$id_circ"; else $condcircns=""; 290 296 // fine della modifica 291 292 $sql="SELECT count(id_sez) from ".$prefix."_ele_voti_$tab15 where id_cons='$id_cons' group by id_$tab15";297 $sql="SELECT count(".$prefix."_ele_voti_$tabns.id_sez) from ".$prefix."_ele_voti_$tabns left join ".$prefix."_ele_$tabns on ".$prefix."_ele_voti_$tabns.id_$tabns=".$prefix."_ele_$tabns.id_$tabns where ".$prefix."_ele_voti_$tabns.id_cons='$id_cons' $condcircns group by ".$prefix."_ele_voti_$tabns.id_$tabns"; 298 //echo "TEST: numero sezioni scrutinate: $sql"; 293 299 $res_scr = $dbi->prepare("$sql"); 294 300 $res_scr->execute(); … … 503 509 if (!$csv){ 504 510 echo "<h5> Sezioni scrutinate"; 505 if ($tipo_cons!=4) echo ": $tot_scr su $tuttelesez ";511 if ($tipo_cons!=4) ;echo ": $tot_scr su $tuttelesez "; 506 512 echo "</h5> "; 507 513 }
Note:
See TracChangeset
for help on using the changeset viewer.