prepare("$sql"); $res->execute(); list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM); global $lang,$circo,$id_circ; if(isset($circo)) $_SESSION['id_circ']=$id_circ; if (isset($circo) and $circo) {$circos="and t2.id_circ='$id_circ'"; $circos4="and t4.id_circ='$id_circ'";} else {$circos=''; $circos4='';} if (isset($param['ops'])) $ops=$param['ops']; else $ops=''; if (isset($param['pag'])) $pag=$param['pag']; else $pag=0; if (isset($param['num_ref'])) $num_ref=$param['num_ref']; if (isset($param['num_refs'])) $num_refs=$param['num_refs']; $bgcolor2='#cacaca'; if (!IsSet($num_ref)) { $num_ref=1; $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons"; $resg = $dbi->prepare("$sql"); $resg->execute(); $num_refs= $resg->rowCount(); //quante pagine? } //************************************************************************** // ELE //************************************************************************** //controllo_finale($id_cons); global $lang, $fascia, $limite, $votog; include_once("modules/Elezioni/language/lang-$lang.php"); # testata $datipdf=''; if($csv==1){ include_once("modules/Elezioni/funzioni.php"); $sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' "; $res = $dbi->prepare("$sql"); $res->execute(); list($descr_com) = $res->fetch(PDO::FETCH_NUM); $descr_com =stripslashes($descr_com); $datipdf .= "
"; $siteistat=$id_comune; # salva sull'hardisk lo stemma del comune style=\"vertical-align: text-bottom;\" $logo=verificasimbolo(); $immagine= "\"logo\""; if($xls!=1) $datipdf .= "
$immagine"; $datipdf .= ""._COMUNE." $descr_com
"._RISULTA." "._CONSULTA."
"; $datipdf .= "$descr_cons
"._DISCLAIMER.""; if($xls!=1) $datipdf .= "
"; $datipdf .="
"; $html = ""; } // icone stampa e grafici style=\"margin:0px auto; if ($csv!=1){ if(isset($num_ref)) $curref="&num_ref=$num_ref"; else $curref=''; if (!isset($html)) $html=''; $html .= "
"._VER_GRAF." \"\" "._VER_STAMPA." \"\" \"\" \"\"
"; } $sql="SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'"; $res = $dbi->prepare("$sql"); $res->execute(); list($totm,$totf) = $res->fetch(PDO::FETCH_NUM); $totel=$totm+$totf; if (!IsSet($pag)) {$pag=0;} //inizializza il numero di pagina /* if (!IsSet($num_ref)) { $num_ref=1; $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons", $dbi); $num_refs= mysql_num_rows($resg); //quante pagine? } */ if(($genere!=4) and $pag==0){ //diverso da liste a piu' candidati $ops=4; //gestione gruppi (anche liste uninominali) }else{ $ops=3; //gestione liste } $sql="SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref"; $resg = $dbi->prepare("$sql"); $resg->execute(); list($idg,$numg) = $resg->fetch(PDO::FETCH_NUM); $sql="SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ 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 "; $res = $dbi->prepare("$sql"); $res->execute(); $max = $res->rowCount(); //quante sezioni? $sql="SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ 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 "; $res = $dbi->prepare("$sql"); $res->execute(); $num_sez = $res->rowCount(); //quante sezioni? #for ($i=1;$i<=$num_sez;$i++){ $i=1; while ($sezione[$i] = $res->fetch(PDO::FETCH_BOTH)) $ar[$i++]=0; # $sezione[$i]=$res->fetch(PDO::FETCH_BOTH); //inizializza l'array delle sezioni #} $tab3="_ele_voti_lista"; if ($genere>0) { //se non e' un referendum if (!($genere==4) and $pag==0){ //se non e' una lista uninominale ed e' la prima pagina $tab="SELECT 0,t2.id_sez,t2.num_sez,t2.validi,'0','0',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0',t2.voti_nulli FROM ".$prefix."_ele_sezioni as t2 left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t2.id_cons='$id_cons' and t2.validi+t2.nulli+t2.bianchi+t2.contestati>0 $circos4 group by t2.id_sez,t2.num_sez,t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,t2.voti_nulli order by t2.num_sez "; }else{ // e' una lista uninominale o la seconda pagina # voto disgiunto regione sicilia aggiunge il campo solo lista if(isdisgiunto()){ $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0',t1.voti_nulli FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez) left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede) where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circos4 group by t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli order by t1.num_sez "; }else{ $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0',t1.voti_nulli FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez) left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede) where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circos4 group by t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli order by t1.num_sez "; } } $riga1 = ""; if($pag==0)$riga1 .="

"._DETTAGLIO." "._VOTIE."

"; else $riga1 .="

"._DETTAGLIO." "._VOTIE." "._ASOLA_LISTA."

"; }else{ // e' un referendum --> t3.id_gruppo vuota per allineare il while (da rifare con array) $tab="SELECT t1.id_gruppo,t1.id_sez,t2.num_sez,t1.si,t1.no,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t2.id_sede,t3.num_gruppo,'0' FROM ".$prefix."_ele_voti_ref as t1 left join ".$prefix."_ele_sezioni as t2 on (t1.id_sez=t2.id_sez) left join ".$prefix."_ele_gruppo as t3 on (t1.id_gruppo=t3.id_gruppo) left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t1.id_cons='$id_cons' and t1.id_gruppo='$idg' $circos4 order by t2.num_sez "; $riga1 = "
"; $riga1 .="

"._DETTAGLIO." "._VOTIE."

"; $sql="select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'"; $des = $dbi->prepare("$sql"); $des->execute(); list($descrizione)=$des->fetch(PDO::FETCH_BOTH); $riga1 .="

$descrizione

"; } $sql="$tab "; $res = $dbi->prepare("$sql"); $res->execute(); $num_scr = $res->rowCount(); //$riga2= "
"._SEZSCR." $num_scr su $num_sez
";//sezioni scrutinate $riga2 = ""; $riga3 = ""; //testata con nomi dei campi if ($genere==0) { //se e' un referendum $riga3 .= ""; } elseif ((($genere==5) or ($genere==3)) and $pag==1){ $riga3 .= ""; if(isdisgiunto()){ $riga3 .= ""; $riga3 .= ""; } // voto disgiunto if (!$votog) $riga3 .= ""; } $riga3 .= "" ."\n"; $sql="$tab "; $res = $dbi->prepare("$sql"); $res->execute(); $num_scr = $res->rowCount(); $righe= ""; $scrutinate=1; $tot_u=0;$tot_d=0;$tot_voti=0; $tot_si=0;$tot_no=0;$tot_validi=0;$tot_nulli=0;$tot_bianchi=0;$tot_contestati=0; $tot_sololista=0;$tot_gruppo=0; #$si e $no sono valide anche per voti lista e solo gruppo per i non referendum while (list($id_gruppo,$id,$num,$si,$no,$sololista,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo,$votinulli) = $res->fetch(PDO::FETCH_NUM)){ $nulli+=$votinulli; // inserimento numeri di sez non scrutinate while ($sezione[$scrutinate][1] < $num) { $righe.= "\n"; $scrutinate++; } # voti sindaco, gruppo o presidente $tab5="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id'"; $sql="$tab5"; $res3 = $dbi->prepare("$sql"); $res3->execute(); list($sindaco) = $res3->fetch(PDO::FETCH_NUM); $scrutinate++; // fine inserimento $tab2="SELECT max(voti_donne),max(voti_uomini),max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id'"; if ($genere==0) $tab2 .= " and id_gruppo=$id_gruppo"; $sql=$tab2; $res2 = $dbi->prepare("$sql"); $res2->execute(); list($votid,$votiu,$voti) = $res2->fetch(PDO::FETCH_NUM); // $voti=$votiu+$votid; $tot_gruppo+=$sindaco; $tot_u+=$votiu; $tot_d+=$votid; $tot_voti+=$voti; $tot_si+=$si; $tot_no+=$no; $tot_validi+=$validi; $tot_nulli+=$nulli; $tot_bianchi+=$bianchi; $tot_contestati+=$contestati; $tot_sololista+=$sololista; if($num % 2) $righe .= ""; else $righe .= ""; $righe .= ""; if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){ $righe .= ""; if(isdisgiunto()){ $righe .= ""; $righe .= ""; } if (!$votog) $righe .= ""; } $righe .= ""; } #if ($num<$num_sez) if(isset($sezione[$scrutinate][1]) and $num<$sezione[$scrutinate][1]) { while(isset($sezione[$scrutinate][1])) { $righe .= ""; } } $righet=''; if($num_scr){ $righet = ""; //testata con nomi dei campi if ($genere==0) { //se e' un referendum $righet .= ""; } elseif ((($genere==5) or ($genere==3)) and $pag==1){ $righet .= ""; if(isdisgiunto()){ $righet .= ""; $righet .= ""; } // voto disgiunto if (!$votog) $righet .= ""; } if($totel==0) $totelrip="0.00"; else $totelrip=number_format($tot_voti*100/$totel,2); if($totf==0) $totfrip="0.00"; else $totfrip=number_format($tot_d*100/$totf,2); if($totm==0) $totmrip="0.00"; else $totmrip=number_format($tot_u*100/$totm,2); $righet .= "" .""; // se e' un referendum o una consultazione con raggruppamenti if($tot_validi){ if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){ $righet .= ""; if(isdisgiunto()){ $righet .=""; $righet .=""; } if(!$votog) $righet .=""; } $righet .= ""; }else{ if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){ $righet .= ""; } $righet .= ""; } } $righe .= "
"._SEZIONI." "._VOTIU." "._VOTID." "._VOTIE.""._SI.""._NO."Voti "._LISTE."Voti "._PRESI.""._SOLO_LISTA.""._ASOLO_GRUPPO.""._VALIDI.""._NULLI.""._BIANCHI.""._CONTESTATI."
".$sezione[$scrutinate][1]."
$num ".number_format($votiu,0,',','.')." ".number_format($votid,0,',','.')." ".number_format($voti,0,',','.')."".number_format($si,0,',','.')."".number_format($sindaco,0,',','.')."".number_format($sololista,0,',','.')."".number_format($no,0,',','.')."".number_format($validi,0,',','.')." $nulli $bianchi $contestati
"; $righe .="".$sezione[$scrutinate++][1]."
"._VOTIU." "._VOTID." "._VOTIE.""._SI.""._NO."Voti "._LISTE."Voti "._PRESI.""._SOLO_LISTA.""._ASOLO_GRUPPO.""._VALIDI.""._NULLI.""._BIANCHI.""._CONTESTATI."
"._TOT."".number_format($tot_u,0,',','.')."
(".$totmrip."%)
".number_format($tot_d,0,',','.')."
(".$totfrip."%)
".number_format($tot_voti,0,',','.')."
(".$totelrip."%)
".number_format($tot_si,0,',','.')."
(".number_format($tot_si*100/$tot_validi,2)."%)
".number_format($tot_gruppo,0,',','.')."
(".number_format($tot_gruppo*100/$tot_validi,2)."%)
".number_format($tot_sololista,0,',','.')."
(".number_format($tot_sololista*100/$tot_validi,2)."%)
".number_format($tot_no,0,',','.')."
(".number_format($tot_no*100/$tot_validi,2)."%)
".number_format($tot_validi,0,',','.')."
(".($tot_voti ? number_format($tot_validi*100/$tot_voti,2):'0.00')."%)
" .number_format($tot_nulli,0,',','.')."
(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0.00')."%)
".number_format($tot_bianchi,0,',','.')."
(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0.00')."%)
".number_format($tot_contestati,0,',','.')."
(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0.00')."%)
".number_format($tot_si,0,',','.')."
(0.00%)
".number_format($tot_no,0,',','.')."
(0.00%)
0
(0.00%)
" .number_format($tot_nulli,0,',','.')."
(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0,00')."%)
".number_format($tot_bianchi,0,',','.')."
(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0,00')."%)
".number_format($tot_contestati,0,',','.')."
(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0,00')."%)
"; if(!isset($html)) $html=''; $html .= "$riga1"; $html .= $riga2.""; $html .= $righet; $html .= $riga3; $html .= $righe; $html .="
"; if($genere==0){ //se e' referendum if ($xls!='1' && $pdf!='1' && $csv!='1'){ #'Pagina precedente' e 'Pagina Successiva' $cur=$num_ref; if ($cur>1) { $num_ref--; $html .= ""; $html .= "[ "._PREV_MATCH." ]"; } if ($cur<$num_refs) { $cur++; $html .= ""; $html .= "[ "._NEXT_MATCH." ]"; } } } if($genere==5 or $genere==3){ //se vi sono raggruppamenti if($csv!=1 and $fascia>$limite){ $pag=($pag==0 ? 1:0); $html .= ""; if($pag) $html .= _VOTIL; //_CONTR_CONS; else $html .= _VOTIE; //_CONTR_ESPR; $html .= ""; } } if($csv==1){ $data=date("d-m-y G:i"); $html .="
Stampato: $data"; $html .="
Eleonline by l. apolito & r. gigli - www.eleonline.it
"; } $html .= "
"; ?>