Changeset 221 for trunk/admin/modules
- Timestamp:
- Jun 1, 2014, 10:33:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_voti.php
r218 r221 165 165 list($votil) = mysql_fetch_row($res3); 166 166 if($votil) { 167 168 $query="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'"; 167 $query="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'"; 169 168 $res4 = mysql_query("$query", $dbi); 170 169 list($votils)=mysql_fetch_row($res4); 171 if($votils>0) { 172 $query="SELECT id_lista FROM ".$prefix."_ele_lista where id_cons='$id_cons'"; 170 # if($votils>0) { 171 if(mysql_num_rows($res4)>0) { 172 $query="SELECT stato_aff, stato_val,stato_gru,stato_lis,stato_can FROM ".$prefix."_ele_controllosez where id_sez='$id_sez' and id_cons='$id_cons'"; 173 173 $res3 = mysql_query("$query", $dbi); 174 $testcand=0; 175 $tutte=1; 176 while(list($testlista)=mysql_fetch_row($res3)){ 177 $res4= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez' and id_lista='$testlista'", $dbi); 178 if($res4) list($testvotil)=mysql_fetch_row($res4); else $testvotil=0; 179 $res4= mysql_query("SELECT 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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 180 if($res4) list($testvotic)=mysql_fetch_row($res4); else $testvotic=0; 174 $res4= mysql_query("SELECT count(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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 175 list($contains)=mysql_fetch_row($res4); 176 if($contains==0) $tutte=1; else $tutte=0; 177 if(mysql_num_rows($res3)){ 178 list($aff,$val,$gru,$lis,$can)=mysql_fetch_row($res3); 179 }else{ 180 $query="SELECT id_lista FROM ".$prefix."_ele_lista where id_cons='$id_cons'"; 181 $res3 = mysql_query("$query", $dbi); 182 $testcand=0; 183 181 184 $res4= mysql_query("SELECT preferenze FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons'", $dbi); 182 185 if($res4) list($testpref)=mysql_fetch_row($res4); else $testpref=0; 183 $res4= mysql_query("SELECT count(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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 184 list($contains)=mysql_fetch_row($res4); 185 if($contains==0) $tutte=0; 186 187 if(($testvotil*$testpref)<$testvotic) { $testcand=1;break;} 188 $res4= mysql_query("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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 189 while(list($testvotic)=mysql_fetch_row($res4)) 190 if($testvotil<$testvotic) { $testcand=1;break;} 186 while(list($testlista)=mysql_fetch_row($res3)){ 187 $res4= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez' and id_lista='$testlista'", $dbi); 188 if($res4) list($testvotil)=mysql_fetch_row($res4); else $testvotil=0; 189 $res4= mysql_query("SELECT 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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 190 if($res4) list($testvotic)=mysql_fetch_row($res4); else $testvotic=0; 191 192 if(($testvotil*$testpref)<$testvotic) { $testcand=1;break;} 193 $res4= mysql_query("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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 194 while(list($testvotic)=mysql_fetch_row($res4)) 195 if($testvotil<$testvotic) { $testcand=1;break;} 196 } 191 197 } 198 if(!isset($can)){ 199 $can=($testcand==0) ? 1:-1; 200 if($genere==4 or $votog) $contestatilista=0; 201 $val=(($votils+$sologruppo+$contestatilista+$votinullilista)==($validi+$sololista))?1:-1; 202 $lis=($validilista==$votils) ? 1:-1; 203 $res4=mysql_query("insert into ".$prefix."_ele_controllosez values('$id_sez','$id_cons','0','$val','0','$lis','$can')",$dbi); 204 } 205 # $res4= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$testlista' and id_cons='$id_cons' ", $dbi); 206 # $res4= mysql_query("SELECT 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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 192 207 if($genere==4 or $votog) $contestatilista=0; 193 if (($votils+$sologruppo+$contestatilista+$votinullilista)==($validi+$sololista) and $validilista==$votils and $testcand==0) 208 # if (($votils+$sologruppo+$contestatilista+$votinullilista)==($validi+$sololista) and $validilista==$votils and $testcand==0) 209 if ($val==1 and $lis==1 and $can==1) 194 210 {$status=$tutte;$ops=-3;} 195 211 else {return 3;} 196 212 } #else return 0; 197 213 }elseif($genere==5 and $fascia<=$limite){ 198 $testcand=0;214 /* $testcand=0; 199 215 $query="SELECT id_lista,id_gruppo FROM ".$prefix."_ele_lista where id_cons='$id_cons'"; 200 216 $res3 = mysql_query("$query", $dbi); … … 214 230 while( list($testvotic)=mysql_fetch_row($res4)) 215 231 if(($testvotit)<$testvotic) {$testcand=1;break;} 216 } 232 }*/ 217 233 if($testcand==0) 218 234 {$status=$tutte;$ops=-3;} … … 823 839 } 824 840 if ((($genere==3) OR ($genere==5)) and !$id_lista and !$votog and ($fascia>$limite or !$id_conf)) $y = (count($arg)-4); 825 else $y=count($arg); 841 else $y=count($arg);#die ("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'"); 842 mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); 826 843 if($do==1) { 827 844 mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); … … 1037 1054 $data=date("Y/m/d"); 1038 1055 $tempo=date("H:i:s"); 1056 mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); 1039 1057 $query="select * from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez='$id_sez'"; 1040 1058 if ($genere==0){ … … 1167 1185 $log_ora=getdate(time()); 1168 1186 $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']); 1187 mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); 1169 1188 1170 1189 $result= mysql_query("select voti_complessivi from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' order by id_parz desc", $dbi); … … 1392 1411 $do = intval($arg[5]); 1393 1412 $y=count($arg)-1; 1413 mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); 1394 1414 if($do==1) { 1395 1415 mysql_query("delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
Note:
See TracChangeset
for help on using the changeset viewer.