Changeset 343 for trunk/client/modules/Elezioni/grafici.php
- Timestamp:
- Nov 19, 2020, 9:47:25 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/grafici.php
r338 r343 710 710 711 711 function graf_candidato(){ 712 global $descr_com, $bgcolor1, $bgcolor5,$bgcolor5, $prefix, $dbi, $offset, $min,$descr_cons, $id_cons,$tipo_cons,$copy,$id_comune,$id_istat,$genere,$votog,$votol,$votoc,$circo,$siteistat ;712 global $descr_com, $bgcolor1, $bgcolor5,$bgcolor5, $prefix, $dbi, $offset, $min,$descr_cons, $id_cons,$tipo_cons,$copy,$id_comune,$id_istat,$genere,$votog,$votol,$votoc,$circo,$siteistat,$id_circ; 713 713 714 714 $logo=verificasimbolo(); // carica_logo da funzioni.php 715 715 if($circo) $circos=" and t2.id_circ='$id_circ'"; else $circos=''; 716 716 $tab="ele_voti_candidati"; 717 717 718 $sql="select * from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' group by id_sez";719 $res = $dbi->prepare("$sql");720 $res->execute();718 $sql="select id_sez from ".$prefix."_ele_voti_candidati where id_sez in (select t1.id_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) group by id_sez"; 719 $res = $dbi->prepare("$sql"); 720 $res->execute(); 721 721 722 722 $numero=$res->rowCount(); 723 $sql = "select * from ".$prefix."_ele_sezioni where id_cons='$id_cons'";723 $sql="select t1.id_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"; 724 724 $res = $dbi->prepare("$sql"); 725 725 $res->execute(); … … 733 733 echo "</td></tr></table>"; 734 734 // tot voti 735 $sql="select sum(voti) from ".$prefix."_ele_voti_candidati where id_ cons=$id_cons";735 $sql="select sum(voti) from ".$prefix."_ele_voti_candidati where id_sez in (select t1.id_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)"; 736 736 $res = $dbi->prepare("$sql"); 737 737 $res->execute(); … … 741 741 742 742 if ($genere==4){ 743 $scelta="_ele_lista as t 3 on (t1.id_lista=t3.id_lista)";743 $scelta="_ele_lista as t2 on (t1.id_lista=t2.id_lista)"; 744 744 }else{ 745 $scelta="_ele_lista as t 3 on (t1.id_lista=t3.id_lista)";745 $scelta="_ele_lista as t2 on (t1.id_lista=t2.id_lista)"; 746 746 } 747 747 $i=0; 748 $sql="select t1.id_lista, t1.id_cand, t1.nome , t1.cognome, sum(t 2.voti) as somma748 $sql="select t1.id_lista, t1.id_cand, t1.nome , t1.cognome, sum(t3.voti) as somma 749 749 from ".$prefix."_ele_candidati as t1 750 left join ".$prefix."_ele_voti_candidati as t 2 on (t1.id_cand=t2.id_cand)750 left join ".$prefix."_ele_voti_candidati as t3 on (t1.id_cand=t3.id_cand) 751 751 left join ".$prefix.$scelta." 752 where t1.id_cons='$id_cons' 753 group by t 2.id_cand752 where t1.id_cons='$id_cons' $circos 753 group by t3.id_cand 754 754 755 755 order by somma desc
Note:
See TracChangeset
for help on using the changeset viewer.