1 | <?php
|
---|
2 | /************************************************************************/
|
---|
3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
4 | /* by Luciano Apolito & Roberto Gigli */
|
---|
5 | /* http://www.eleonline.it */
|
---|
6 | /* info@eleonline.it rgigli@libero.it */
|
---|
7 | /************************************************************************/
|
---|
8 |
|
---|
9 | if (!defined('ADMIN_FILE')) {
|
---|
10 | die ("You can't access this file directly...");
|
---|
11 | }
|
---|
12 |
|
---|
13 | ########################################
|
---|
14 | # Affluenze
|
---|
15 | function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){
|
---|
16 |
|
---|
17 | global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen,$id_comune,$ops;
|
---|
18 | ##################
|
---|
19 | echo "<style>";
|
---|
20 | echo "DIV.table";
|
---|
21 | echo "{
|
---|
22 | display:table;
|
---|
23 | }
|
---|
24 | FORM.tr
|
---|
25 | {
|
---|
26 | display:table-row;
|
---|
27 | text-align: center;
|
---|
28 | }
|
---|
29 | DIV.tr
|
---|
30 | {
|
---|
31 | display:table-row;
|
---|
32 | background-color: #D3D3D3;
|
---|
33 | text-align: center;
|
---|
34 | }
|
---|
35 | SPAN.tdm
|
---|
36 | {
|
---|
37 | display:table-cell;
|
---|
38 | border: 1px solid black;
|
---|
39 | padding: 5px;
|
---|
40 | }
|
---|
41 | SPAN.td
|
---|
42 | {
|
---|
43 | display:table-cell;
|
---|
44 | }";
|
---|
45 | echo "</style>";
|
---|
46 |
|
---|
47 |
|
---|
48 | ##################
|
---|
49 | $bgcolor1="#7777ff";
|
---|
50 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
51 | $sql="SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
|
---|
52 | $res = $dbi->prepare("$sql");
|
---|
53 | $res->execute();
|
---|
54 | if($res) list($vismf)= $res->fetch(PDO::FETCH_NUM); else $vismf=0;
|
---|
55 | $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario ";
|
---|
56 | $res = $dbi->prepare("$sql");
|
---|
57 | $res->execute();
|
---|
58 | $num = $res->rowCount();
|
---|
59 | echo "<table><tr><td>";
|
---|
60 | $sql="SELECT maschi,femmine FROM ".$prefix."_ele_sezioni where id_sez=$id_sez";#echo $sql;
|
---|
61 | $ressez = $dbi->prepare("$sql");
|
---|
62 | $ressez->execute();
|
---|
63 | list($maschi,$femmine)=$ressez->fetch(PDO::FETCH_NUM);
|
---|
64 |
|
---|
65 | $afferr=0;
|
---|
66 | $sql="select tipo from ".$prefix."_ele_controlli where id_sez='$id_sez' and tipo='affluenze'";
|
---|
67 | $rese = $dbi->prepare("$sql");
|
---|
68 | $rese->execute();
|
---|
69 | if($rese->rowCount()) $afferr=1;
|
---|
70 |
|
---|
71 | $y=0;
|
---|
72 |
|
---|
73 | $riga=array();
|
---|
74 | $rigat=array();
|
---|
75 | $uscita=0;
|
---|
76 | while (list($ora,$giorno)= $res->fetch(PDO::FETCH_NUM)){
|
---|
77 | $y++;
|
---|
78 | $rigat[$y]='';
|
---|
79 | $riga[$y]='';
|
---|
80 | $rigat[$y]= "<div class=\"tr\">";
|
---|
81 | if ($genere==0){ //e' un referendum
|
---|
82 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></span>";
|
---|
83 | }
|
---|
84 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._ORA."</b></span>"
|
---|
85 | ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._DATA."</b></span>";
|
---|
86 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIU."</b></span>";
|
---|
87 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTID."</b></span>"
|
---|
88 | ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIT."</b></span>";
|
---|
89 | if ($genere==0){
|
---|
90 | $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ";
|
---|
91 | $res2 = $dbi->prepare("$sql");
|
---|
92 | $res2->execute();
|
---|
93 | $max = $res2->rowCount();
|
---|
94 | }else{ $max=1;}
|
---|
95 | $op="rec_add_votanti";
|
---|
96 | $rigat[$y].= "</div>";
|
---|
97 | $errvot1=0;
|
---|
98 | $numril=0;
|
---|
99 |
|
---|
100 | for ($i=1;$i<=$max;$i++){
|
---|
101 | $query="SELECT * FROM ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2
|
---|
102 | on (t1.id_gruppo=t2.id_gruppo) where t1.id_sez='$id_sez'
|
---|
103 | and t1.id_cons='$id_cons' and t1.orario='$ora' and t1.data='$giorno'";
|
---|
104 | if ($genere==0){
|
---|
105 | $query.=" and t2.num_gruppo=$i";
|
---|
106 | }
|
---|
107 | $sql=$query;
|
---|
108 | $result = $dbi->prepare("$sql");
|
---|
109 | $result->execute();
|
---|
110 | list($id_cons2,$id_sez2,$id_parz,$orario,$data, $voti_u, $voti_d, $voti_t,$id_gruppo) = $result->fetch(PDO::FETCH_NUM);
|
---|
111 | $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo' ";
|
---|
112 | $res2 = $dbi->prepare("$sql");
|
---|
113 | $res2->execute();
|
---|
114 | $sql="select count(0) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
115 | $resril = $dbi->prepare("$sql");
|
---|
116 | $resril->execute();
|
---|
117 | list($tmpril)=$resril->fetch(PDO::FETCH_NUM);
|
---|
118 | if($tmpril>$numril) $numril=$tmpril;
|
---|
119 | if ($res2)
|
---|
120 | list($gruppo)= $res2->fetch(PDO::FETCH_NUM);
|
---|
121 | else
|
---|
122 | $gruppo=0;
|
---|
123 | if (!$gruppo>0) {
|
---|
124 | $gruppo=$i;
|
---|
125 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where num_gruppo=$gruppo and id_cons=$id_cons";
|
---|
126 | $res3 = $dbi->prepare("$sql");
|
---|
127 | $res3->execute();
|
---|
128 | if ($res3)
|
---|
129 | list($id_gruppo)=$res3->fetch(PDO::FETCH_NUM);
|
---|
130 | }
|
---|
131 | if(!isset($precede[$id_gruppo])) $precede[$id_gruppo]=0; if(!isset($error)) $error=0;
|
---|
132 | if($precede[$id_gruppo]>($voti_t) and $voti_t!='') $error=1;
|
---|
133 | $precede[$id_gruppo]=$voti_t;
|
---|
134 | if (($voti_u+$voti_d and $voti_u+$voti_d!=$voti_t) or $error){
|
---|
135 | $riga[$y].= "<form class=\"tr\" data-ajax=\"false\" style=\"background-color: rgb(255, 0, 0); text-align: center\" name=\"votanti\" action=\"modules/Elezioni/salva_aff.php\">";
|
---|
136 | }else{
|
---|
137 | $riga[$y].= "<form class=\"tr\" data-ajax=\"false\" action=\"modules/Elezioni/salva_aff.php\">";
|
---|
138 | }
|
---|
139 | if ($genere==0){ // e' un referendum
|
---|
140 | $riga[$y].= "<span class=\"td\" align=\"center\">$gruppo</span>";
|
---|
141 | }
|
---|
142 | $riga[$y].= "<span class=\"td\"><input type=\"hidden\" name=\"op\" value=\"rec_add_votanti\"/>";
|
---|
143 | $riga[$y].= "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"/>"
|
---|
144 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\"/>"
|
---|
145 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"/>"
|
---|
146 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"/>"
|
---|
147 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\"/>";
|
---|
148 | list ($anno,$mese,$di)=explode('-',$giorno);
|
---|
149 | $riga[$y].= "$ora</span><span class=\"td\" align=\"center\">$di-$mese-$anno</span>";
|
---|
150 | if ($voti_u > $maschi) {$riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\">"; $errvot1=1;}
|
---|
151 | else $riga[$y].= "<span class=\"td\" align=\"center\">";
|
---|
152 | if ($y<$num and $vismf==0 and $voti_u==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"'$voti_u'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"$voti_u\" onfocus=\"select();\"";
|
---|
153 | $riga[$y].= " size=\"5\"/></span>";
|
---|
154 | if ($voti_d > $femmine) {$riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\">"; $errvot1=1;}
|
---|
155 | else $riga[$y].= "<span class=\"td\" align=\"center\">";
|
---|
156 | if ($y<$num and $vismf==0 and $voti_d==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"'$voti_d'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"$voti_d\" onfocus=\"select();\"";
|
---|
157 | $riga[$y].= " size=\"5\"/></span>";
|
---|
158 | if ($voti_t > ($maschi+$femmine)) {$riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\" ><input type=\"text\" id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\" onfocus=\"select();\"/>"; $errvot1=1;}
|
---|
159 | else $riga[$y].= "<span class=\"td\" align=\"center\"><input id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\" onfocus=\"select();\"/>";
|
---|
160 | $riga[$y].= "<input type=\"hidden\" name=\"id_parz\" value=\"$id_parz\"/>"
|
---|
161 | ."<input type=\"hidden\" name=\"data\" value=\"$giorno\"/>"
|
---|
162 | ."<input type=\"hidden\" name=\"orario\" value=\"$ora\"/>"
|
---|
163 | ."<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"/>"
|
---|
164 | ."<input type=\"hidden\" name=\"id_gruppo\" value=\"$id_gruppo\"/>";
|
---|
165 | $riga[$y].= "</span>";
|
---|
166 | if (chisei($id_cons_gen)>=64 and $y==$numril) { $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"/></span>";}
|
---|
167 | else $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"/></span>";
|
---|
168 | $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"/></span>";
|
---|
169 | $riga[$y].= "</form>";
|
---|
170 | if($numril>$uscita) $uscita=$numril;
|
---|
171 | }
|
---|
172 | # echo "</div>";
|
---|
173 | $sql="select count(voti_complessivi) from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez=$id_sez";
|
---|
174 | $compl = $dbi->prepare("$sql");
|
---|
175 | $compl->execute();
|
---|
176 | list ($complessivi)= $compl->fetch(PDO::FETCH_NUM);
|
---|
177 | }
|
---|
178 | # echo "Errori:";
|
---|
179 | if($errvot1) echo "<table><tr><td align=\"center\" bgcolor=\"red\"> <h1 style=\"color:white;\">I votanti inseriti superano il numero di elettori</h1></td></tr></table></br>";
|
---|
180 | if($error) echo "<table><tr><td align=\"center\" bgcolor=\"red\"> <h1 style=\"color:white;\">Numero di votanti inferiore della rilevazione precedente</h1></td></tr></table></br>";
|
---|
181 | echo "<table border=\"1\"><tr><td><b>Iscritti nella sezione</b> Maschi: $maschi - Femmine: $femmine - Totale: ".($maschi+$femmine)."</td></tr></table></br>";
|
---|
182 | foreach($riga as $key=>$val){
|
---|
183 | echo $rigat[$key];
|
---|
184 | echo $riga[$key];
|
---|
185 | if($key>$uscita) { break;}
|
---|
186 | }
|
---|
187 | echo "</div></td></tr></table>";
|
---|
188 | }
|
---|
189 |
|
---|
190 |
|
---|
191 | //////////////////////////////////////////////////////////////////////
|
---|
192 | // da qui va la sezione per le preferenze candidati consiglieri
|
---|
193 | //////////////////////////////////////////////////////////////////////
|
---|
194 | function preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
195 | global $aid, $prefix, $dbi, $id_lista,$genere,$id_cons_gen,$id_gruppo,$sezi,$circo,$votog,$votol,$votoc,$conscirc,$op;
|
---|
196 | global $tipo_cons,$limite,$dettnulli,$disgiunto,$votoc;
|
---|
197 | $bgcolor1="#7777ff";
|
---|
198 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
199 | echo "<SCRIPT type=\"text/javascript\">\n";
|
---|
200 | echo "function vai_lista(idrif){\n";
|
---|
201 | echo "var element=document.getElementById('pag')\n";
|
---|
202 | echo "var elista=document.getElementById(idrif)\n";
|
---|
203 | echo "var url=element.value+elista.value\n";
|
---|
204 | echo "window.document.location.href=url \n";
|
---|
205 | echo "}\n";
|
---|
206 | echo "</script>\n";
|
---|
207 | if ($genere==4){
|
---|
208 | $sql="SELECT voti_uomini,voti_donne, voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_cons='$id_cons' order by data desc,orario desc limit 0,1";
|
---|
209 | $result = $dbi->prepare("$sql");
|
---|
210 | $result->execute();
|
---|
211 |
|
---|
212 |
|
---|
213 | list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM);
|
---|
214 | echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"
|
---|
215 | ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>"
|
---|
216 | ."<tr><td></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._TOT_ULT."</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_u</td><td align=\"center\" bgcolor=\"$bgcolor2\">$voti_d</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_t</td></tr>";
|
---|
217 | echo "</table>";
|
---|
218 | }
|
---|
219 | $sql="select validi,nulli,bianchi,contestati from ".$prefix."_ele_sezioni where id_sez='$id_sez' ";
|
---|
220 | $result = $dbi->prepare("$sql");
|
---|
221 | $result->execute();
|
---|
222 | list($v1,$v2,$v3,$v4)=$result->fetch(PDO::FETCH_NUM);
|
---|
223 | if($v1+$v2+$v3+$v4>0){
|
---|
224 | //controlla se sono stati inseriti i votanti
|
---|
225 | $sql="SELECT preferenze, id_fascia, id_conf,solo_gruppo, disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
|
---|
226 | $result = $dbi->prepare("$sql");
|
---|
227 | $result->execute();
|
---|
228 |
|
---|
229 |
|
---|
230 | list($numprefs,$fascia,$id_conf,$flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);
|
---|
231 | $dettnulli=$flagsg;
|
---|
232 | ####### 06-11-2014 - circoscrizionali - nello spostamento ad altra sezione resta sullo stesso numero di lista anche se sono sezioni di diverse circoscrizioni
|
---|
233 | if ($circo and $id_lista){
|
---|
234 | $sql="SELECT id_circ from ".$prefix."_ele_lista where id_lista=$id_lista";
|
---|
235 | $result = $dbi->prepare("$sql");
|
---|
236 | $result->execute();
|
---|
237 | list($tmp_circ)=$result->fetch(PDO::FETCH_NUM);
|
---|
238 | if($tmp_circ==$id_circ){
|
---|
239 | $sql="SELECT num_lista from ".$prefix."_ele_lista where id_lista=$id_lista";
|
---|
240 | $res_lis = $dbi->prepare("$sql");
|
---|
241 | $res_lis->execute();
|
---|
242 | list($num_lista)=$res_lis->fetch(PDO::FETCH_NUM);
|
---|
243 | } else $id_lista=0;
|
---|
244 | }
|
---|
245 |
|
---|
246 | if(!$votog and ($genere==3 or $genere==5)){
|
---|
247 | $sql="select validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
248 | $result = $dbi->prepare("$sql");
|
---|
249 | $result->execute();
|
---|
250 |
|
---|
251 |
|
---|
252 | }else{
|
---|
253 | $sql="select validi,nulli,bianchi,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
254 | $result = $dbi->prepare("$sql");
|
---|
255 | $result->execute();
|
---|
256 | }
|
---|
257 |
|
---|
258 | list($validi,$nulli,$bianchi,$contestati,$votinulli) = $result->fetch(PDO::FETCH_NUM);
|
---|
259 | echo "<table class=\"table-menu\" style=\"width: 100%;\"><tr>";
|
---|
260 | $sql="SELECT id_lista, descrizione,num_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo order by num_lista";
|
---|
261 | $res_lis = $dbi->prepare("$sql");
|
---|
262 | $res_lis->execute();
|
---|
263 |
|
---|
264 |
|
---|
265 | $num_liste = $res_lis->rowCount();
|
---|
266 | $ele_lista='';
|
---|
267 | if (($genere==4 or $genere==5) and !$votoc) { //liste a piu' candidati
|
---|
268 | if(($genere==5 and $id_conf and $fascia<=$limite and !$disgiunto) and !$id_lista) { //esclude il voto di lista per le comunali nei comuni sotto fascia limite
|
---|
269 | $sql="SELECT id_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo order by num_lista limit 0,1";
|
---|
270 | $result = $dbi->prepare("$sql");
|
---|
271 | $result->execute();
|
---|
272 |
|
---|
273 |
|
---|
274 | list($id_lista)=$result->fetch(PDO::FETCH_NUM);
|
---|
275 | }
|
---|
276 | echo "<td colspan=\"2\">";
|
---|
277 | echo "<form name=\"liste\" data-ajax=\"false\" action=\"admin.php\">"; # data-ajax=\"false\"
|
---|
278 | echo "<input type=\"hidden\" id=\"pag\" name=\"pag\" value=\"admin.php?id_cons_gen=$id_cons_gen&op=$op&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=3&id_lista=\">";
|
---|
279 | echo "<select id=\"id_lista\" name=\"id_lista\" onChange=\"vai_lista('id_lista');\">";
|
---|
280 | if ($id_lista){
|
---|
281 | echo "<option value=\"0\">"._VOTI_LISTA;
|
---|
282 | $ele_lista=" and t1.id_lista='$id_lista' ";
|
---|
283 | }else{
|
---|
284 | echo "<option value=\"0\" selected>"._VOTI_LISTA;
|
---|
285 | $ele_lista=" group by t1.id_lista ";
|
---|
286 | if(!isset($votolista)) $votolista=0;
|
---|
287 | }
|
---|
288 | $preflis[]=array();
|
---|
289 | while(list($id_rif,$descrizione,$num_lis) = $res_lis->fetch(PDO::FETCH_NUM)) {
|
---|
290 | $segna='';
|
---|
291 | $sql="SELECT t1.voti from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif limit 0,1";
|
---|
292 | $result = $dbi->prepare("$sql");
|
---|
293 | $result->execute();
|
---|
294 | if($result->rowCount()) $ctrvoticand=1; else $ctrvoticand=0;
|
---|
295 | $sql="SELECT sum(t1.voti),0,0 from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif";
|
---|
296 | $result = $dbi->prepare("$sql");
|
---|
297 | $result->execute();
|
---|
298 | list($votisezcand)=$result->fetch(PDO::FETCH_NUM);
|
---|
299 | if((($fascia>$limite or $disgiunto) or !$id_conf) or $genere==4){
|
---|
300 | $sql="SELECT voti,solo_lista from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_rif'";
|
---|
301 | $result = $dbi->prepare("$sql");
|
---|
302 | $result->execute();
|
---|
303 | }else{
|
---|
304 | $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_rif'";
|
---|
305 | $result = $dbi->prepare("$sql");
|
---|
306 | $result->execute();
|
---|
307 | list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
308 | $sql="SELECT sum(voti),0 from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
309 | $result = $dbi->prepare("$sql");
|
---|
310 | $result->execute();
|
---|
311 | }
|
---|
312 | list($votisezlis,$sgpl)=$result->fetch(PDO::FETCH_NUM);
|
---|
313 | $preflis[$id_rif]=$votisezlis;
|
---|
314 | if($votisezcand>($votisezlis*$numprefs))
|
---|
315 | {$segna="style=\"background-color: #dd0000;\""; }#$segna2=$segna;
|
---|
316 | elseif($ctrvoticand)
|
---|
317 | $segna="style=\"background-color: #99CC33;\"";
|
---|
318 | $sql="SELECT t1.voti,t2.num_cand FROM ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on t1.id_cand=t2.id_cand where t1.id_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$id_rif'";
|
---|
319 | $res4 = $dbi->prepare("$sql");
|
---|
320 | $res4->execute();
|
---|
321 | $errcand[$id_rif]=array();
|
---|
322 | while(list($testvotic,$numcand)=$res4->fetch(PDO::FETCH_NUM))
|
---|
323 | {if($votisezlis<$testvotic) { $segna="style=\"background-color: #dd0000;\"";$errcand[$id_rif][]=$numcand;}}
|
---|
324 | $sel = ($id_rif == $id_lista) ? "selected" : "";
|
---|
325 | echo "<option $segna value=\"$id_rif\" $sel>";
|
---|
326 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
327 | echo $num_lis.") ".$descrizione;
|
---|
328 | # echo $num_lis.") ".substr($descrizione,0,30);
|
---|
329 | }
|
---|
330 | echo "</select></form></td></tr><tr><td style=\"vertical-align: top;\"> </td>\n";
|
---|
331 | }else {
|
---|
332 | $id_lista=0;
|
---|
333 | }
|
---|
334 | echo "<td style=\"vertical-align: top;\">";
|
---|
335 | if ((!$id_lista)){$tab="_ele_voti_lista";} else {$tab="_ele_voti_candidati";}
|
---|
336 | if(($genere==4 or ($genere==5 and $votog)) and !$id_lista) {
|
---|
337 | $sql="SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli,t2.contestati,0,0 from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez=$id_sez group by t1.id_sez";
|
---|
338 | $result = $dbi->prepare("$sql");
|
---|
339 | $result->execute();
|
---|
340 | }else{
|
---|
341 | $sql="SELECT sum(t1.voti),t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo,t1.id_sez from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez='$id_sez' group by t1.id_sez,t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo";
|
---|
342 | $result = $dbi->prepare("$sql");
|
---|
343 | $result->execute();
|
---|
344 | }
|
---|
345 |
|
---|
346 | // aggiunte le variabili $sgpl e $vnulli2 per la gestione dei voti 1) al solo presidente per singola lista - 2) al solo presidente per singola lista perché nullo o contestato quello di lista
|
---|
347 | $isscr= $result->rowCount();
|
---|
348 | list( $voti_sez, $validi2, $sg,$cont2,$vnulli2,$bia2,$nul2,$con2,$vnul2,$sgpl) = $result->fetch(PDO::FETCH_NUM);
|
---|
349 | if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){
|
---|
350 | $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";
|
---|
351 | $resg = $dbi->prepare("$sql");
|
---|
352 | $resg->execute();
|
---|
353 | list($sgpl)=$resg->fetch(PDO::FETCH_NUM);
|
---|
354 | if ($sg != $sgpl) echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></table>";
|
---|
355 | }
|
---|
356 | $valista=$validi2;
|
---|
357 | ####### controlli
|
---|
358 | $sql="select * from ".$prefix."_ele_controlli where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
359 | $resc = $dbi->prepare("$sql");
|
---|
360 | $resc->execute();
|
---|
361 | if($resc->rowCount()){
|
---|
362 | if(!$id_lista or $genere==3){ //controllo di congruenza
|
---|
363 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
364 | $res2 = $dbi->prepare("$sql");
|
---|
365 | $res2->execute();
|
---|
366 | list($tot) = $res2->fetch(PDO::FETCH_NUM);
|
---|
367 | if ($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2!=$tot and $validi+$sg>0){
|
---|
368 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2)."</b><br></td></table>";
|
---|
369 | }
|
---|
370 | if((($voti_sez)!=$validi2) and ($voti_sez>0)){
|
---|
371 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".($voti_sez)." "._NO_VAL_VOTI." ".$validi2."</b><br></td></tr></table>";
|
---|
372 | }
|
---|
373 | }
|
---|
374 | if($genere==5 or $genere==4){
|
---|
375 | if($id_lista){
|
---|
376 | $sql="SELECT max(t1.voti),sum(t1.voti) from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista='$id_lista'";
|
---|
377 | $result = $dbi->prepare("$sql");
|
---|
378 | $result->execute();
|
---|
379 | list($votimaxcand,$votisezcand)=$result->fetch(PDO::FETCH_NUM);
|
---|
380 | if(($fascia>$limite or $disgiunto) or !$id_conf){
|
---|
381 | $sql="SELECT sum(t2.voti) from ".$prefix."_ele_voti_lista as t2 where t2.id_sez='$id_sez' and t2.id_lista='$id_lista'";
|
---|
382 | $result = $dbi->prepare("$sql");
|
---|
383 | $result->execute();
|
---|
384 | }else{
|
---|
385 | $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'";
|
---|
386 | $result = $dbi->prepare("$sql");
|
---|
387 | $result->execute();
|
---|
388 | list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
389 | $sql="SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
390 | $result = $dbi->prepare("$sql");
|
---|
391 | $result->execute();
|
---|
392 | }
|
---|
393 | list($votisezlis)=$result->fetch(PDO::FETCH_NUM);
|
---|
394 | $errpres=0;
|
---|
395 | if($votisezcand>($votisezlis*$numprefs))
|
---|
396 | {
|
---|
397 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti di preferenza $votisezcand <br/>superano quelli ammessi ".$votisezlis*$numprefs."</b><br></td></tr></table>";
|
---|
398 | $segna2="style=\"background-color: #dd0000;\"";
|
---|
399 | $errpres=1;
|
---|
400 | }
|
---|
401 | if($votimaxcand>$votisezlis and !$errpres)
|
---|
402 | {
|
---|
403 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti di preferenza di un candidato $votimaxcand <br/>superano i voti di lista $votisezlis</b><br></td></tr></table>";
|
---|
404 | $segna2="style=\"background-color: #dd0000;\"";
|
---|
405 | }
|
---|
406 |
|
---|
407 | }#else{
|
---|
408 | $sql="select solo_gruppo from ".$prefix."_ele_sezioni where id_sez='$id_sez' ";
|
---|
409 | $resgs = $dbi->prepare("$sql");
|
---|
410 | $resgs->execute();
|
---|
411 | list($sgs3)=$resgs->fetch(PDO::FETCH_NUM);
|
---|
412 | $sql="select sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' ";
|
---|
413 | $resgs = $dbi->prepare("$sql");
|
---|
414 | $resgs->execute();
|
---|
415 | list($vsg3)=$resgs->fetch(PDO::FETCH_NUM);
|
---|
416 | if($sgs3!=$vsg3 and $flagsg)
|
---|
417 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti al solo gruppo: $sgs3 non corrispondono a quelli inseriti nella scheda dei gruppi $vsg3 </b><br></td></tr></table>";
|
---|
418 |
|
---|
419 | }
|
---|
420 | #die("TEST: if($sgs3!=$vsg3)");
|
---|
421 | #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto
|
---|
422 | $errgrulis=array();
|
---|
423 | if($genere==5 and !$disgiunto and ($tipo_cons==18 or $tipo_cons==19)){
|
---|
424 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo";
|
---|
425 | $resref = $dbi->prepare("$sql");
|
---|
426 | $resref->execute();
|
---|
427 | # die("qui: $sql");
|
---|
428 | $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";
|
---|
429 | $res4 = $dbi->prepare("$sql");
|
---|
430 | $res4->execute();
|
---|
431 | list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);
|
---|
432 | if ($sezscrl)
|
---|
433 | while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))
|
---|
434 | {
|
---|
435 | $sql="SELECT sum(voti),sum(solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
436 | $res3 = $dbi->prepare("$sql");
|
---|
437 | $res3->execute();
|
---|
438 | $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
439 | $res4 = $dbi->prepare("$sql");
|
---|
440 | $res4->execute();
|
---|
441 | list($vgruppo3,$vsl3)=$res3->fetch(PDO::FETCH_NUM);
|
---|
442 | $vgruppo=$vgruppo3-$vsl3;
|
---|
443 | list($vliste)=$res4->fetch(PDO::FETCH_NUM);
|
---|
444 | if($vliste>$vgruppo)
|
---|
445 | {
|
---|
446 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
447 | $result = $dbi->prepare("$sql");
|
---|
448 | $result->execute();
|
---|
449 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
450 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate<br/> superano i voti assegnati al gruppo $dgruppo </b><br></td></tr></table>";
|
---|
451 | $errgrulis[$id_gruppo]=1;
|
---|
452 | }
|
---|
453 | elseif($vliste<$vgruppo)
|
---|
454 | {
|
---|
455 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
456 | $result = $dbi->prepare("$sql");
|
---|
457 | $result->execute();
|
---|
458 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
459 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr></table>";
|
---|
460 | $errgrulis[$id_gruppo]=1;
|
---|
461 | }
|
---|
462 | }
|
---|
463 | }
|
---|
464 | }
|
---|
465 |
|
---|
466 |
|
---|
467 | echo "\n<form name=\"sezioni\" data-ajax=\"false\" action=\"modules/Elezioni/salva_liste.php\">"
|
---|
468 | ."<input type=\"hidden\" name=\"op\" value=\"rec_voti\">"
|
---|
469 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
470 | ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
|
---|
471 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"
|
---|
472 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
473 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
474 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
|
---|
475 | ."<input type=\"hidden\" name=\"tabella\" value=\"$tab\">"
|
---|
476 | ."<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\">\n"
|
---|
477 | ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">\n";
|
---|
478 | echo "<table class=\"table-menu\" style=\"width: 90%; color: black\">";
|
---|
479 | echo "<tr><td bgcolor=\"$bgcolor1\" align=\"left\" width=\"32\">";
|
---|
480 | if ($genere<4){
|
---|
481 | // echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._LISTA."</b></td>";
|
---|
482 | }
|
---|
483 | echo "<b>"._NUM."</b></td>";
|
---|
484 | if($id_lista){
|
---|
485 | echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._CANDIDATO."</b></td>"
|
---|
486 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b> (alla lista ".$preflis[$id_lista].")</td>";
|
---|
487 | }else{
|
---|
488 | echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._DESCR."</b></td>"
|
---|
489 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";
|
---|
490 | #funzione di inserimento del dettaglio di voti nulli sospesa, non ritenuta utile
|
---|
491 | # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)
|
---|
492 | # echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NULLI_LISTE."</b></td>";
|
---|
493 | if($disgiunto){
|
---|
494 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLOLIS."</b></td>";
|
---|
495 | }
|
---|
496 | }
|
---|
497 | echo "</tr>\n";
|
---|
498 |
|
---|
499 |
|
---|
500 | if($id_lista) $sql="select t1.* from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista,t1.num_cand";
|
---|
501 | else $sql="select 0,'$id_cons',t1.id_lista,'','','','','',0 from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista";
|
---|
502 | $result = $dbi->prepare("$sql");
|
---|
503 | $result->execute();
|
---|
504 |
|
---|
505 |
|
---|
506 | $max = $result->rowCount();
|
---|
507 | $tot_pref=0;
|
---|
508 | $i=1;
|
---|
509 |
|
---|
510 | if($id_lista) {
|
---|
511 | while(list($id_cand,$id_cons2,$id_lista2,$nl, $cognome, $nome, $note, $simbolo, $num_cand) = $result->fetch(PDO::FETCH_NUM)){
|
---|
512 | // dati lista
|
---|
513 | $sql="select id_lista, descrizione,simbolo,num_lista from ".$prefix."_ele_lista where id_lista='$id_lista2'";
|
---|
514 | $result1 = $dbi->prepare("$sql");
|
---|
515 | $result1->execute();
|
---|
516 | list($id_lista3,$descr_lista,$simb_lista,$num_lista)=$result1->fetch(PDO::FETCH_NUM);
|
---|
517 | // dati gruppo
|
---|
518 | $sql="select descrizione,simbolo from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
519 | $result2 = $dbi->prepare("$sql");
|
---|
520 | $result2->execute();
|
---|
521 | list($descr_gruppo,$simb_gruppo)=$result2->fetch(PDO::FETCH_NUM);
|
---|
522 | echo "<tr bgcolor=\"$bgcolor2\">";
|
---|
523 | if ($genere<4){
|
---|
524 | echo "<td align=\"left\"><b><img src=\"images/lista/$simb_lista \" width=\"32\" heigth=\"32\" align=\"center\" ALT=\"$descr_lista\" > </b></td>";
|
---|
525 | }
|
---|
526 | echo "<td align=\"center\"><b> $num_cand </b></td>"
|
---|
527 | ."<td align=\"left\"><b>$cognome $nome</b></td>";
|
---|
528 | $cond_sele="and id_cand=$id_cand";
|
---|
529 | $sql="SELECT voti FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele";
|
---|
530 | $res = $dbi->prepare("$sql");
|
---|
531 | $res->execute();
|
---|
532 | list($voti)= $res->fetch(PDO::FETCH_NUM); #if(!$voti) $voti2=''; else $voti2=$voti;
|
---|
533 | if(in_array($num_cand,$errcand[$id_lista2])) $errcolor="style=\"background-color: rgb(255, 0, 0);\""; else $errcolor='';
|
---|
534 | echo "<td align=\"right\" $errcolor><input name=\"voti$num_cand\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\" onfocus=\"select();\">";
|
---|
535 | echo "<input type=\"hidden\" name=\"id_cand$num_cand\" value=\"$id_cand\"></td></tr>\n";
|
---|
536 | $i++;
|
---|
537 | $tot_pref+=$voti;
|
---|
538 | }
|
---|
539 | }else {
|
---|
540 | if($circo) $circot1=" and t1.id_circ=$id_circ"; else $circot1='';
|
---|
541 | $sql="select t2.voti,t1.id_lista, descrizione,simbolo,t1.num_lista,t2.nulli_lista,t2.solo_lista,t1.id_gruppo
|
---|
542 | from ".$prefix."_ele_lista as t1, ".$prefix."_ele_voti_lista as t2
|
---|
543 | where t1.id_cons='$id_cons'
|
---|
544 | and t1.id_lista=t2.id_lista
|
---|
545 | and t2.id_sez=$id_sez
|
---|
546 | $circot1
|
---|
547 | order by t1.num_lista";
|
---|
548 |
|
---|
549 | try {
|
---|
550 | $result1 = $dbi->prepare("$sql");
|
---|
551 | $result1->execute();
|
---|
552 | }
|
---|
553 | catch(PDOException $e)
|
---|
554 | {
|
---|
555 | echo $sql . "<br>" . $e->getMessage();
|
---|
556 | }
|
---|
557 | $scruliste=$result1->rowCount();
|
---|
558 | if (!$scruliste){
|
---|
559 | $sql="select null,id_lista, descrizione,simbolo,num_lista,'','',id_gruppo
|
---|
560 | from ".$prefix."_ele_lista where id_cons='$id_cons' $circo
|
---|
561 | order by num_lista";
|
---|
562 | $result1 = $dbi->prepare("$sql");
|
---|
563 | $result1->execute();
|
---|
564 | }
|
---|
565 | $tvnpl=0;
|
---|
566 | $tslpl=0;
|
---|
567 | # $segna2='';
|
---|
568 | $sezscru=0;
|
---|
569 | while (list($voti,$id_lista3,$descr_lista,$simb_lista,$num_lista,$vnpl,$slpl,$rifgruppo)=$result1->fetch(PDO::FETCH_NUM)){
|
---|
570 | echo "<tr bgcolor=\"$bgcolor2\">";
|
---|
571 | // if ($genere<4 or $votoc){
|
---|
572 | // }
|
---|
573 | $sql="select max(t1.voti),sum(t1.voti), count(t1.voti) from ".$prefix."_ele_voti_candidati as t1, ".$prefix."_ele_candidati as t2 where t1.id_cand=t2.id_cand and t1.id_sez='$id_sez' and t2.id_lista='$id_lista3'";
|
---|
574 | $rese = $dbi->prepare("$sql");
|
---|
575 | $rese->execute();
|
---|
576 | list($maxvotic,$sumvotic,$numrec)=$rese->fetch(PDO::FETCH_NUM);#die("TEST: $numrec");
|
---|
577 | if($numrec>0 or ($votoc and $scruliste)) {$sezscru=1; $statuscol="#99CC33;";} else $statuscol='';
|
---|
578 | if($maxvotic>$voti or $sumvotic>$voti*$numprefs) $statuscol='#dd0000;'; #$segna="style=\"background-color: #dd0000;\"";
|
---|
579 | $sql="select * from ".$prefix."_ele_controlli where tipo='lista' and id_sez='$id_sez' and id='$id_lista3'";
|
---|
580 | $rese = $dbi->prepare("$sql");
|
---|
581 | $rese->execute();
|
---|
582 | if($rese->rowCount()) $statuscol='#dd0000;'; #$segna="style=\"background-color: #dd0000;\"";
|
---|
583 | list($sezcol)=$rese->fetch(PDO::FETCH_NUM);
|
---|
584 | $segna="style=\"background-color: $statuscol\"";
|
---|
585 | if ($statuscol) $errcolor=$segna; else $errcolor='';
|
---|
586 | if ($statuscol=='#dd0000;')
|
---|
587 | $bordcolor="border-color:red;";
|
---|
588 | else $bordcolor='';
|
---|
589 | if(isset($errgrulis[$rifgruppo])) {
|
---|
590 | $errcolor="style=\"background-color: rgb(255, 0, 0);\"";
|
---|
591 | $bordcolor="border-color:red;";
|
---|
592 | }elseif(!$errcolor && $numrec) $errcolor="style=\"background-color: #99CC33;\"";
|
---|
593 | if($genere>=4 and !$votoc) $stilcur="style=\"cursor: pointer;\""; else $stilcur='';
|
---|
594 | echo "<td align=\"center\" $errcolor><b> $num_lista </b></td>"
|
---|
595 | ."<td align=\"left\" $stilcur onClick=\"vai_lista('id_rif$i');\"><b>$descr_lista</b></td>";
|
---|
596 | ## $cond_sele="and id_lista=$id_lista3";
|
---|
597 | echo "<td align=\"right\"><input name=\"voti$i\" value=\"".$voti."\" size=\"7\" onfocus=\"select();\" style=\"text-align:right; $bordcolor;\"><input id=\"id_rif$i\" type=\"hidden\" name=\"id_lista$i\" value=\"$id_lista3\">";
|
---|
598 | #funzione non ritenuta utile
|
---|
599 | # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19) { echo "</td><td align=\"right\"><input name=\"vnpl$i\" value=\"".$vnpl."\" size=\"7\" style=\"text-align:right\">"; $tvnpl+=$vnpl;}
|
---|
600 | if($disgiunto) {echo "</td><td align=\"right\"><input name=\"slpl$i\" value=\"".$slpl."\" size=\"7\" style=\"text-align:right\" onfocus=\"select();\">"; $tslpl+=intval($slpl);}
|
---|
601 | echo "</td>";
|
---|
602 | // echo "<td align=\"right\">$sgpl";
|
---|
603 | echo "</tr>\n";
|
---|
604 | $i++;
|
---|
605 | $tot_pref+=$voti;
|
---|
606 | }
|
---|
607 | }
|
---|
608 | if(!isset($segna2)) $segna2='';
|
---|
609 | if(!$id_lista) {
|
---|
610 | if ($tot_pref!=$validi2 and $sezscru) $segna2="style=\"background-color: #dd0000;\"";
|
---|
611 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><font size=\"3\">"._TOT._VOTI_LISTA."</font></td><td align=\"center\" $segna2><font size=\"3\">$tot_pref</font></td>";
|
---|
612 | # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)
|
---|
613 | # echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tvnpl."</font></td>";
|
---|
614 | if($disgiunto)
|
---|
615 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tslpl."</font></td>";
|
---|
616 | echo "</tr>";
|
---|
617 | }
|
---|
618 | else echo "<tr bgcolor=\"$bgcolor1\"><td></td><td>"._TOTPREF."</td><td align=\"center\" $segna2>$tot_pref</td></tr>";
|
---|
619 | // toglie ai candidati la visual... del solo_gruppo
|
---|
620 | if(!$votog) {
|
---|
621 | if (($genere==3 OR $genere==5) and (!$id_lista) and (($disgiunto or $fascia>$limite) or !$id_conf)) { //gruppo e liste
|
---|
622 | echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._VALIDI_LISTA."</b></td><td align=\"center\"><input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"><input name=\"valista\" value=\"$valista\" size=\"5\" style=\"text-align:right;\" onfocus=\"select();\"></td></tr>";
|
---|
623 | echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\"><input name=\"sg\" value=\"$sg\" size=\"5\" style=\"text-align:right;\" onfocus=\"select();\">";
|
---|
624 | if(defined('_NULLISTA'))
|
---|
625 | echo "<input type=\"hidden\" name=\"votinulli\" value=\"$votinulli\"><input type=\"hidden\" name=\"contestati\" value=\"$contestati\"></td></tr>";
|
---|
626 | else
|
---|
627 | echo "</td></tr><tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._NULLI_LISTE."</b></td><td align=\"center\"><input name=\"votinulli\" value=\"$votinulli\" size=\"5\" style=\"text-align:right;\" onfocus=\"select();\">"
|
---|
628 | ."</td></tr><tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._CONTESTATI_LISTE."</b></td><td align=\"center\"><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right;\" onfocus=\"select();\"></td></tr>";
|
---|
629 |
|
---|
630 | }elseif (($genere==3 OR $genere==5) and !$votoc and (($disgiunto or $fascia>$limite) or !$id_conf)){ //}elseif ($tipo_cons!=10 and $tipo_cons!=11){
|
---|
631 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">$sg</td></tr>";
|
---|
632 | }
|
---|
633 | /* visualizzazione tolta perché inappropriata 04/03/2022
|
---|
634 | ######modifica del 16-04-2009 per visualizzare i voti al solo sindaco nei comuni con meno di 15000 abitanti
|
---|
635 | elseif(($genere==3 OR $genere==5) and ($id_lista) and ($fascia<=$limite or !$id_conf) and $numprefs==1) {
|
---|
636 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_lista where id_lista='$id_lista'";
|
---|
637 | $resvg = $dbi->prepare("$sql");
|
---|
638 | $resvg->execute();
|
---|
639 |
|
---|
640 |
|
---|
641 | list($id_gruppo) = $resvg->fetch(PDO::FETCH_NUM);
|
---|
642 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo' and id_sez='$id_sez'";
|
---|
643 | $resvg = $dbi->prepare("$sql");
|
---|
644 | $resvg->execute();
|
---|
645 |
|
---|
646 |
|
---|
647 | list($voti_sind) = $resvg->fetch(PDO::FETCH_NUM);
|
---|
648 |
|
---|
649 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">".($voti_sind - $tot_pref)."</td></tr>";
|
---|
650 | } */
|
---|
651 | ###### fine modifica del 16-04-2009
|
---|
652 |
|
---|
653 | }
|
---|
654 | echo "<tr>";
|
---|
655 | echo "<td></td><td></td>";
|
---|
656 | echo "<td align=\"center\"><input type=\"submit\" id=\"update\" name=\"update\" value=\""._OK."\"></td>";
|
---|
657 | echo "</tr></table>";
|
---|
658 | if(chisei($id_cons_gen)>=64){
|
---|
659 | echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"1\">"._DELETE."</td>";
|
---|
660 | } # onclick=\"javascript:del_dati()\"
|
---|
661 | echo "</form></tr></table>";
|
---|
662 |
|
---|
663 |
|
---|
664 |
|
---|
665 | }
|
---|
666 | #if (!((!$votog) and ($genere==3 OR $genere==5) and ($fascia>$limite)))
|
---|
667 | finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
668 | }
|
---|
669 |
|
---|
670 |
|
---|
671 | function finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
672 | global $aid, $prefix, $dbi,$id_cons_gen,$genere,$votog,$fascia,$limite;
|
---|
673 | ////////////////////////////////////////////
|
---|
674 | // da qua va la sezione per i voti finali
|
---|
675 | ///////////////////////////////////////////
|
---|
676 | $bgcolor1="#7777ff";
|
---|
677 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
678 |
|
---|
679 |
|
---|
680 |
|
---|
681 | echo "<form name=\"spogliovoti\" data-ajax=\"false\" action=\"modules/Elezioni/salva_voti.php\">"
|
---|
682 | ."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">";
|
---|
683 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
684 | ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
|
---|
685 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
686 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
687 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";
|
---|
688 |
|
---|
689 | echo "<table border=\"0\" width=\"100%\" align=\"center\"><tr bgcolor=\"$bgcolor1\" align=\"center\">";
|
---|
690 | /* if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )
|
---|
691 | echo "<td width=\"32\"><b>"._VOTI_LISTA."</b></td>";
|
---|
692 | else */
|
---|
693 | echo "<td width=\"15%\"><b>"._VALIDI."</b></td>";
|
---|
694 | echo "<td width=\"82\"><b>"._NULLI."</b></td>"
|
---|
695 | ."<td><b>"._BIANCHI."</b></td>"
|
---|
696 | ."<td width=\"82\"><b>"._VOTINULLI."</b></td>"
|
---|
697 | ."<td><b>"._CONTESTATI."</b></td>"
|
---|
698 | ."<td><b>"._TOTNON."</b></td>"
|
---|
699 | ."<td><b>"._TOTALEVOTI."</b></td>"
|
---|
700 | ."<td bgcolor=\"#ffffff\"></td> </tr>";
|
---|
701 | /*if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )
|
---|
702 | $result = mysql_query("select id_cons,id_sez,validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista,solo_gruppo,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
703 | $res = $dbi->prepare("$sql");
|
---|
704 | $res->execute();
|
---|
705 |
|
---|
706 |
|
---|
707 | else */
|
---|
708 | $sql = "select id_cons,id_sez,validi,nulli,bianchi,contestati,voti_nulli,'0','0','0',solo_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
709 | $result = $dbi->prepare("$sql");
|
---|
710 | $result->execute();
|
---|
711 |
|
---|
712 |
|
---|
713 | list($id_cons2,$id_sez2,$validi, $nulli, $bianchi, $contestati,$votinulli,$sg,$conts,$nullis,$sololista) = $result->fetch(PDO::FETCH_NUM);
|
---|
714 | $tot_nulli=$nulli+$bianchi+$contestati+$votinulli;
|
---|
715 | $tot_voti=$validi+$tot_nulli+$conts+$nullis;
|
---|
716 | // ."</td><td><input name=\"sololista\" value=\"$sololista\" size=\"5\" style=\"text-align:right\">" --- ."<td><b>"._SOLOLIS."</b></td>"
|
---|
717 |
|
---|
718 |
|
---|
719 | echo "<tr bgcolor=\"$bgcolor2\" align=\"center\"><td align=\"left\"><input name=\"validi\" value=\"$validi\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\">";
|
---|
720 | /* if(($genere==3 or $genere==5) and !$votog and $ops==3){
|
---|
721 | echo "</td><td>$nulli"
|
---|
722 | ."</td><td>$bianchi";
|
---|
723 | echo "<input type=\"hidden\" name=\"nulli\" value=\"$nulli\"><input type=\"hidden\" name=\"bianchi\" value=\"$bianchi\">";
|
---|
724 | }else{ */
|
---|
725 | echo "</td><td><input name=\"nulli\" value=\"$nulli\" size=\"5\" style=\"text-align:right;\" onfocus=\"select();\">"
|
---|
726 | ."</td><td><input name=\"bianchi\" value=\"$bianchi\" size=\"5\" style=\"text-align:right;\" onfocus=\"select();\">";
|
---|
727 | // }
|
---|
728 | echo "</td><td><input name=\"votinulli\" value=\"$votinulli\" style=\"text-align:right;\" onfocus=\"select();\">"
|
---|
729 | ."</td><td><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\" onfocus=\"select();\">"
|
---|
730 | ."</td><td>$tot_nulli"
|
---|
731 | ."</td><td>$tot_voti</td><td>"
|
---|
732 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"
|
---|
733 | ."<input type=\"hidden\" name=\"ops\" value=\"$ops\">"
|
---|
734 | ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
|
---|
735 | ."</td></tr></table></form>"; //</td></tr>";
|
---|
736 |
|
---|
737 |
|
---|
738 | // echo "</table>";
|
---|
739 | /* echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
740 | if (!$validi) {
|
---|
741 | echo "document.spogliovoti.validi.focus()\n";
|
---|
742 | echo "document.spogliovoti.validi.select()\n";
|
---|
743 | }
|
---|
744 | echo "//-->\n"
|
---|
745 | ."</script>\n"; */
|
---|
746 |
|
---|
747 |
|
---|
748 | }
|
---|
749 |
|
---|
750 |
|
---|
751 | function preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
752 | global $aid, $prefix, $dbi, $tipo_cons, $genere,$id_cons_gen,$sezi,$circo,$dettnulli;
|
---|
753 | ////////////////////////////////////////////
|
---|
754 | // da qua va la sezione per le preferenze ai gruppi
|
---|
755 | ///////////////////////////////////////////
|
---|
756 | // Controllo immmissioni
|
---|
757 |
|
---|
758 | $bgcolor1="#7777ff";
|
---|
759 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
760 | $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ";
|
---|
761 | $res = $dbi->prepare("$sql");
|
---|
762 | $res->execute();
|
---|
763 |
|
---|
764 |
|
---|
765 | $max = $res->rowCount();
|
---|
766 | $max = $max-1;
|
---|
767 | /* echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
768 | if ($genere==0) {
|
---|
769 | echo "document.sezioni.si1.focus()\n";
|
---|
770 | echo "document.sezioni.si1.select()\n";
|
---|
771 | } else {
|
---|
772 | echo "document.sezioni.voti1.focus()\n"
|
---|
773 | ."document.sezioni.voti1.select()\n";
|
---|
774 | }
|
---|
775 | echo "//-->\n"
|
---|
776 | ."</script>\n"; */
|
---|
777 | // tabella votanti
|
---|
778 | echo "<center>";
|
---|
779 | if ($genere!=0){
|
---|
780 | $sql="SELECT voti_uomini,voti_donne, voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_cons='$id_cons' order by data desc,orario desc limit 0,1";
|
---|
781 | $result = $dbi->prepare("$sql");
|
---|
782 | $result->execute();
|
---|
783 |
|
---|
784 |
|
---|
785 | list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM);
|
---|
786 | echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"
|
---|
787 | ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>"
|
---|
788 | ."<tr><td></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._TOT_ULT."</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_u</td><td align=\"center\" bgcolor=\"$bgcolor2\">$voti_d</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_t</td></tr>";
|
---|
789 | echo "</table>";
|
---|
790 | }
|
---|
791 | echo "<table class=\"table-menu\" style=\"width: 50%; color: black\">";
|
---|
792 | if ($genere==0){
|
---|
793 | $sql="SELECT id_gruppo,si+no,validi,nulli,bianchi,contestati FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
794 | $res = $dbi->prepare("$sql");
|
---|
795 | $res->execute();
|
---|
796 | while (list($id_gruppo,$voti_parz,$validi,$nulli,$bianchi,$contestati) = $res->fetch(PDO::FETCH_NUM)){
|
---|
797 | if ($voti_parz!=$validi){
|
---|
798 | $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo' ";
|
---|
799 | $res2 = $dbi->prepare("$sql");
|
---|
800 | $res2->execute();
|
---|
801 | list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);
|
---|
802 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI_REF." $num_gruppo: ".$voti_parz." "._NO_VAL_VOTI.": ".$validi."</b><br></td></tr>";
|
---|
803 | }
|
---|
804 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
805 | $res2 = $dbi->prepare("$sql");
|
---|
806 | $res2->execute();
|
---|
807 | list($tot) = $res2->fetch(PDO::FETCH_NUM);
|
---|
808 | if (($validi+$nulli+$bianchi+$contestati)!= $tot ){
|
---|
809 | $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo'";
|
---|
810 | $res2 = $dbi->prepare("$sql");
|
---|
811 | $res2->execute();
|
---|
812 | list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);
|
---|
813 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI_REF." $num_gruppo: ".$tot." "._NO_SOMMA." ".($validi+$nulli+$bianchi+$contestati)."</b><br></td></tr>";
|
---|
814 | }
|
---|
815 | }
|
---|
816 | }else{
|
---|
817 | $sql="select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";
|
---|
818 | $result = $dbi->prepare("$sql");
|
---|
819 | $result->execute();
|
---|
820 | list($flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);
|
---|
821 | $dettnulli=$flagsg;
|
---|
822 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
823 | $res = $dbi->prepare("$sql");
|
---|
824 | $res->execute();
|
---|
825 | list($voti_parz) = $res->fetch(PDO::FETCH_NUM);
|
---|
826 | $sql="SELECT validi,nulli,bianchi,contestati,solo_lista,voti_nulli FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
827 | $res = $dbi->prepare("$sql");
|
---|
828 | $res->execute();
|
---|
829 | list($validi,$nulli,$bianchi,$contestati,$solo_lista,$votinulli) = $res->fetch(PDO::FETCH_NUM);
|
---|
830 | if ($voti_parz!=($validi-$solo_lista) and $voti_parz>0){
|
---|
831 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".$voti_parz." "._NO_VAL_VOTI." ".($validi-$solo_lista)."</b><br></td><tr>";
|
---|
832 | }
|
---|
833 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
834 | $res2 = $dbi->prepare("$sql");
|
---|
835 | $res2->execute();
|
---|
836 | list($tot) = $res2->fetch(PDO::FETCH_NUM);
|
---|
837 | if ($validi+$nulli+$bianchi+$contestati+$votinulli!=$tot and $validi+$nulli+$bianchi+$contestati+$votinulli>0){
|
---|
838 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi+$nulli+$bianchi+$contestati+$votinulli)."</b><br></td></tr>";
|
---|
839 | }
|
---|
840 | $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons=$id_cons and id_sez=$id_sez";
|
---|
841 | $resg = $dbi->prepare("$sql");
|
---|
842 | $resg->execute();
|
---|
843 | list($voti_sez)=$resg->fetch(PDO::FETCH_NUM);
|
---|
844 | if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){
|
---|
845 | $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";
|
---|
846 | $resg = $dbi->prepare("$sql");
|
---|
847 | $resg->execute();
|
---|
848 | list($sgpl)=$resg->fetch(PDO::FETCH_NUM);
|
---|
849 | $sql="SELECT solo_gruppo from ".$prefix."_ele_sezioni where id_cons=$id_cons and id_sez=$id_sez";
|
---|
850 | $resg = $dbi->prepare("$sql");
|
---|
851 | $resg->execute();
|
---|
852 | list($sg)=$resg->fetch(PDO::FETCH_NUM);
|
---|
853 | if ($sg != $sgpl) echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></tr>";
|
---|
854 | }
|
---|
855 | #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto
|
---|
856 | if($genere==5 and !$disgiunto and $flagsg and ($tipo_cons==18 or $tipo_cons==19)){
|
---|
857 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo";
|
---|
858 | $resref = $dbi->prepare("$sql");
|
---|
859 | $resref->execute();
|
---|
860 | $errgrulis=array();
|
---|
861 | $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";
|
---|
862 | $res4 = $dbi->prepare("$sql");
|
---|
863 | $res4->execute();
|
---|
864 | list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);
|
---|
865 | if ($sezscrl)
|
---|
866 | while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))
|
---|
867 | {
|
---|
868 | if($disgiunto || $flagsg){
|
---|
869 | $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
870 | $res3 = $dbi->prepare("$sql");
|
---|
871 | $res3->execute();
|
---|
872 | if($flagsg){
|
---|
873 | $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
874 | $res4 = $dbi->prepare("$sql");
|
---|
875 | $res4->execute();
|
---|
876 | }else{
|
---|
877 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
878 | $res4 = $dbi->prepare("$sql");
|
---|
879 | $res4->execute();
|
---|
880 | }
|
---|
881 | }else{
|
---|
882 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
883 | $res3 = $dbi->prepare("$sql");
|
---|
884 | $res3->execute();
|
---|
885 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
886 | $res4 = $dbi->prepare("$sql");
|
---|
887 | $res4->execute();
|
---|
888 | }
|
---|
889 | list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);
|
---|
890 | list($vliste)=$res4->fetch(PDO::FETCH_NUM);
|
---|
891 | if($vliste>$vgruppo and !$disgiunto )
|
---|
892 | {
|
---|
893 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
894 | $result = $dbi->prepare("$sql");
|
---|
895 | $result->execute();
|
---|
896 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
897 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate $vliste<br/> superano i voti assegnati al gruppo $dgruppo $vgruppo</b><br></td></tr>";
|
---|
898 | $errgrulis[$id_gruppo]=1;
|
---|
899 | }
|
---|
900 | elseif($vliste<$vgruppo and !$disgiunto )
|
---|
901 | {
|
---|
902 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
903 | $result = $dbi->prepare("$sql");
|
---|
904 | $result->execute();
|
---|
905 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
906 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr>";
|
---|
907 | $errgrulis[$id_gruppo]=1;
|
---|
908 | }
|
---|
909 | }
|
---|
910 | }
|
---|
911 | }
|
---|
912 | if(!isset($votinulli)) $votinulli=0;
|
---|
913 | echo "<tr><td></td></tr></table>";
|
---|
914 | if ($validi+$nulli+$bianchi+$contestati+$votinulli>0 or $genere==0) {
|
---|
915 | if($genere==0) echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" data-ajax=\"false\" action=\"modules/Elezioni/salva_ref.php\">";
|
---|
916 | else echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" data-ajax=\"false\" action=\"modules/Elezioni/salva_gruppi.php\">";
|
---|
917 | echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppiq\">"
|
---|
918 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
919 | ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
|
---|
920 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
921 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
922 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
|
---|
923 | ."<input type=\"hidden\" name=\"circo\" value=\"$circo\">"
|
---|
924 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"
|
---|
925 | ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">";
|
---|
926 | if ($genere==0){
|
---|
927 | echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
|
---|
928 | ."<td colspan=\"6\"><b>"._GRUPPO."</b></td></tr>";
|
---|
929 | $campitesta= "<tr align=\"center\" bgcolor=\"$bgcolor1\"><td><b>Votanti "._SI."</b></td>"
|
---|
930 | ."<td><b>Votanti "._NO."</b></td>"
|
---|
931 | ."<td><b>"._VALIDI."</b></td>"
|
---|
932 | ."<td><b>"._BIANCHI."</b></td>"
|
---|
933 | ."<td><b>"._CONTESTATI."</b></td>"
|
---|
934 | ."<td><b>"._NULLI."</b></td></tr>";
|
---|
935 |
|
---|
936 | $campiriep="<tr style=\"background-color: $bgcolor1; text-align:center\"><td colspan=\"2\"><b>"._TOTNON."</b></td>"
|
---|
937 | ."<td colspan=\"2\"><b>"._TOTALEVOTI."</b></td>"
|
---|
938 | ."<td colspan=\"2\"><b>"._VOTANTI."</b></td></tr>";
|
---|
939 | }else{
|
---|
940 | echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
|
---|
941 | ."<td width=\"3%\"><b>"._NUM."</b></td>"
|
---|
942 | ."<td width=\"50%\"><b>"._GRUPPO."</b></td>";
|
---|
943 | echo "<td width=\"5%\"><b>"._VOTI."</b></td>";
|
---|
944 | if($dettnulli) echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLO_GRUPPO."</b></td>";
|
---|
945 | echo "</tr>";
|
---|
946 | }
|
---|
947 | $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ";
|
---|
948 | $res = $dbi->prepare("$sql");
|
---|
949 | $res->execute();
|
---|
950 | $max = $res->rowCount();
|
---|
951 | //echo "Massimo:$max - id=$id_cons - circo: $circo";
|
---|
952 | $sql="select * from ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ";
|
---|
953 | $result = $dbi->prepare("$sql");
|
---|
954 | $result->execute();
|
---|
955 | $i=1;
|
---|
956 | $tot_pref=0;
|
---|
957 | $totsg=0;
|
---|
958 | $pro=[];
|
---|
959 | $pro['voti']='';
|
---|
960 | $pro['solo_gruppo']='';
|
---|
961 | while(list($id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo) = $result->fetch(PDO::FETCH_NUM)){
|
---|
962 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
|
---|
963 | ."//-->\n";
|
---|
964 | echo "function controlloref$i() {\n";
|
---|
965 | echo "var a=Number(window.document.sezioni.si$i.value); var b=Number(window.document.sezioni.no$i.value); if(a=='NaN') {a=0} if(b=='NaN') {b=0} var c=a + b; window.document.sezioni.val$i.value=c\n";
|
---|
966 | echo "}\n";
|
---|
967 | echo "</script>\n";
|
---|
968 | if ($num_gruppo != ''){
|
---|
969 | if ($genere==0){
|
---|
970 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
971 | $res = $dbi->prepare("$sql");
|
---|
972 | $res->execute();
|
---|
973 | list($tot) = $res->fetch(PDO::FETCH_NUM);
|
---|
974 | $sql="SELECT * FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
975 | $res = $dbi->prepare("$sql");
|
---|
976 | $res->execute();
|
---|
977 | $numpro=$res->rowCount();
|
---|
978 | $pro= $res->fetch(PDO::FETCH_BOTH);
|
---|
979 | echo "<tr><td colspan=\"6\"> </td></tr>";
|
---|
980 | if ($numpro and ($pro['si']+$pro['no']!=$pro['validi'] or ($pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=$tot and $pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=0))){
|
---|
981 | echo "<tr style=\"background-color: rgb(255, 0, 0); text-align:center\">";
|
---|
982 | }elseif($numpro and ($pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=0))
|
---|
983 | echo "<tr style=\"background-color:#99CC33; text-align:center\">";
|
---|
984 | else
|
---|
985 | echo "<tr style=\"background-color:$bgcolor2; text-align:center\">";
|
---|
986 | # $descr = explode('.',$descr_gruppo, 100);
|
---|
987 | echo "<td colspan=\"6\" align=\"center\"><input type=\"hidden\" name=\"id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo) </b>"
|
---|
988 | ."<b> $descr_gruppo </b></td></tr>";
|
---|
989 | $pro['si']=(isset($pro['si']) and $pro['si']>=0) ? $pro['si']:'';
|
---|
990 | $pro['no']=(isset($pro['no']) and $pro['no']>=0) ? $pro['no']:'';
|
---|
991 | $pro['validi']=(isset($pro['validi']) and $pro['validi']>=0) ? $pro['validi']:'';
|
---|
992 | $pro['bianchi']=(isset($pro['bianchi']) and $pro['bianchi']>=0) ? $pro['bianchi']:'';
|
---|
993 | $pro['contestati']=(isset($pro['contestati']) and $pro['contestati']>=0) ? $pro['contestati']:'';
|
---|
994 | $pro['nulli']=(isset($pro['nulli']) and $pro['nulli']>=0) ? $pro['nulli']:'';
|
---|
995 | $tot_nulli=intval($pro['nulli'])+intval($pro['bianchi'])+intval($pro['contestati']);
|
---|
996 | $tot_voti=intval($pro['validi'])+$tot_nulli;
|
---|
997 | echo $campiriep; # style=\"text-align: center; border: 1px; border-color: black; border-collaps:collaps;\"
|
---|
998 | echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td colspan=\"2\" >$tot_nulli</td>";
|
---|
999 | echo "<td colspan=\"2\">$tot_voti</td>";
|
---|
1000 | echo "<td colspan=\"2\">$tot</td></tr>";
|
---|
1001 | echo $campitesta;
|
---|
1002 | echo "<tr><td align=\"right\" width=\"3%\"><input name=\"si$i\" value=\"".$pro['si']."\" size=\"7\" style=\"text-align:right\" onchange=controlloref$i() onfocus=\"select();\"></td>";
|
---|
1003 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"no$i\" value=\"".$pro['no']."\" size=\"7\" style=\"text-align:right\" onchange=controlloref$i() onfocus=\"select();\"></td>";
|
---|
1004 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"val$i\" value=\"".$pro['validi']."\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\"></td>";
|
---|
1005 | echo "</td><td align=\"right\"><input name=\"bia$i\" value=\"".$pro['bianchi']."\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\"></td>";
|
---|
1006 | echo "</td><td align=\"right\"><input name=\"con$i\" value=\"".$pro['contestati']."\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\"></td>";
|
---|
1007 | echo "</td><td align=\"right\"><input name=\"nul$i\" value=\"".$pro['nulli']."\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\"></td>";
|
---|
1008 | }else{
|
---|
1009 | echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td align=\"center\"><input type=\"hidden\" name=\"num_gruppo$i\" value=\"$num_gruppo\"><b>$num_gruppo</b>"
|
---|
1010 | ."</td><td align=\"left\"><b> $descr_gruppo </b>";
|
---|
1011 | $sql="SELECT * FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
1012 | $res = $dbi->prepare("$sql");
|
---|
1013 | $res->execute();
|
---|
1014 | if($res->rowCount())
|
---|
1015 | $pro= $res->fetch(PDO::FETCH_BOTH);
|
---|
1016 | $errcolor='';
|
---|
1017 | if(isset($errgrulis[$id_gruppo])) {$errcolor="style=\"background-color: rgb(255, 0, 0);\"";}
|
---|
1018 | echo "</td><td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\"></td>";
|
---|
1019 | if($dettnulli) {echo "<td align=\"right\"><input name=\"solog$i\" value=\"".$pro['solo_gruppo']."\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\"></td>"; $totsg+=intval($pro['solo_gruppo']);}
|
---|
1020 | $tot_pref += intval($pro['voti']);
|
---|
1021 | echo "</tr>";
|
---|
1022 | }
|
---|
1023 | $i++;
|
---|
1024 | }
|
---|
1025 | }
|
---|
1026 | if ($genere!=0) {
|
---|
1027 | $sql="SELECT disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";
|
---|
1028 | $res = $dbi->prepare("$sql");
|
---|
1029 | $res->execute();
|
---|
1030 | list($disgiunto)=$res->fetch(PDO::FETCH_NUM);
|
---|
1031 | $sql="SELECT solo_lista FROM ".$prefix."_ele_sezioni where id_sez='$id_sez' ";
|
---|
1032 | $res = $dbi->prepare("$sql");
|
---|
1033 | $res->execute();
|
---|
1034 | if ($tot_pref!=$validi and ($tot_pref>0 and $validi>0)) $segna2="style=\"background-color: #dd0000;\""; else $segna2='';
|
---|
1035 | list($sololis)=$res->fetch(PDO::FETCH_NUM);
|
---|
1036 | echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._TOTPREF."</td><td $segna2>$tot_pref</td>";
|
---|
1037 | if($dettnulli) echo "<td>$totsg</td>";
|
---|
1038 | echo "</tr>";
|
---|
1039 | if($disgiunto)
|
---|
1040 | echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._SOLOLIS."</td><td><input name=\"sololista\" value=\"".$sololis."\" size=\"7\" style=\"text-align:right;\" onfocus=\"select();\"></td></tr>";
|
---|
1041 | }
|
---|
1042 | echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" id=\"update\" value=\" "._OK. "\"></td>";
|
---|
1043 | echo "</tr></table></form></td></tr>";
|
---|
1044 | if(chisei($id_cons_gen)>=64){
|
---|
1045 | echo "<tr><td><input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."";
|
---|
1046 | }
|
---|
1047 | echo "</td></tr></table></center>";
|
---|
1048 | }
|
---|
1049 | if ($genere!=0){
|
---|
1050 | finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
1051 | }
|
---|
1052 | }
|
---|
1053 |
|
---|
1054 |
|
---|
1055 |
|
---|
1056 |
|
---|
1057 | ?>
|
---|