- Timestamp:
- Jun 1, 2014, 10:33:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 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); -
trunk/admin/versione.php
r220 r221 1 1 <?php 2 $versione="2.0 rev 22 0";2 $versione="2.0 rev 221"; 3 3 ?> -
trunk/client/modules/Elezioni/consiglieri.php
r220 r221 210 210 { 211 211 $seggimag[$lisvin]=number_format($numcons*($gruppo[$listagruppo[$lisvin]]*100/$validi)/100); 212 echo "<br> seggimag:".$seggimag[$lisvin];212 ##echo "<br> seggimag:".$seggimag[$lisvin]; 213 213 $num_cons=number_format($numcons-$seggimag[$lisvin]); 214 214 # $num_cons=$numcons; … … 435 435 } 436 436 } 437 ################### 437 ################### carica array ... 25 maggio 2014 438 foreach($collegate as $key=>$val){ 439 $res = mysql_query("SELECT id_gruppo from ".$prefix."_ele_lista where num_lista='$val' and id_cons='$id_cons'",$dbi); 440 list($tempig)=mysql_fetch_row($res); 441 $res = mysql_query("SELECT num_gruppo from ".$prefix."_ele_gruppo where id_gruppo='$tempig' and id_cons='$id_cons'",$dbi); 442 list($tempng)=mysql_fetch_row($res); 443 $grpinc[$val]=$tempng; 444 } 438 445 $elencog=array(); 439 446 $sindseggiopre=array(); 440 447 foreach($groups as $testk=>$valk) if($testk!=$gruppo) {$elencog[$testk]=$valk;} 441 448 $testseggio=calcoloseggi($elencog,floor($numcons*(100-$suppremio)/100),0); 442 foreach($testseggio as $testk=>$valk) if($valk) {$sindseggiopre[]=$testk;}449 foreach($testseggio as $testk=>$valk) {if($valk) $sindseggiopre[]=$testk; } 443 450 #foreach ($gruppomin as $key=>$val) {if (($numcons*60/100)<$val) $nopremio=0;if($key!=$gruppo){echo "<br>gruppomin: $key -- $val";}} 444 451 ################## … … 486 493 $groupsappo=$groups; 487 494 $candidati=array(); 495 $grpperd=$gruppoperd; 488 496 //maggio 2011: a qui viene spostato in modo da aggiungere i voti di lista delle collegate per il perdente solo dopo aver controllato se supera il 50%, in questo modo si evita che il collegamento tra perdenti faccia decadere il premio di maggioranza se solo insieme superano il 50% 489 497 //maggio 2011: da qui … … 502 510 if ($premio) { 503 511 ######### 512 ################### carica array ... 513 /* $elencog=array(); 514 $sindseggiopre=array(); 515 foreach($groups as $testk=>$valk) if($testk!=$grpperd) {$elencog[$testk]=$valk;} 516 $testseggio=calcoloseggi($elencog,ceil($numcons*($suppremio)/100),0); 517 foreach($testseggio as $testk=>$valk) {if($valk) $sindseggio[]=$testk; echo "<br>testkpre: $testk - $valk";} 518 */#foreach ($gruppomin as $key=>$val) {if (($numcons*60/100)<$val) $nopremio=0;if($key!=$gruppo){echo "<br>gruppomin: $key -- $val";}} 519 ################## 504 520 ################### nell'array sindseggio vengono inseriti i candidati sindaco che restano senza seggio per gli apparentamenti 505 521 $elencog=array(); 506 522 $testseggio=array(); 507 523 $sindseggio=array(); 508 foreach($groups as $testk=>$valk) if($testk!=$gruppo) {$elencog[$testk]=$valk;} 509 $testseggio=calcoloseggi($elencog,floor($numcons*(100-$suppremio)/100),0); 510 foreach($sindseggiopre as $testk=>$valk) {if(!$testseggio[$valk]) $sindseggio[$valk]=$valk;} 524 foreach($groups as $testk=>$valk) {if($testk!=$gruppo) $elencog[$testk]=$valk;} 525 $perdente[$gruppoperd]=$groups[$gruppoperd]; 526 $testseggio=calcoloseggi($perdente,floor($numcons*($suppremio)/100),0); 527 # foreach($testseggio as $testk=>$valk) echo "<br>testgruppo: $valk - $testk - $gruppoperd"; 528 foreach($sindseggiopre as $testk=>$valk){ if(!$testseggio[$valk]) $sindseggio[$valk]=$valk;} 511 529 ########### 512 530 $sindaco[$gruppo]=$groups[$gruppo]; $groups[$gruppo]=0; … … 532 550 $percliste[$x]="<br/>$y (".number_format($y*100/$validi,2)."%)"; 533 551 $z++; 534 }552 ## } 535 553 $seggimag=array(); 536 $x=0; 554 $x=0;#foreach($listemag as $kkk=>$vvv) echo "<br> listemag: $kkk - $vvv - $grp - $gruppo -val=$val"; 537 555 #####25 maggio 2014 - il candidato sindaco non eletto ha diritto al seggio anche se di maggioranza 538 556 ### individua ultimi seggi assegnati a liste collegate 539 $listdec =array(); 540 $seggitmp=calcoloseggi($listemag,$val,1); 541 foreach ($seggitmp as $keyl=>$vall){ #echo "<br>sindseggio: $key - $val"; 557 if($grp==$gruppo){ 558 $listdec =array(); 559 $seggitmp=calcoloseggi($listemag,$val,1); ## foreach ($grpinc as $keyl=>$vall) echo "<br> seggi: $keyl - $vall"; 560 foreach ($seggitmp as $keyl=>$vall){#echo "<br> lista: $vall - $keyl - $grp - $gruppo"; 561 if($vall==0) continue; 542 562 # foreach ($sindseggio as $key=>$val){ 543 if (in_array($keyl,$collegate) and ! isset($tempo[$keyl])) $tempo[$keyl]=number_format($quozienti[$keyl][$vall-1],2);544 # echo "<br>lista:$key"; 563 # if (in_array($keyl,$collegate) and ! isset($tempo[$keyl])) $tempo[$keyl]=number_format($quozienti[$keyl][$vall-1],2); 564 545 565 $res = mysql_query("SELECT id_gruppo from ".$prefix."_ele_lista where num_lista='$keyl' and id_cons='$id_cons'",$dbi); 546 566 list($tempig)=mysql_fetch_row($res); 547 567 $res = mysql_query("SELECT num_gruppo from ".$prefix."_ele_gruppo where id_gruppo='$tempig' and id_cons='$id_cons'",$dbi); 548 list($tempng)=mysql_fetch_row($res); 549 if (in_array($tempng,$ sindseggio)) $listdec[]=$keyl;550 } 551 552 /* while(){568 list($tempng)=mysql_fetch_row($res); 569 if (in_array($tempng,$grpinc)) {$listdec[$tempng][]=$keyl;} 570 } 571 } 572 } /* while(){ 553 573 if(isset($tempo[$tempnl])) echo "<br> tempnl: $tempnl -- key:$key".$tempo[$key]; 554 574 } 555 575 */ 556 576 ########## 557 $seggimag=calcoloseggi($listemag,$val,1); 558 559 foreach ($seggimag as $key=>$val){ 560 ## condizione per esclusione di un seggio da destinare al sindaco non eletto 561 if(in_array($key,$listdec)) $val--; 577 #echo "<br> key: $key2 - $val2"; 578 $seggimag=calcoloseggi($listemag,$val,1);#foreach ($grpinc as $keyl=>$vall) 579 580 ####cerca ultimo seggio assegnato per gruppo di liste collegate al primo turno 581 foreach ($seggimag as $key2=>$val2){ if($val2==0) continue; 582 # echo "<br>quozienti - $key2:".$quozienti[$key2][($val2)]; 583 if(!isset($ultquoz[($grpinc[$key2])]) and $grpinc[$key2]) {$ultquoz[($grpinc[$key2])]=$quozienti[$key2][($val2-1)];$lastlist[($grpinc[$key2])]=$key2;} 584 elseif ($ultquoz[($grpinc[$key2])]>$quozienti[$key2][($val2-1)]) {$ultquoz[($grpinc[$key2])]=$quozienti[$key2][($val2-1)];$lastlist[($grpinc[$key2])]=$key2;} 585 # if(in_array($key,$listdec)) $val--; 586 } #foreach($lastlist as $keyl=>$vall) echo "<br> seggi: $keyl - $vall"; 587 ##### 588 foreach ($seggimag as $key2=>$val2){ 589 ## condizione per esclusione di un seggio da destinare al sindaco non eletto in_array($key2,$lastlist) 590 foreach($lastlist as $key3=>$val3){ 591 if($key2==$val3) { 592 $arappo=array_shift($arvin[$key2]); 593 foreach($listdec as $kk=>$vv) {foreach($vv as $vvk=>$vvv) if ($vvv==$key2) $tmpgrp=$kk; } 594 if($tmpgrp){ 595 array_unshift($arvin[$key2],$desgruppi[$tmpgrp]); array_unshift($arvin[$key2],$arappo);array_unshift($cifra[$key2],"--");array_unshift($cifra[$key2],"--"); 596 } 597 }} 598 #$val--; 562 599 ## fine condizione - impostare variabile in db per differenziare il comportamento per consultazioni diverse 563 for ($z=0;$z<$val ;$z++){564 if ($z) $consel[]=array("","","",$arvin[$key ][($z+1)],$cifra[$key][($z+1)],number_format($quozienti[$key][$z],2));600 for ($z=0;$z<$val2;$z++){ 601 if ($z) $consel[]=array("","","",$arvin[$key2][($z+1)],$cifra[$key2][($z+1)],number_format($quozienti[$key2][$z],2)); 565 602 else 566 603 { 567 $consel[]=array($arvin[$key ][0],$percliste[$key],$val,$arvin[$key][($z+1)],$cifra[$key][($z+1)],number_format($quozienti[$key][$z],2));568 $arlisdesv[]=$arvin[$key ][0];$arlissegv[]=$val;$arlisnumv[]=$key;604 $consel[]=array($arvin[$key2][0],$percliste[$key2],$val2,$arvin[$key2][($z+1)],$cifra[$key2][($z+1)],number_format($quozienti[$key2][$z],2)); 605 $arlisdesv[]=$arvin[$key2][0];$arlissegv[]=$val2;$arlisnumv[]=$key2; 569 606 } 570 607 } 571 608 $x++; 572 if($val )573 $consel[]=array($arvin[$key ][0],"$PNE","",$arvin[$key][($z+1)],$cifra[$key][($z+1)],number_format($quozienti[$key][$z],2));609 if($val2) 610 $consel[]=array($arvin[$key2][0],"$PNE","",$arvin[$key2][($z+1)],$cifra[$key2][($z+1)],number_format($quozienti[$key2][$z],2)); 574 611 } 575 612 } … … 724 761 } 725 762 } 726 #### condizione di aggiunta candidato sindaco non eletto in elenco consiglieri727 foreach($sindseggio as $key=>$val) if ($consin) {$conselsin[]=array("$CSEC",$desgruppi[$key]); $arcansin[]=$desgruppi[$key];}728 ####729 730 763 731 764 if (isset($conselsin)) foreach($conselsin as $key=>$val) -
trunk/client/versione.php
r220 r221 1 1 <?php 2 $versione="2.0 rev 22 0";2 $versione="2.0 rev 221"; 3 3 ?> -
trunk/install/sql/eleonline.sql
r211 r221 107 107 -- Table structure for table `soraldo_doc_cons` 108 108 -- 109 110 DROP TABLE IF EXISTS `soraldo_ele_controllosez`; 111 create table soraldo_ele_controllosez ( 112 id_sez int(11), 113 id_cons int(11), 114 stato_aff int(1), 115 stato_val int(1), 116 stato_gru int(1), 117 stato_lis int(1), 118 stato_can int(1), 119 primary key (id_sez) 120 ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 121 122 109 123 110 124 DROP TABLE IF EXISTS `soraldo_doc_cons`;
Note:
See TracChangeset
for help on using the changeset viewer.