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