Index: trunk/client/modules/Elezioni/affluenze.php
===================================================================
--- trunk/client/modules/Elezioni/affluenze.php	(revision 70)
+++ trunk/client/modules/Elezioni/affluenze.php	(revision 71)
@@ -184,9 +184,13 @@
 
 
-  	$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  group by t3.data,t3.orario,t3.id_gruppo ",$dbi);
+  	$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  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)) {
-#		if($votiu or $votid)
-		if(($data==$ultdata) and ($ora==$ultora))
+		$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]="<table class=\"td-89\" width=\"100%\"><tr class=\"bggray2\"><td class=\"td-30\">
@@ -195,7 +199,7 @@
 			<b>".number_format($somma,0,',','.')."</b></td>
 			</tr></table>";
-			$perc_u=number_format($votiu*100/$tot_u,2);
-			$perc_d=number_format($votid*100/$tot_d,2);
-			$perc_c=number_format($somma*100/$tot_compl,2);
+			$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
@@ -209,5 +213,5 @@
 		$ora_ril=$hour.":".$minute;
 		$html .= "<td"; 
-		if ($ud==$num_ril and ($perc_u or $perc_d)) {$ora_rif="$data1.$ora1";}
+		if ($ud==$num_ril and ($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) {$ora_rif="$data1.$ora1";}
 		$html .= ">";
 		$data_a=form_data($data1);
@@ -216,5 +220,6 @@
 		list($num_scr) = mysql_fetch_row($resaff);  //numero delle sezioni inserite
 		$html .= "<br />"._SEZIONI." $num_scr "._SU." $num_sez";
-		if ($ud==$num_ril and ($perc_u or $perc_d)) $html .= "<br />
+##		if ($ud==$num_ril and ($perc_u or $perc_d)) $html .= "<br />
+		if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) $html .= "<br />
 		
 		<table class=\"td-vuoto\"  width=\"100%\"><tr class=\"bggray\">
@@ -227,10 +232,10 @@
 
 	if (isset($tot[$data1.$ora1])){
-		if ($ora_rif=="$data1.$ora1")
-		{
+##		if ($ora_rif=="$data1.$ora1")
+if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1]))		{
 			$ar['perc'][$data1.$ora1]="<table class=\"td-vuoto\"  width=\"100%\"><tr class=\"bggray2\">
-			<td class=\"td-30\"><b><i><span class=\"red\">$perc_u%</span></i></b></td>
-			<td class=\"td-30\"><b><i><span class=\"red\">$perc_d%</span></i></b></td>
-			<td ><span class=\"red\"><b><i>$perc_c%</i></b></span></td>
+			<td class=\"td-30\"><b><i><span class=\"red\">".$perc_u[$data1.$ora1]."%</span></i></b></td>
+			<td class=\"td-30\"><b><i><span class=\"red\">".$perc_d[$data1.$ora1]."%</span></i></b></td>
+			<td ><span class=\"red\"><b><i>".$perc_c[$data1.$ora1]."%</i></b></span></td>
 			</tr></table>";
 			$ar[0][$data1.$ora1]=$tot[$data1.$ora1];
@@ -257,5 +262,6 @@
 #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 ($ora_rif=="$data.$ora")
+		if(($uomini+$donne)>0)
 			$ar[$numsez][$data.$ora]="<table class=\"td-vuoto\"  width=\"100%\"><tr class=\"bggray2\">
 			<td class=\"td-30\" width=\"33%\">$uomini</td>
