"; $siteistat=$id_comune; # salva sull'hardisk lo stemma del comune $logo=verificasimbolo(); $immagine= "\"logo\""; if($xls!=1) $datipdf .= "
$immagine"; $datipdf .= ""._COMUNE." $descr_com
"._RISULTA." "._CONSULTA."
"; $datipdf .= "$descr_cons
"._DISCLAIMER."
"._DETTAGLIO." "._AFFLUENZE.""; if($xls!=1) $datipdf .= "
"; $datipdf .=""; $html = ""; } // referendum $posref=''; 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=='0'){ $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' and num_gruppo='$num_ref'", $dbi); list($id_gruppo)=mysql_fetch_array($resg); $posref="&num_ref=$num_ref&num_refs=$num_refs"; } // icone stampa e grafici if (!$csv){ if(!isset($html)) $html=''; $html .= "
"._VER_GRAF." \"\" "._VER_STAMPA." \"\" \"\" \"\"

"._DETTAGLIO." "._AFFLUENZE."

"; } // descrizione if ($genere==0){ $des = mysql_query("select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'", $dbi); list($descrizione)=mysql_fetch_array($des); if(!isset($html)) $html=''; $html .= "

$descrizione

"; } $cond= $genere==0 ? "and t3.id_gruppo='$id_gruppo'" : ""; $i=1; $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); while ($linka[$i++] = mysql_fetch_array($res)); # while (list($appo) = mysql_fetch_array($res)) {$i=$appo['num_sez']; $linka[$i] = $appo;echo "\nnum:$i:".$linka[$i]['num_sez'];}die(); $num_sez = mysql_num_rows($res); //numero totale delle sezioni $sez_da=$linka[1]['num_sez']; $sez_a=$sez_da+$num_sez-1; $tot_compl=0;$tot_u=0;$tot_d=0; // $ar['riga1'][0]="
"; $tot= array(); $ar[0][0]="TOTALI"; $ar['perc'][0]="Perc."; // $ar['riga2'][0]="
"; # foreach($linka['num_sez'] as $i) $y=1; for ($i=$sez_da;$i<=$sez_a;$i++,$y++) { # $ar[$i]['numsez']=$i; $z=$linka[$y]['num_sez']; $ar[$z]['numsez']=$linka[$y]['num_sez']; $ar[$z]['elettori']=number_format($linka[$y]['elettori'],0,',','.'); $tot_compl+=$linka[$y]['elettori']; $tot_u+=$linka[$y]['maschi']; $tot_d+=$linka[$y]['femmine']; } $ar[0][1]="".number_format($tot_compl,0,',','.').""; $ar['perc'][1]=" "; $perc_u=0;$perc_d=0;$perc_c=0; # $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); $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); $num_ril= mysql_num_rows($resril); //numero delle rilevazioni previste if(!isset($html)) $html=''; $html .= ""; $html .= ""; # $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); $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); list($ultora,$ultdata)=mysql_fetch_row($resuo); $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); #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 "); $perc_u=array(); $perc_d=array(); $perc_c=array(); while (list($data,$ora,$somma,$votiu,$votid) = mysql_fetch_row($ressomma)) { $perc_u[$data.$ora]=0; $perc_d[$data.$ora]=0; $perc_c[$data.$ora]=0; if($votiu or $votid) # if(($data==$ultdata) and ($ora==$ultora)) { $tot[$data.$ora]="
"._SEZIONI.""._ISCR_SEZ."
".number_format($votiu,0,',','.')." ".number_format($votid,0,',','.')." ".number_format($somma,0,',','.')."
"; $perc_u[$data.$ora]=number_format($votiu*100/$tot_u,2); $perc_d[$data.$ora]=number_format($votid*100/$tot_d,2); $perc_c[$data.$ora]=number_format($somma*100/$tot_compl,2); } else $tot[$data.$ora]=$somma; } $ud=0;$ora_rif=""; while (list($data1,$ora1) = mysql_fetch_row($resril)) { $ud++; list($hour, $minute, $second) = explode(":", $ora1); $ora_ril=$hour.":".$minute; $html .= ""._ORE." ".$ora_ril; $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); list($num_scr) = mysql_fetch_row($resaff); //numero delle sezioni inserite $html .= "
"._SEZIONI." $num_scr "._SU." $num_sez"; ## if ($ud==$num_ril and ($perc_u or $perc_d)) $html .= "
if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) $html .= "
"._UOMINI." "._DONNE." "._COMPLESSIVI."
"; $html .= ""; if (isset($tot[$data1.$ora1])){ ## if ($ora_rif=="$data1.$ora1") if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) { $ar['perc'][$data1.$ora1]="
".$perc_u[$data1.$ora1]."% ".$perc_d[$data1.$ora1]."% ".$perc_c[$data1.$ora1]."%
"; $ar[0][$data1.$ora1]=$tot[$data1.$ora1]; } else { $ar['perc'][$data1.$ora1]=" ".number_format($tot[$data1.$ora1]*100/$tot_compl,2)."%"; $ar[0][$data1.$ora1]="".(number_format($tot[$data1.$ora1],0,',','.')).""; } if (intval(preg_match('/[1-9]/',$tot[$data1.$ora1]))>0) { #foreach($ar[['num_sez'] as $i) ########## $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); ########### # for ($i=$sez_da;$i<=$sez_a;$i++) while (list($i)=mysql_fetch_row($resvoti)) { $ar[$i][$data1.$ora1]="non rilevata"; } } } } $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); # $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); $ud=0; #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 "); while (list($data,$ora,$numsez,$uomini,$donne,$complessivi) = mysql_fetch_row($resvoti)) { # if ($ora_rif=="$data.$ora") if(($uomini+$donne)>0) $ar[$numsez][$data.$ora]="
$uomini $donne $complessivi
"; else $ar[$numsez][$data.$ora]=$complessivi; } $html .= ""; foreach ($ar as $i => $arr) { $html .= ""; foreach ($arr as $valore) { $html .= "$valore"; } $html .= ""; } $html .= ""; if($genere==0){ //se e' referendum #'Pagina precedente' e 'Pagina Successiva' if ($xls!='1' && $pdf!='1' && $csv!='1'){ $html .= "
"; $cur=$num_ref; if ($cur>1) { $num_ref--; $html .= ""; $html .= "[ "._PREV_MATCH." ] "; } if ($cur<$num_refs) { $cur++; $html .= ""; $html .= "[ "._NEXT_MATCH." ] "; } $html .= "
"; } } if(!isset($style)) $style=''; if($csv==1){ $data=date("d-m-y G:i"); $style .="\t\t\n


Stampato: $data
"; $style .="
Eleonline by luciano apolito & roberto gigli - www.eleonline.it
"; $style .= "
"; } //$html .= ""; ############### stampa if ($xls!='1' && $pdf!='1'){ echo "$datipdf $html $style"; }elseif($xls=="1"){ $nomefile="affluenze.xls"; header ("Content-Type: application/vnd.ms-excel"); header ("Content-Disposition: inline; filename=$nomefile"); echo "$datipdf"; echo "$html \t\n $style"; }elseif($pdf=='1'){ $nomefile="$descr_cons affluenze.pdf"; $stampa ="$datipdf $html $style"; require_once('inc/hpdf403/html2pdf.class.php'); $html2pdf = new HTML2PDF('L','A4', 'it'); $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml'])); $html2pdf->Output($nomefile); } if($csv!=1 ) include ("footer.php"); ?>