Changeset 407 for trunk/admin/modules/Elezioni/salva_voti.php
- Timestamp:
- Mar 5, 2024, 10:09:23 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/salva_voti.php
r394 r407 43 43 #if(isset($_SESSION['scrutinata'])) $scrutinata=$_SESSION['scrutinata']; #else $scrutinata=false; 44 44 global $prefix,$id_parz,$genere,$fileout,$id_cons; 45 if (!isset($fileout)) $fileout=''; 46 #if(($voti_u+$voti_d) and !$voti_t) $voti_t=$voti_u+$voti_d; 47 if ($fileout) while (!$fp = fopen($fileout,"a")); 48 49 $salvato=0; 50 51 ################## 52 $sql="select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' "; 45 $sql="select solo_gruppo,disgiunto,chiusa from ".$prefix."_ele_cons_comune where id_cons='$id_cons' "; 53 46 $result = $dbi->prepare("$sql"); 54 47 $result->execute(); 55 list($flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM); 56 $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' "; 57 $result = $dbi->prepare("$sql"); 58 $result->execute(); 59 $ar=$result->fetch(PDO::FETCH_BOTH); 60 $validilista=$validi-$ar['solo_gruppo']; 61 $log_data= date("Y/m/d"); 62 $log_ora=getdate(time()); 63 $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']); 48 list($flagsg,$disgiunto,$chiusa)=$result->fetch(PDO::FETCH_NUM); 49 if(!$chiusa){ 50 if (!isset($fileout)) $fileout=''; 51 #if(($voti_u+$voti_d) and !$voti_t) $voti_t=$voti_u+$voti_d; 52 if ($fileout) while (!$fp = fopen($fileout,"a")); 64 53 65 #if($ops==3 and ($genere==3 or $genere==4 or $genere==5) and ($votog or $genere==4)){ 66 $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$aid','$log_data','$orario','validi_lista:$ar[14] nulli:$ar[7] bianchi:$ar[8] ','validi_lista=$validilista, nulli=$nulli,bianchi=$bianchi','_ele_sezioni')"; 67 $res = $dbi->prepare("$sql"); 68 $res->execute(); 69 $sql="update ".$prefix."_ele_sezioni set validi='$validi', contestati='$contestati', nulli='$nulli',bianchi='$bianchi', voti_nulli='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez' "; 70 $res = $dbi->prepare("$sql"); 71 $res->execute(); 72 if ($fileout) fwrite($fp,"$sql;\n"); 73 ###### 74 #include($sql."TEST: scru=$scrutinata"); 75 if(isset($scrutinata)) 76 { 77 $sql="delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and num_gruppo=0"; 78 $res = $dbi->prepare("$sql"); 79 $res->execute(); 80 $sql="delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez' and num_lista=0"; 81 $res = $dbi->prepare("$sql"); 82 $res->execute(); 83 $sql="delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez' and num_cand=0"; 84 $res = $dbi->prepare("$sql"); 85 $res->execute(); 86 if($scrutinata==true) 87 { 88 # provare insert dei soli id_cons e id_sez 89 $sql="insert into ".$prefix."_ele_voti_gruppo (id_cons,id_sez,num_gruppo) values('$id_cons','$id_sez',0)"; 54 $salvato=0; 55 56 ################## 57 58 $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' "; 59 $result = $dbi->prepare("$sql"); 60 $result->execute(); 61 $ar=$result->fetch(PDO::FETCH_BOTH); 62 $validilista=$validi-$ar['solo_gruppo']; 63 $log_data= date("Y/m/d"); 64 $log_ora=getdate(time()); 65 $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']); 66 67 #if($ops==3 and ($genere==3 or $genere==4 or $genere==5) and ($votog or $genere==4)){ 68 $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$aid','$log_data','$orario','validi_lista:$ar[14] nulli:$ar[7] bianchi:$ar[8] ','validi_lista=$validilista, nulli=$nulli,bianchi=$bianchi','_ele_sezioni')"; 90 69 $res = $dbi->prepare("$sql"); 91 $res->execute(); 92 $sql=" insert into ".$prefix."_ele_voti_lista (id_cons,id_sez) values('$id_cons','$id_sez')";70 $res->execute(); 71 $sql="update ".$prefix."_ele_sezioni set validi='$validi', contestati='$contestati', nulli='$nulli',bianchi='$bianchi', voti_nulli='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez' "; 93 72 $res = $dbi->prepare("$sql"); 94 $res->execute(); 95 $sql="insert into ".$prefix."_ele_voti_candidati (id_cons,id_sez,num_cand) values('$id_cons','$id_sez',0)"; 73 $res->execute(); 74 if ($fileout) fwrite($fp,"$sql;\n"); 75 ###### 76 #include($sql."TEST: scru=$scrutinata"); 77 if(isset($scrutinata)) 78 { 79 $sql="delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and num_gruppo=0"; 96 80 $res = $dbi->prepare("$sql"); 97 $res->execute(); 98 # 99 } 100 } 101 /*}else{ 102 $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$aid','','','validi:$ar[6] nulli:$ar[7] bianchi:$ar[8] contestati:$ar[9] voti_nulli:$ar[13]','validi=$validi, nulli=$nulli,bianchi=$bianchi,contestati=$contestati, voti_nulli=$votinulli','_ele_sezioni')"; 103 $res = $dbi->prepare("$sql"); 104 $res->execute(); 105 $sql="update ".$prefix."_ele_sezioni set validi='$validi', nulli='$nulli',bianchi='$bianchi',contestati='$contestati',voti_nulli='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez' "; 106 $res = $dbi->prepare("$sql"); 107 $res->execute(); 108 if ($fileout) fwrite($fp,"$sql;\n"); */ 109 #} 110 include("ele_controlli.php"); 111 controllo_voti($id_cons,$id_sez); 112 include("ele_colora_sez.php"); 113 114 if ($fileout) fclose($fp); 81 $res->execute(); 82 $sql="delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez' and num_lista=0"; 83 $res = $dbi->prepare("$sql"); 84 $res->execute(); 85 $sql="delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez' and num_cand=0"; 86 $res = $dbi->prepare("$sql"); 87 $res->execute(); 88 if($scrutinata==true) 89 { 90 # provare insert dei soli id_cons e id_sez 91 $sql="insert into ".$prefix."_ele_voti_gruppo (id_cons,id_sez,num_gruppo) values('$id_cons','$id_sez',0)"; 92 $res = $dbi->prepare("$sql"); 93 $res->execute(); 94 $sql="insert into ".$prefix."_ele_voti_lista (id_cons,id_sez) values('$id_cons','$id_sez')"; 95 $res = $dbi->prepare("$sql"); 96 $res->execute(); 97 $sql="insert into ".$prefix."_ele_voti_candidati (id_cons,id_sez,num_cand) values('$id_cons','$id_sez',0)"; 98 $res = $dbi->prepare("$sql"); 99 $res->execute(); 100 # 101 } 102 } 103 /*}else{ 104 $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$aid','','','validi:$ar[6] nulli:$ar[7] bianchi:$ar[8] contestati:$ar[9] voti_nulli:$ar[13]','validi=$validi, nulli=$nulli,bianchi=$bianchi,contestati=$contestati, voti_nulli=$votinulli','_ele_sezioni')"; 105 $res = $dbi->prepare("$sql"); 106 $res->execute(); 107 $sql="update ".$prefix."_ele_sezioni set validi='$validi', nulli='$nulli',bianchi='$bianchi',contestati='$contestati',voti_nulli='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez' "; 108 $res = $dbi->prepare("$sql"); 109 $res->execute(); 110 if ($fileout) fwrite($fp,"$sql;\n"); */ 111 #} 112 include("ele_controlli.php"); 113 controllo_voti($id_cons,$id_sez); 114 include("ele_colora_sez.php"); 115 if ($fileout) fclose($fp); 116 } 115 117 $BASE=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-16); 116 118 Header("Location: ".$BASE."admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$id_circ&id_sede=$id_sede&id_sez=$id_sez&do=spoglio&ops=$ops");
Note:
See TracChangeset
for help on using the changeset viewer.