"; $siteistat=$id_comune; if($xls!=1) $datipdf .= "
\"mappa\""; $datipdf .= ""._COMUNE." $descr_com
"._RISULTA." "._CONSULTA."
"; $datipdf .= "

$descr_cons

"._DISCLAIMER.""; if($xls!=1) $datipdf .= "
"; $datipdf .=""; } // icone stampa e grafici if ($csv!=1){ if (!isset($html)) $html=''; $html .= "
"._VER_GRAF." \"\" "._VER_STAMPA." \"\" \"\"
"; } $res = mysql_query("SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'", $dbi); list($totm,$totf) = mysql_fetch_row($res); $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 } $resg = mysql_query("SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref", $dbi); list($idg,$numg) = mysql_fetch_row($resg); $res = mysql_query("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 order by num_sez ", $dbi); $max = mysql_num_rows($res); //quante sezioni? $res = mysql_query("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 order by num_sez ", $dbi); $num_sez = mysql_num_rows($res); //quante sezioni? for ($i=1;$i<=$num_sez;$i++){ $sezione[$i]=mysql_fetch_array($res, 3); //inizializza l'array delle sezioni $ar[$i]=0; } $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',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0' 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 group by t2.id_sez order by t2.num_sez "; }else{ // e' una lista uninominale o la seconda pagina $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0' 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 group by t2.id_sez order by t1.num_sez "; } $riga1 = "
"; if($pag==0)$riga1 .="

"._DETTAGLIO." "._VOTIE."

"; else $riga1 .="

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

"; }else{ // e' un referendum $tab="SELECT t1.id_gruppo,t1.id_sez,t2.num_sez,t1.si,t1.no,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t2.id_sede,t3.num_gruppo 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' order by t2.num_sez "; $riga1 = "
"; $riga1 ="

"._DETTAGLIO." "._VOTIE."

"; $des = mysql_query("select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'", $dbi); list($descrizione)=mysql_fetch_array($des); $riga1 .="

$descrizione

"; } $res = mysql_query("$tab ", $dbi); $num_scr = mysql_num_rows($res); //$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 .= ""; } $riga3 .= "" ."\n"; $res = mysql_query("$tab ", $dbi); $num_scr = mysql_num_rows($res); $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; while (list($id_gruppo,$id,$num,$si,$no,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo) = mysql_fetch_row($res)){ // inserimento numeri di sez non scrutinate while ($scrutinate < $num) { $righe.= "\n"; $scrutinate++; } $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"; $res2 = mysql_query($tab2, $dbi); list($votid,$votiu,$voti) = mysql_fetch_row($res2); // $voti=$votiu+$votid; $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; $righe .= ""; if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){$righe .= "";} $righe .= ""; } if ($num<$num_sez) { for (;$scrutinate<=$num_sez;$scrutinate++) { $righe .= ""; } } 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($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 .= "";} $righet .= ""; }else{ if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){$righet .= "";} $righet .= ""; } } $righe .= "
"._SEZIONI." "._VOTIU." "._VOTID." "._VOTIE.""._SI.""._NO.""._ASOLA_LISTA.""._ASOLO_GRUPPO.""._VALIDI.""._NULLI.""._BIANCHI.""._CONTESTATI."
$scrutinate
$num ".number_format($votiu,0,',','.')." ".number_format($votid,0,',','.')." ".number_format($voti,0,',','.')."".number_format($si,0,',','.')." ".number_format($no,0,',','.')."".number_format($validi,0,',','.')." $nulli $bianchi $contestati
"; $righe .="$scrutinate
"._VOTIU." "._VOTID." "._VOTIE.""._SI.""._NO.""._ASOLA_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_no,0,',','.')."
(".number_format($tot_no*100/$tot_validi,2)." %)
".number_format($tot_validi,0,',','.')."
(".number_format($tot_validi*100/$tot_voti,2)." %)
" .number_format($tot_nulli,0,',','.')."
(".number_format($tot_nulli*100/$tot_voti,2)." %)
".number_format($tot_bianchi,0,',','.')."
(".number_format($tot_bianchi*100/$tot_voti,2)." %)
".number_format($tot_contestati,0,',','.')."
(".number_format($tot_contestati*100/$tot_voti,2)." %)
".number_format($tot_si,0,',','.')."
(0.00 %)
".number_format($tot_no,0,',','.')."
(0.00 %)
0
(0.00 %)
" .number_format($tot_nulli,0,',','.')."
(".number_format($tot_nulli*100/$tot_voti,2)." %)
".number_format($tot_bianchi,0,',','.')."
(".number_format($tot_bianchi*100/$tot_voti,2)." %)
".number_format($tot_contestati,0,',','.')."
(".number_format($tot_contestati*100/$tot_voti,2)." %)
"; $html .= "$riga1"; $html .= $riga2.""; $html .= $righet; $html .= $riga3; $html .= $righe; $html .="
"; if($genere==0){ //se e' referendum #'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." ]"; } }elseif((($genere==5) or ($genere==3))){ //se vi sono raggruppamenti if($csv!=1){ $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 .= $html; } $html .= "
"; ############### stampa if ($xls!='1'){ echo "$datipdf $html"; }else{ $nomefile="export.xls"; header ("Content-Type: application/vnd.ms-excel"); header ("Content-Disposition: inline; filename=$nomefile"); echo "$datipdf"; echo "$html \n"; } if($csv!=1 ) include ("footer.php"); ?>