Changeset 66 for trunk/client/modules/Elezioni
- Timestamp:
- Mar 31, 2010, 1:47:45 PM (15 years ago)
- Location:
- trunk/client/modules/Elezioni
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/funzioni.php
r65 r66 422 422 $temp2tot+=$valperc; 423 423 } 424 if($temp2tot>100) 424 425 while ($temp2tot>100){ 425 426 foreach ($temp2 as $key => $val) { 426 if ($val == max($temp2)) {$temp3[$key]-=0.01;$temp2tot-=0.01;$temp2[$key]=0; break;}427 if ($val == max($temp2)) {$temp3[$key]-=0.01;$temp2tot-=0.01;$temp2[$key]=0; break;} 427 428 } 428 429 } 429 while ($temp2tot<100){ 430 if("$temp2tot"=="100") return($temp3); 431 while ($temp2tot<100.00){ 430 432 foreach ($temp2 as $key => $val) { 431 433 if ($val == min($temp2)) {$temp3[$key]+=0.01;$temp2tot+=0.01;$temp2[$key]=1;break;} -
trunk/client/modules/Elezioni/gruppo.php
r65 r66 416 416 $secontot=0; 417 417 $sevnutot=0; 418 $valar=array();$percar=array(); 418 419 //////////////////////////////////////////////////////////////////// 419 420 // sandro: carica i numeri di sezione dal DB - giugno 2009 … … 426 427 $ar[$z][0]=$res[0]; 427 428 $pos[$z]=$res[0]; 429 #$valar[$z]=array(); 428 430 } 429 431 if (!isset($pos)) $pos[0]=0; … … 458 460 $onetime=""; 459 461 if ($res_voti) 462 { 463 if ($perc=='true'){ 464 while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)) 465 if ($num_cand>=$min and $num_cand<=$offset){ 466 $z=array_search($num_circ, $pos); 467 if($num_circ>=$minpos and $num_circ <=$maxpos){ 468 $valar[($z)][$num_cand]=$voti; 469 } 470 foreach ($valar as $key=>$val){ 471 $percar[$key]=arrayperc($val,$votitot[($key)]); 472 foreach($percar as $key2=>$val2); 473 } 474 } 475 mysql_data_seek($res_voti,0); 476 } 460 477 while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)){ 461 478 if ($num_cand>=$min and $num_cand<=$offset){ … … 467 484 if ($perc=='true' and $votitot[($z)]) 468 485 { 469 $percento=$voti."<br /><span class=\"red\"><i>".number_format($ voti*100/$votitot[($z)],2)." %</i></span>";486 $percento=$voti."<br /><span class=\"red\"><i>".number_format($percar[$z][$num_cand],2)." %</i></span>"; 470 487 } 471 488 $ar[($z)][$num_cand]=$percento; … … 492 509 } 493 510 } 511 } 494 512 if (($offsetsez+1)>=$num_sez){ 495 513 $ar[(2+$offsetsez-$minsez)][0]="<b>"._TOT."<br />"._COMPLESSIVO."</b>"; 496 514 if(isset($temp)) { 497 ######################498 515 if($tab15=="gruppo"){ 499 516 $votigl=" sum(validi),sum(nulli),sum(bianchi),sum(contestati),sum(voti_nulli)"; 500 517 }else{ 501 /* if ($votog) $votigl=" (validi_lista),(nulli),(bianchi),(contestati_lista),(voti_nulli_lista)";502 else */503 518 $votigl=" sum(validi_lista),sum(nulli),sum(bianchi),sum(contestati_lista),sum(voti_nulli_lista)"; 504 519 } … … 510 525 $temp3=arrayperc($temp,$sevaltot); 511 526 while (list($key,$voti)= each($temp)) { 512 $percento="<b>$voti</b>";513 527 if ($perc=='true' and $voticompl) 514 528 { 515 # $valperc2=round($valperc,2);516 529 $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$key]." %</i></span></b>"; 517 } 530 } else 531 $percento="<b>$voti</b>"; 518 532 $ar[2+$offsetsez-$minsez][$key]=$percento; 519 533 } … … 523 537 $tmp=array($sevaltot,$senultot,$sebiatot,$secontot,$sevnutot); 524 538 $temp3=arrayperc($tmp,$voticompl); 525 #foreach($temp3 as $key=>$val) echo "$key: $val<br>";526 539 while(list($k,$voti)= each($tmp)) { 527 540 528 541 if ($perc=='true' and $voticompl) 529 542 { 530 $valperc=number_format($voti*100/$voticompl,3);531 $valperc=number_format($valperc,2);532 543 $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$k]." %</i></span></b>"; 533 544 } else $percento="<b>$voti</b>";
Note:
See TracChangeset
for help on using the changeset viewer.