Index: trunk/admin/modules/Elezioni/ele_spoglio.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_spoglio.php	(revision 392)
+++ trunk/admin/modules/Elezioni/ele_spoglio.php	(revision 394)
@@ -670,5 +670,5 @@
 
 function finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
- global $aid, $prefix, $dbi,$id_cons_gen,$genere,$votog,$fascia,$limite;
+ global $aid, $prefix, $dbi,$id_cons_gen,$genere,$votog,$fascia,$limite,$scrtest;
 ////////////////////////////////////////////
 // da qua va la sezione per i voti finali
@@ -676,14 +676,24 @@
 $bgcolor1="#7777ff";
 $bgcolor2=$_SESSION['bgcolor2'];
-
-
-
-     	echo "<form name=\"spogliovoti\" data-ajax=\"false\" action=\"modules/Elezioni/salva_voti.php\">"
-      	."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">";
-   	echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
-     	."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
-     	."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
-    	."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
-     	."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";
+echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
+."//-->\n";
+echo "function setsez() {\n";
+echo "document.getElementById('spogliovoti').submit(); }\n";
+echo "</script>\n";	
+
+$sql="select * from ".$prefix."_ele_voti_lista where id_cons=$id_cons and id_sez=$id_sez and id_lista=0";
+$res = $dbi->prepare("$sql");
+$res->execute(); 
+$stato=$res->rowCount();
+if($stato) $stato='checked'; else $stato='';
+echo "<form name=\"spogliovoti\" id=\"spogliovoti\" data-ajax=\"false\" action=\"modules/Elezioni/salva_voti.php\">"
+."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">";
+echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
+."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
+."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
+."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
+."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";
+if($scrtest)
+	echo "<div style=\"text-align:right;\">Considerare la sezione come scrutinata? <input type=\"checkbox\" name=\"scrutinata\" id=\"scrutinata\" value=\"true\" $stato onclick=\"setsez()\";> <br></div>";
 
 	echo "<table border=\"0\" width=\"100%\" align=\"center\"><tr bgcolor=\"$bgcolor1\" align=\"center\">";
@@ -750,5 +760,5 @@
 
 function preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
- global $aid, $prefix, $dbi, $tipo_cons, $genere,$id_cons_gen,$sezi,$circo,$dettnulli;
+ global $aid, $prefix, $dbi, $tipo_cons, $genere,$id_cons_gen,$sezi,$circo,$dettnulli,$scrtest;
 ////////////////////////////////////////////
 // da qua va la sezione per le preferenze ai gruppi
@@ -938,5 +948,5 @@
 			."<td colspan=\"2\"><b>"._VOTANTI."</b></td></tr>";
 		}else{
-			echo "<br><br> <table  class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
+			echo "<br><br><table  class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
 			."<td width=\"3%\"><b>"._NUM."</b></td>"
 			."<td width=\"50%\"><b>"._GRUPPO."</b></td>";
@@ -956,7 +966,4 @@
 		$tot_pref=0;
 		$totsg=0;
-		$pro=array();
-		$pro['voti']='';
-		$pro['solo_gruppo']='';
 		while(list($id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo) = $result->fetch(PDO::FETCH_NUM)){
 			echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
@@ -1012,6 +1019,6 @@
 					$res = $dbi->prepare("$sql");
 					$res->execute();
-					if($res->rowCount())
-						$pro= $res->fetch(PDO::FETCH_BOTH);
+					$pro= $res->fetch(PDO::FETCH_BOTH);
+					if(!$res->rowCount()) {$pro['voti']=''; $pro['solo_gruppo']='';}
 					$errcolor='';
 					if(isset($errgrulis[$id_gruppo])) {$errcolor="style=\"background-color: rgb(255, 0, 0);\"";}
@@ -1046,5 +1053,6 @@
 		}
 		echo "</td></tr></table></center>";
-	}
+		$scrtest=0;
+	}else{$scrtest=1;}
 	if ($genere!=0){
 		finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
