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',t2.voti_nulli,t2.validi_lista,t2.voti_nulli_lista,t2.contestati_lista,t2.solo_gruppo,t2.solo_lista 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',t1.voti_nulli,t1.validi_lista,t1.voti_nulli_lista,t1.contestati_lista,t1.solo_gruppo,t1.solo_lista 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="\n
"._SEZSCR." "._CONSULTAZIONE."
\n"; }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,'0','0','0','0','0','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' order by t2.num_sez"; $riga1= "\n
"._SEZSCR." "._CONSULTAZIONE." N. ".$numg."
\n"; } $res = mysql_query("$tab ", $dbi); $num_scr = mysql_num_rows($res); $riga2= "\n
"._SEZIONI." $num_scr "._SU." $num_sez
\n";//sezioni scrutinate $riga2 .= "\n"; $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 (!$votog) $riga3 .= ""; } $riga3 .= ""; // if (($genere==2 or $genere==3 or $genere==5) and !$votog) // $riga3 .= ""; // if ($genere>1 and !$votol) // $riga3 .= ""; $riga3 .= "\n"; $res = mysql_query("$tab ", $dbi);//die($tab); $num_scr = mysql_num_rows($res); $righe= ""; $scrutinate=1; // if ($genere>1 and $pag==1) $ops=3; $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;$tgrup_pref=0;$tot_voti_nulli=0;$tot_val_lista=0;$tot_vot_nul_lis=0;$tot_cont_lis=0;$tot_solog=0;$tot_solol=0;$errors=0; while (list($id_gruppo,$id,$num,$si,$no,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo,$voti_nulli,$val_lista,$vot_nul_lis,$cont_lis,$solog,$solol) = mysql_fetch_row($res)){ // inserimento numeri di sez non scrutinate while ($scrutinate < $num) { $righe.= "\n"; $scrutinate++; } $scrutinate++; // fine inserimento if (($genere==2 or $genere==3 or $genere==5) and !$votog and !$dettnulli) { $respref = mysql_query("select sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id'", $dbi); list ($gruppref) = mysql_fetch_row($respref); $tgrup_pref += $gruppref; } $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; $tot_voti_nulli+=$voti_nulli; $tot_val_lista+=$val_lista; $tot_vot_nul_lis+=$vot_nul_lis; $tot_cont_lis+=$cont_lis; $tot_solog+=$solog; $tot_solol+=$solol; $righe .= ""; if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){$righe .= "";} if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1 and !$votog)){$righe .= "";} $righe .= ""; $g_err=0; if (($genere==2 or $genere==3 or $genere==5) and $pag==1 and !$votog and !$dettnulli) { if ($gruppref!=$validi) { $g_err=1; $ops=4; } } $controllo1=$validi+$nulli+$bianchi+$contestati+$voti_nulli; #prova if($pag==0) $controllo2=$si+$no; else $controllo2=$si+$no+$vot_nul_lis+$cont_lis; if($genere==5 and !$votog) #$validi+$nulli+$bianchi+$vcont+$vn if($pag==0 and !$votog or $fascia<=$limite) {$controllo1=$validi+$nulli+$bianchi+$contestati+$voti_nulli;} else { $controllo1=$val_lista+$nulli+$bianchi+$contestati+$voti_nulli+$cont_lis+$vot_nul_lis+$solog;$controllo2=$si+$no-$solol+$cont_lis+$vot_nul_lis;} $cerr=mysql_query("select stato_lis from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id'", $dbi); list($crlis)=mysql_fetch_row($cerr); if ($voti==$controllo1 and $validi==$controllo2 and !$g_err and $crlis!=-1){ $righe .= "\n"; }else{ $righe .= "\n";$errors=1; if ($ops==4) $ops=3; } } if ($num<$num_sez) { for (;$scrutinate<=$num_sez;$scrutinate++) { $righe .= "\n"; } } if($num_scr){ $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 ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1 and !$votog)){$righet .= "";} $righet .= ""; }else{ if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){$righet .= "";} if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1 and !$votog)){$righet .= "";} $righet .= ""; } $g_err=0; if (($genere==2 or $genere==3 or $genere==5) and $pag==1 and !$votog) { if ($tgrup_pref!=$tot_validi) { $g_err=1; } } # if ($tot_voti==$tot_validi+$tot_nulli+$tot_bianchi+$tot_contestati and # $tot_validi==$tot_si+$tot_no and !$g_err) { if (! $errors) { $righet .= "\n"; }else{ $righet .= "\n"; } }else $righet=''; //$righe .= "
"._SEZIONI.""._VOTIU.""._VOTID.""._VOTIE.""._SI.""._NO.""._ASOLA_LISTA.""._ASOLO_GRUPPO.""._VALIDI.""._NULLI.""._BIANCHI.""._CONTESTATI.""._PREFGRU.""._PREFLIS.""._STATO."
$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"._OK."
"._ERRORE."
$scrutinate
"._TOT."".number_format($tot_u,0,',','.')."
(".number_format($tot_u*100/$totm,2)." %)
".number_format($tot_d,0,',','.')."
(".number_format($tot_d*100/$totf,2)." %)
".number_format($tot_voti,0,',','.')."
(".number_format($tot_voti*100/$totel,2)." %)
".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 %)
".number_format($tot_validi,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)." %)
"._OK."
"._ERRORE."
\n"; echo "$riga1"; echo $riga2; echo $righet; echo $riga3; echo $righe; CloseTable(); echo"\n"; if($genere==0){ //se e' referendum #'Pagina precedente' e 'Pagina Successiva' $cur=$num_ref; if ($cur>1) { $num_ref--; echo ""; } if ($cur<$num_refs) { $cur++; echo ""; } }elseif(($genere==5 and ($fascia>=$limite or $dettnulli)) or ($genere==3) or ($genere==2) or $genere==1){ //se vi sono raggruppamenti $pag=($pag==0 ? 1:0); echo ""; }/* elseif ($genere==1){ $pag=($pag==0 ? 1:0); echo ""; }*/ echo "
"; echo ""._PREV_MATCH.""; echo ""._NEXT_MATCH.""; if($pag) echo _CONTR_PREF; else echo _CONTR_ESPR; echo ""; if($pag) echo _CONTR_GRUP; else echo _CONTR_ESPR; echo "

\n"; echo "\n\n"; include ("footer.php"); ?>