Changeset 426 for trunk/client/temi/Futura2/function_theme.php
- Timestamp:
- Oct 4, 2024, 12:14:01 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/temi/Futura2/function_theme.php
r419 r426 191 191 $res->execute(); 192 192 if ($circo){ 193 $sql="select t1. *from ".$prefix."_ele_voti_gruppo as t1, ".$prefix."_ele_gruppo as t2 where t1.id_gruppo=t2.id_gruppo and t1.id_cons='$id_cons' and t2.id_circ=$id_circ group by t1.id_sez ";193 $sql="select t1.id_sez from ".$prefix."_ele_voti_gruppo as t1, ".$prefix."_ele_gruppo as t2 where t1.id_gruppo=t2.id_gruppo and t1.id_cons='$id_cons' and t2.id_circ=$id_circ group by t1.id_sez "; 194 194 $res = $dbi->prepare("$sql"); 195 195 $res->execute(); … … 216 216 if ($genere!=0){ 217 217 // tot voti 218 if (!$circo) 218 if (!$circo) { 219 219 $sql="select sum(voti) from ".$prefix."_$tab where id_cons=$id_cons "; 220 if ($votog) 220 $restotv = $dbi->prepare("$sql"); 221 $restotv->execute(); 222 } 223 if ($votog) { 221 224 $sql="select sum(voti) from ".$prefix."_ele_voti_lista where id_cons=$id_cons "; 222 $restotv = $dbi->prepare("$sql"); 223 $restotv->execute(); 225 $restotv = $dbi->prepare("$sql"); 226 $restotv->execute(); 227 } 224 228 list($tot) = $restotv->fetch(PDO::FETCH_NUM); 225 229 … … 237 241 and t2.id_lista=t3.id_lista 238 242 and t1.id_gruppo=t3.id_gruppo 239 group by t1.id_gruppo 243 group by t1.id_gruppo, t1.num_gruppo, t1.descrizione 240 244 order by somma desc"; 241 245 $cosa='id_gruppo'; … … 466 470 function graf_liste_mob(){ 467 471 468 global $id_cons,$id_cons_gen,$prefix,$dbi,$min,$offset,$op,$tipo_cons,$prev,$next,$votog,$votol,$circo,$genere,$id_comune,$colortheme ;472 global $id_cons,$id_cons_gen,$prefix,$dbi,$min,$offset,$op,$tipo_cons,$prev,$next,$votog,$votol,$circo,$genere,$id_comune,$colortheme,$id_circ; 469 473 470 474 $offset=10000; 471 475 if (!isset($min)) $min=0; 472 476 473 // numero sezioni scrutinate sul gruppo 474 if ($circo) $circos = "and id_circ=$id_circ" ; else $circos=''; 475 if ($genere==0) $tab="ref"; else $tab="gruppo"; 477 // numero sezioni scrutinate 478 if ($genere==0) $tab="ref"; else $tab="lista"; 479 if ($circo and $id_circ) 480 { 481 $circos = "and id_$tab in (select id_$tab from soraldo_ele_$tab where id_circ=$id_circ)" ; 482 $circos2 = "and id_sede in (select id_sede from soraldo_ele_sede where id_circ=$id_circ)"; 483 $circos3 = "and id_circ=$id_circ"; 484 } 485 else {$circos=''; $circos2='';$circos3 = '';} 476 486 $sql="select id_sez from ".$prefix."_ele_voti_".$tab." where id_cons='$id_cons' $circos group by id_sez "; 477 487 $res = $dbi->prepare("$sql"); 478 488 $res->execute(); 479 489 $numero=$res->rowCount(); 480 $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' $circos ";490 $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' $circos2 "; 481 491 $res = $dbi->prepare("$sql"); 482 492 $res->execute(); … … 496 506 497 507 // tot liste 498 $sql="SELECT * FROM ".$prefix."_ele_lista where id_cons='$id_cons' ";508 $sql="SELECT * FROM ".$prefix."_ele_lista where id_cons='$id_cons' $circos3 "; 499 509 $res = $dbi->prepare("$sql"); 500 510 $res->execute(); … … 502 512 503 513 // tot voti liste 504 $sql="select sum(voti) from ".$prefix."_ele_voti_lista where id_cons='$id_cons' ";514 $sql="select sum(voti) from ".$prefix."_ele_voti_lista where id_cons='$id_cons' $circos"; 505 515 $res_lista_tutti = $dbi->prepare("$sql"); 506 516 $res_lista_tutti->execute(); 507 517 list($voti_lista_tutti) = $res_lista_tutti->fetch(PDO::FETCH_NUM); 508 518 509 $sql="select id_cons ,id_lista ,id_gruppo, num_lista, descrizione from ".$prefix."_ele_lista where id_cons='$id_cons' ORDER BY num_lista LIMIT $min,$offset";519 $sql="select id_cons ,id_lista ,id_gruppo, num_lista, descrizione from ".$prefix."_ele_lista where id_cons='$id_cons' $circos3 ORDER BY num_lista LIMIT $min,$offset"; 510 520 $result = $dbi->prepare("$sql"); 511 521 $result->execute(); … … 562 572 563 573 function graf_candidato_mob(){ 564 global $dbi,$bgcolor1, $bgcolor5,$bgcolor5, $prefix, $offset, $min,$descr_cons, $id_cons,$tipo_cons,$copy,$id_comune,$id_istat,$genere,$votog,$votol,$votoc,$circo,$siteistat ;574 global $dbi,$bgcolor1, $bgcolor5,$bgcolor5, $prefix, $offset, $min,$descr_cons, $id_cons,$tipo_cons,$copy,$id_comune,$id_istat,$genere,$votog,$votol,$votoc,$circo,$siteistat,$id_circ; 565 575 if ($siteistat==$id_comune) $logo='1'; else $logo=''; // logo per il comune 566 576 $bgcolor1=""; 577 if($circo) 578 $circos="and id_cand in (select id_cand from ".$prefix."_ele_candidati where id_lista in (select id_lista from ".$prefix."_ele_lista where id_circ=$id_circ))"; 579 else 580 $circos=''; 567 581 568 582 $tab="ele_voti_candidati"; 569 583 570 $sql="select id_sez from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' group by id_sez ";571 584 $sql="select id_sez from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' $circos group by id_sez "; 585 $res = $dbi->prepare("$sql"); 572 586 $res->execute(); 573 587 $numero=$res->rowCount(); 574 $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons'"; 588 if($circo) 589 $circos="and id_sede in (select id_sede from ".$prefix."_ele_sede where id_circ=$id_circ)"; 590 else 591 $circos=''; 592 593 $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' $circos"; 575 594 $res = $dbi->prepare("$sql"); 576 595 $res->execute(); … … 587 606 588 607 // tot voti 608 if($circo) 609 $circos="and id_cand in (select id_cand from ".$prefix."_ele_candidati where id_lista in (select id_lista from ".$prefix."_ele_lista where id_circ=$id_circ))"; 610 else 611 $circos=''; 589 612 $sql=" 590 select sum(voti) from ".$prefix."_ele_voti_candidati where id_cons=$id_cons ";613 select sum(voti) from ".$prefix."_ele_voti_candidati where id_cons=$id_cons $circos"; 591 614 $res = $dbi->prepare("$sql"); 592 615 $res->execute(); … … 601 624 } 602 625 $i=0; 603 $sql="select t1.id_lista, t1.id_cand, t1.nome , t1.cognome, sum(t2.voti) as somma 604 from ".$prefix."_ele_candidati as t1 605 left join ".$prefix."_ele_voti_candidati as t2 on (t1.id_cand=t2.id_cand) 606 left join ".$prefix.$scelta." 607 where t1.id_cons='$id_cons' 608 group by t1.id_lista, t1.id_cand, t1.nome, t1.cognome 609 order by somma desc"; 610 $res = $dbi->prepare("$sql"); 611 $res->execute(); 612 $n_candi=$res->rowCount(); 613 614 while (list($id_lista,$id_cand,$nome,$cognome,$voti) = $res->fetch(PDO::FETCH_NUM)){ 615 $candidato[$i]=$cognome; 616 $pro[$i]=number_format($voti*100/$tot,2); 617 // sviluppo tabella dati 618 $e=$i+1; 619 echo "<li><table style=\"text-align:left;border : 1px solid Black;width:100%;\">"; // inizio tabella dati 620 echo "<tr><td>".$e."°</td><td><b><img alt=\"$nome $cognome\" src=\"modules.php?name=Elezioni&file=foto&id_lista=$id_lista\" align=\"middle\" width=\"30\"></b></td> 621 <td width=\"70%\" bgcolor=\"$bgcolor1\"><b>$nome $cognome</b><br/> 622 "._VOTI.": <b>$voti </b> 623 ( <span style=\"color:#ff0000;\">$pro[$i]%</span> )</td></tr>"; 624 echo "</table></li>"; // fine tabella dati 625 /* tolto il conteggio 626 if ($e=='5000' || $e==$n_candi){ 627 628 629 630 631 632 //include("footer.php"); 633 exit; 634 } 635 636 */ 637 638 $i++; 639 640 641 642 626 if($circo) 627 $circos="and id_circ=$id_circ"; 628 else 629 $circos=''; 630 $sql="select t1.id_lista, t1.id_cand, t1.nome , t1.cognome, sum(t2.voti) as somma 631 from ".$prefix."_ele_candidati as t1 632 left join ".$prefix."_ele_voti_candidati as t2 on (t1.id_cand=t2.id_cand) 633 left join ".$prefix.$scelta." 634 where t1.id_cons='$id_cons' $circos 635 group by t1.id_lista, t1.id_cand, t1.nome, t1.cognome 636 order by somma desc"; 637 $res = $dbi->prepare("$sql"); 638 $res->execute(); 639 $n_candi=$res->rowCount(); 640 641 while (list($id_lista,$id_cand,$nome,$cognome,$voti) = $res->fetch(PDO::FETCH_NUM)){ 642 $candidato[$i]=$cognome; 643 $pro[$i]=number_format($voti*100/$tot,2); 644 // sviluppo tabella dati 645 $e=$i+1; 646 echo "<li><table style=\"text-align:left;border : 1px solid Black;width:100%;\">"; // inizio tabella dati 647 echo "<tr><td>".$e."°</td><td><b><img alt=\"$nome $cognome\" src=\"modules.php?name=Elezioni&file=foto&id_lista=$id_lista\" align=\"middle\" width=\"30\"></b></td> 648 <td width=\"70%\" bgcolor=\"$bgcolor1\"><b>$nome $cognome</b><br/> 649 "._VOTI.": <b>$voti </b> 650 ( <span style=\"color:#ff0000;\">$pro[$i]%</span> )</td></tr>"; 651 echo "</table></li>"; // fine tabella dati 652 /* tolto il conteggio 653 if ($e=='5000' || $e==$n_candi){ 654 655 656 657 658 659 //include("footer.php"); 660 exit; 643 661 } 644 645 } 662 663 */ 664 665 $i++; 666 667 668 669 670 } 671 672 } 646 673 647 674 } … … 1096 1123 if (isset($circo) and $circo) $circos="and t2.id_circ='$id_circ'"; 1097 1124 else $circos=''; 1098 $circos='';1099 1125 // numero sezioni scrutinate 1100 $sql="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' ";1126 $sql="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"; 1101 1127 $res2 = $dbi->prepare("$sql"); 1102 1128 $res2->execute(); 1103 1129 $sezioni=$res2->rowCount(); 1104 $sql="select orario,data from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order by data desc,orario desc limit 1";1130 $sql="select orario,data from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order by data desc,orario desc limit 0,1"; 1105 1131 $res = $dbi->prepare("$sql"); 1106 1132 $res->execute(); … … 1110 1136 list ($anno,$mese,$giorno)=explode('-',$data); 1111 1137 $tot_v_m=0;$tot_v_d=0;$tot_t=0; 1112 $sql="select t3.id_sez 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' and t3.data='$data' and t3.orario='$orario' group by t3.id_sez ";1138 $sql="select t3.id_sez 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' and t3.data='$data' and t3.orario='$orario' $circos group by t3.id_sez "; 1113 1139 $res1 = $dbi->prepare("$sql"); 1114 1140 $res1->execute(); … … 1120 1146 $res1->execute(); 1121 1147 while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) { 1122 $query="select sum(t3.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' and t3.data='$data' and t3.orario='$orario' $circos"; 1148 $query="select sum(t3.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' and t3.data='$data' and t3.orario='$orario' $circos"; 1123 1149 if ($genere==0){$query.=" and t3.id_gruppo=$id_gruppo";} 1124 1150 $res_aff = $dbi->prepare("$query"); … … 1126 1152 $voti_numero=$res_aff->rowCount(); 1127 1153 # $query="select sum(t1.maschi+t1.femmine) 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' and t3.data='$data' and t3.orario='$orario' "; 1128 $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 ";1154 $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"; 1129 1155 //if ($genere==0){$query.=" and t3.id_gruppo=$id_gruppo";} 1130 1156 $tot=''; … … 1185 1211 if (isset($circo) and $circo) $circos="and t2.id_circ='$id_circ'"; 1186 1212 else $circos=''; 1187 $circos='';1213 # $circos=''; 1188 1214 //if ($genere==0) $tab="ref";elseif($genere=='4' || $votog) $tab="lista"; 1189 1215 if($genere=='4' || $votog) $tab="lista";
Note:
See TracChangeset
for help on using the changeset viewer.