Changeset 189


Ignore:
Timestamp:
Mar 2, 2014, 4:49:30 PM (10 years ago)
Author:
roby
Message:
  • modificato il db per gestire la modifica di fascia del comune per le elezioni comunali e per la rilevazione delle affluenze con distinzione per maschi e femmine.
Location:
trunk
Files:
1 added
4 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/modules/Elezioni/ele_associazioni.php

    r187 r189  
    3939if (isset($_GET['chiusa'])) $chiusa=intval($_GET['chiusa']); else $chiusa='';
    4040if (isset($_GET['id_conf'])) $id_conf=intval($_GET['id_conf']);  else $id_conf=0;
     41if (isset($_GET['idfascia'])) $idfascia=intval($_GET['idfascia']);  else $idfascia=0;
    4142if (isset($_GET['min'])) $min=intval($_GET['min']); else $min=0;
    4243if (isset($_GET['help'])) $help=intval($_GET['help']);
    4344if (isset($_GET['pwd4'])) $pwd4=intval($_GET['pwd4']);
    4445if (isset($_GET['preferenze'])) $preferenze=intval($_GET['preferenze']); else $preferenze=1;
     46if (isset($_GET['vismf'])) $vismf=intval($_GET['vismf']); else $vismf=0;
    4547
    4648$offset=15;
     
    5355        //
    5456        function all() {
    55         global $user, $admin, $bgcolor1, $bgcolor2, $prefix,$descr_cons, $dbi,$id_cons,$desc,$indirizzo,$centralino,$fax,$id_cons_gen,$id_collegio,$idcomune,$chiusa,$id_conf,$tipo_cons,$language,$help,$preferenze;
     57        global $user, $admin, $bgcolor1, $bgcolor2, $prefix,$descr_cons, $dbi,$id_cons,$desc,$indirizzo,$centralino,$fax,$id_cons_gen,$id_collegio,$idcomune,$chiusa,$id_conf,$tipo_cons,$language,$help,$preferenze,$idfascia,$vismf;
    5658$aid=$_SESSION['aid'];
    5759$dbi=$_SESSION['dbi'];
     
    9496        echo "<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";
    9597        echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>";
    96         echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td><td bgcolor=\"$bgcolor1\">";
    97         if($tipo_cons==3)
    98                 echo "<b>"._CONF."</b>";
     98        echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>";
     99        if($tipo_cons==3){
     100                echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>";
     101                echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FASCIA."</b></td>";
     102                }
     103        echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VISAFFMF."</b></td>";
     104#       echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?op=associazioni&amp;id_cons_gen=\">";
     105        echo "</tr>";
     106        echo "<tr align=\"center\"><td>";
    99107        echo "<input type=\"hidden\" name=\"op\" value=\"associazioni\">";
    100 #       echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?op=associazioni&amp;id_cons_gen=\">";
    101         echo "</td></tr>";
    102         echo "<tr align=\"center\"><td>";
    103108        echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">$descr_cons</td>";
    104109#       $ressede = mysql_query("SELECT id_collegio, descrizione from ".$prefix."_ele_collegi where id_cons_gen='$id_cons_gen' order by descrizione desc", $dbi);
     
    144149        echo "</select></td>";
    145150        if($tipo_cons==3){
     151                if($idcomune) {
     152                        $rescomu = mysql_query("SELECT id_fascia from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomune'", $dbi);
     153                        if($rescomu)
     154                                list($fasciacom)=mysql_fetch_row($rescomu);
     155                } else $fasciacom=0;
    146156                $rescomu = mysql_query("SELECT id_conf, descrizione from ".$prefix."_ele_conf order by descrizione asc", $dbi);
    147                 echo "<td><select name=\"id_conf\">";
     157                echo "<td><select name=\"id_conf\" id=\"id_conf\" onchange=\"javascript:showdate('modules/Elezioni/ele_desc_fasce.php?fascia=$fasciacom&id_conf=' + model.id_conf.options[model.id_conf.selectedIndex].value,'fasceconf');\">";
    148158                echo "<option value=\"0\"> ";
    149159                while(list($id,$descr_conf)=mysql_fetch_row($rescomu)){
     
    153163                }
    154164                echo "</select></td>";
     165                if(!$id_conf) $id_conf=1;
     166                $rescomu = mysql_query("SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'", $dbi);
     167               
     168                echo "<td id=\"fasceconf\"><select name=\"idfascia\">";
     169                echo "<option value=\"0\"> ";
     170                $inffascia=0;
     171                while(list($id,$abitanti)=mysql_fetch_row($rescomu)){
     172                        $sel='';
     173                        if ($idcomune and $id == $fasciacom) $sel="selected"; elseif ($id==1) $sel="selected";
     174                        echo "<option value=\"$id\" $sel>$inffascia - $abitanti";
     175                        $inffascia=$abitanti;
     176                }
     177                echo "</select></td>";
     178               
     179               
    155180        }
    156181        unset($sel);
     182        $rescomu = mysql_query("SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'", $dbi);
     183        list($vismf)=mysql_fetch_row($rescomu);
     184        echo "<td><select name=\"vismf\">";
     185        if ($vismf==0) $sel="selected"; else $sel="";
     186        echo "<option value=\"0\" $sel>No";
     187        if ($vismf==1) $sel="selected"; else $sel="";
     188        echo "<option value=\"1\" $sel>Si";
     189        echo "</select></td>";
     190
    157191        echo "<td><input type=\"hidden\" name=\"ok\" value=0>";
    158192        echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
     
    172206############
    173207        echo "<hr><br><table width=\"100%\" border=\"3\">";
    174         echo "<tr align=\"center\"><td width=\"25%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>";
     208        echo "<tr align=\"center\"><td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>";
    175209#       echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>";
    176         echo "<td width=\"25%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";
     210        echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";
    177211        echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>";
    178212        echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>";
    179         if($tipo_cons==3)
    180                 echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>";
     213        if($tipo_cons==3){
     214                echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>";
     215                echo "<td width=\"20%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FASCIA."</b></td>";
     216                }
     217        echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VISAFFMF."</b></td>";
    181218        echo "<td width=\"10\" bgcolor=\"$bgcolor1\"><b>&nbsp;"._FUNZIONI."</td></tr>";
    182219###############
     
    185222#       $resmod = mysql_query("SELECT t1.id_collegio,t1.id_comune,t2.descrizione as descr,t1.id_cons, t3.descrizione, t4.chiusa,t4.id_conf FROM ".$prefix."_ele_comu_collegi as t1, ".$prefix."_ele_collegi as t2, ".$prefix."_ele_comuni as t3, ".$prefix."_ele_cons_comune as t4 where t1.id_cons_gen='$id_cons_gen' and t1.id_collegio=t2.id_collegio and t1.id_comune=t3.id_comune and t1.id_comune=t4.id_comune and t2.id_cons_gen=t4.id_cons_gen order by t2.descrizione, t3.descrizione", $dbi);
    186223#       else
    187         $resmod = mysql_query("SELECT '',t1.id_comune,'',t1.id_cons, t2.descrizione, t1.chiusa, t1.id_conf, preferenze FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons_gen='$id_cons_gen' and t1.id_comune=t2.id_comune order by t2.descrizione", $dbi);
    188         while (list($id_collegio,$id_comune2,$descr_coll,$id_cons_comu,$descr_comu, $chiusa,$id_conf,$preferenze2) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti
     224        $resmod = mysql_query("SELECT '',t1.id_comune,'',t1.id_cons, t2.descrizione, t1.chiusa, t1.id_conf, preferenze,t1.id_fascia,t1.vismf FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons_gen='$id_cons_gen' and t1.id_comune=t2.id_comune order by t2.descrizione", $dbi);
     225        while (list($id_collegio,$id_comune2,$descr_coll,$id_cons_comu,$descr_comu, $chiusa,$id_conf,$preferenze2,$fasciacom,$vismf) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti
    189226                $resconf = mysql_query("SELECT descrizione FROM ".$prefix."_ele_conf where id_conf='$id_conf'", $dbi);
    190227                list($descr_conf) = mysql_fetch_row($resconf);
    191228                $i++;
    192229                $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
    193                 echo "<tr><td colspan=\"6\">";
     230                if($tipo_cons==3) echo "<tr><td colspan=\"8\">"; else echo "<tr><td colspan=\"6\">";
    194231                echo "<form name=\"modello$i\" action=\"admin.php\">"
    195232                        ."<input type=\"hidden\" name=\"op\" value=\"associazioni\">";
     
    203240                echo "<input type=\"hidden\" name=\"chiusa\" value=\"$chiusa\">";
    204241                echo "<table width=\"100%\"><tr align=\"center\" bgcolor=\"$bgcolor1\">";
    205                 echo "<td width=\"27%\"><b>$descr_cons</b></td>";
    206                 echo "<td width=\"27%\"><b>$descr_comu</b></td>";
    207                 echo "<td width=\"12%\"><b>$preferenze2</b></td>";
     242                echo "<td width=\"15%\"><b>$descr_cons</b></td>";
     243                echo "<td width=\"20%\"><b>$descr_comu</b></td>";
     244                echo "<td width=\"10%\"><b>$preferenze2</b></td>";
    208245                $stato['0']=_ATTIVA;
    209246                $stato['1']=_CHIUSA;
    210247                $stato['2']=_NULLA;
    211                 echo "<td  width=\"11%\"><b>".$stato[$chiusa]."</b></td>";
    212                 if($tipo_cons==3)
    213                         echo "<td  width=\"25%\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>";
     248                echo "<td  width=\"10%\"><b>".$stato[$chiusa]."</b></td>";
     249                if($tipo_cons==3){
     250                        echo "<td width=\"20%\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>";
     251                        $rescomu = mysql_query("SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'", $dbi);
     252                        $inffascia=0;
     253                        while(list($id,$abitanti)=mysql_fetch_row($rescomu)){
     254                                $sel='';
     255                                if ($id == $fasciacom)
     256                                        echo "<td width=\"20%\">$inffascia - $abitanti</td>";
     257                                $inffascia=$abitanti;
     258                        }
     259
     260                }
     261                if ($vismf==0) $sel=_NO; else $sel=_SI;
     262                echo "<td width=\"10%\">$sel</td>";
    214263                echo "<td width=\"10\"><input type=\"hidden\" name=\"ok\" value=0><input type=\"submit\" name=\"edit$i\" value=\""._EDIT."\">"
    215264                        ."</td></tr></table></form></td></tr>\n";
     
    222271
    223272function associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$id_comune,$chiusa,$id_conf,$preferenze) {
    224         global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons,$genere,$id_cons_gen,$idcomunenew,$pwd4;
     273        global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons,$genere,$id_cons_gen,$idcomunenew,$pwd4,$idfascia,$vismf;
    225274        $delcons=0;
    226275        if ($do !="" and $id_cons_gen>0 and $idcomunenew>0) {
     
    229278                        list($delcons)=mysql_fetch_row($rescomu);
    230279                        if (!$max){                     //se no la inserisce
    231                         $result = mysql_query("insert into ".$prefix."_ele_cons_comune (chiusa,id_comune,id_cons_gen,id_conf,preferenze) values ('0','$idcomunenew','$id_cons_gen','$id_conf','$preferenze')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
     280                        $result = mysql_query("insert into ".$prefix."_ele_cons_comune (chiusa,id_comune,id_cons_gen,id_conf,preferenze,id_fascia,vismf) values ('0','$idcomunenew','$id_cons_gen','$id_conf','$preferenze','$idfascia','$vismf')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
    232281                        $rescomu = mysql_query("SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'", $dbi);
    233282                list($id_cons_comu)=mysql_fetch_row($rescomu);
     
    243292                        $result = mysql_query("update ".$prefix."_ele_comu_collegi set id_collegio= '$id_collegio' $newid where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi) || die(mysql_error());
    244293                        if (!$result) return;
    245                         $result = mysql_query("update ".$prefix."_ele_cons_comune set id_conf='$id_conf', chiusa= '$chiusa', preferenze='$preferenze' where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi)|| die(mysql_error());
     294                        $result = mysql_query("update ".$prefix."_ele_cons_comune set id_conf='$id_conf', chiusa= '$chiusa', preferenze='$preferenze',id_fascia='$idfascia',vismf='$vismf' where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi)|| die(mysql_error());
    246295                        Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen");
    247296                }elseif ($do == "add") {
  • trunk/admin/modules/Elezioni/ele_comuni.php

    r184 r189  
    5656function all() {
    5757        global $bgcolor1, $bgcolor2, $prefix, $dbi,$id_cons,$desc,$indirizzo,$centralino,$fax,$email,$fasciatmp,$prov,$id_comune2,$id_cons_gen,$cerca;
    58  
     58 if( !isset($id_conf) ) $id_conf=1;
    5959        echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
    6060        echo "function controllo_id() {\n";
     
    9696        echo "<tr><td bgcolor=\"$bgcolor1\"><b>"._FASCIA."</b></td><td><select name=\"fascia\">";
    9797        $descr2="<";
    98                         $resopt1 = mysql_query("select id_fascia, abitanti from ".$prefix."_ele_fasce where data_fine='0000-00-00' order by id_fascia", $dbi);
     98                        $resopt1 = mysql_query("select id_fascia, abitanti from ".$prefix."_ele_fasce where id_conf=1 order by id_fascia", $dbi);
    9999                while(list($id,$descr)=mysql_fetch_row($resopt1)){
    100100                        $selid= ($id == $fasciatmp) ? "selected":"";
     
    149149                echo "<td><b>$fax</b></td>";
    150150                echo "<td><b>".substr($email,0,15)."...</b></td>";
    151                 $resopt1 = mysql_query("select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciatmp and data_fine='0000-00-00'", $dbi);
     151                $resopt1 = mysql_query("select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciatmp and id_conf=$id_conf", $dbi);
    152152                list($tmpfascia)=mysql_fetch_row($resopt1);
    153153                $fasciaref=$fasciatmp-1;
    154                 $resopt1 = mysql_query("select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciaref and data_fine='0000-00-00'", $dbi);
     154                $resopt1 = mysql_query("select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciaref and id_conf=$id_conf", $dbi);
    155155                if(mysql_num_rows($resopt1)==0) $valfascia="< $tmpfascia";
    156156                else
  • trunk/admin/modules/Elezioni/ele_voti.php

    r185 r189  
    801801function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){
    802802//function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){
    803  global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen,$vismf;
     803 global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen;
    804804$bgcolor1=$_SESSION['bgcolor2'];
    805805OpenTable();
     806$res = mysql_query("SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'", $dbi);
     807if($res) list($vismf)= mysql_fetch_row($res); else $vismf=0;
    806808$res = mysql_query("SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario ", $dbi);
    807809$num = mysql_num_rows($res);
     
    810812$y=0;
    811813echo "<tr><td>&nbsp;</td></tr>";
    812 if(!isset($vismf)) $vismf=0;
    813814while (list($ora,$giorno)= mysql_fetch_row($res)){
    814815        $y++;
  • trunk/admin/modules/Elezioni/funzionidata.php

    r188 r189  
    109109
    110110?>
     111
     112<script type="text/javascript" language="JavaScript" >
     113function showdate(str,posiz,tempo)
     114{
     115if (str=="")
     116  {
     117  document.getElementById(posiz).innerHTML="";
     118  return;
     119  }
     120if (window.XMLHttpRequest)
     121  {// code for IE7+, Firefox, Chrome, Opera, Safari
     122  xmlhttp=new XMLHttpRequest();
     123  }
     124else
     125  {// code for IE6, IE5
     126  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     127  }
     128xmlhttp.onreadystatechange=function()
     129  {
     130  if (xmlhttp.readyState==4 && xmlhttp.status==200 && posiz!=null)
     131    {
     132    document.getElementById(posiz).innerHTML=xmlhttp.responseText;
     133    }
     134  }
     135xmlhttp.open("GET",str,true);
     136xmlhttp.send();
     137
     138}
     139</script>
     140<?php
     141#########################################
     142
     143?>
  • trunk/admin/modules/Elezioni/language/it/ele_associazioni.html

    r86 r189  
    1313caso di consultazioni per l'elezione del consiglio comunale e' possibile
    1414assegnare una tra le modalita' di calcolo predefinite per
    15 l'assegnazione dei seggi di consiglio secondo il metodo D'Hondt.
     15l'assegnazione dei seggi di consiglio secondo il metodo D'Hondt. Con "Affluenze per genere" si stabilisce se le rilevazioni delle affluenze dovranno essere sempre distinte per maschi e femmine o (impostandolo a "No") la distinzione deve essere limitata all'ultima rilevazione.
    1616Cliccando sul corrispondente pulsante "Edita", a destra nella linea del comune su cui si vuole intervenire, e' possibile <b>modificare lo stato</b> della consultazione in "Attiva", "Chiusa" o "Nulla" oppure si puo' <b>ELIMINARE</b> la consultazione relativa al singolo comune (click su "Edita" e poi spunta su "Elimina", appare una seconda checkbox che va spuntata se si vuole eliminare completamente la consultazione, se non viene spuntata si cancellano solo i dati dello spoglio, cioe' affluenze e voti, quindi impostare la combo di "Stato" su "Elimina"). Rimane inalterata l'impostazione generale della consultazione (tipologia, date e orari di rilevazione delle affluenze) e non viene modificato alcun dato relativo ad altri comuni.   
    1717
  • trunk/admin/modules/Elezioni/language/lang-en.php

    r139 r189  
    127127define("_CIRCS","Constituencies");
    128128}
     129define("_VISAFFMF","Gender votes");
    129130define("_DISGIUNTO","One ballot for two separate votes?");
    130131define("_RIEPILOGO","Totals");
  • trunk/admin/modules/Elezioni/language/lang-it.php

    r139 r189  
    148148define("_CIRCS","Circoscrizioni");
    149149}
     150define("_VISAFFMF","Affluenze per genere");
    150151define("_DISGIUNTO","Unica scheda con voti indipendenti?");
    151152define("_RIEPILOGO","Scheda di riepilogo");
  • trunk/admin/versione.php

    r188 r189  
    11<?php
    2 $versione="2.0 rev 188";
     2$versione="2.0 rev 189";
    33?>
  • trunk/client/modules/Elezioni/consiglieri.php

    r147 r189  
    4646        $x++;
    4747}
    48 $res = mysql_query("SELECT t1.tipo_cons,t2.id_cons,t1.data_fine FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi);
     48$res = mysql_query("SELECT t1.tipo_cons,t2.id_cons,t2.id_fascia,t2.id_conf FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi);
    4949if (mysql_num_rows($res)){
    50         list($tipo_cons,$id_cons,$datacons) = mysql_fetch_row($res);
    51         $result = mysql_query("select fascia, capoluogo from ".$prefix."_ele_comuni where id_comune='$id_comune'", $dbi);
    52         list($fascia,$capoluogo) = mysql_fetch_row($result);
    53 
    54                 $result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia='$fascia' and (data_inizio<'$datacons' and data_fine>'$datacons')",$dbi);
    55                 if (mysql_num_rows($result)==0)
    56                         $result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia='$fascia' and data_fine='0000-00-00'",$dbi);
     50        list($tipo_cons,$id_cons,$fascia,$conf) = mysql_fetch_row($res);
     51        $result = mysql_query("select capoluogo from ".$prefix."_ele_comuni where id_comune='$id_comune'", $dbi);
     52        list($capoluogo) = mysql_fetch_row($result);
     53        if($fascia<6 and $capoluogo) {
     54        $resfascia = mysql_query("SELECT fascia_capoluogo from ".$prefix."_ele_conf where id_conf=$conf", $dbi);
     55        list ($fascia)= mysql_fetch_row($resfascia);
     56        }
     57
     58                $result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia='$fascia' and id_conf=$conf",$dbi);
    5759                list($numcons) = mysql_fetch_row($result);
    5860
     
    8183                        $numgruppo=$num_gruppo1;
    8284        }
    83         if($fascia<6 and $capoluogo) $fascia=6;
     85
    8486        if ($fascia<=$limite and $numgruppo) consmin($fascia,$numgruppo);
    8587        elseif ($gruppo>0) conssup($fascia,$gruppo,$collegate,$collperd,$primoturno);
  • trunk/install/sql/eleonline.sql

    r185 r189  
    289289DROP TABLE IF EXISTS `soraldo_ele_conf`;
    290290CREATE TABLE `soraldo_ele_conf` (
    291   `id_conf` int(11) NOT NULL auto_increment,
     291  `id_conf` int(11) NOT NULL AUTO_INCREMENT,
    292292  `descrizione` varchar(50) NOT NULL,
    293293  `limite` int(2) NOT NULL,
    294   `consin` enum('0','1') NOT NULL default '1',
     294  `consin` enum('0','1') NOT NULL DEFAULT '1',
    295295  `infpremio` int(3) NOT NULL,
    296296  `supsbarramento` int(3) NOT NULL,
    297297  `suppremio` int(3) NOT NULL,
    298   `listinfsbar` int(3) NOT NULL default '1',
    299   `listinfconta` enum('0','1') NOT NULL default '1',
    300   `listsupconta` enum('0','1') NOT NULL default '1',
     298  `listinfsbar` int(3) NOT NULL DEFAULT '1',
     299  `listinfconta` enum('0','1') NOT NULL DEFAULT '1',
     300  `listsupconta` enum('0','1') NOT NULL DEFAULT '1',
    301301  `supminpremio` int(3) NOT NULL,
    302302  `infminpremio` int(3) NOT NULL,
    303303  `infdisgiunto` enum('0','1') NOT NULL DEFAULT '0',
    304304  `supdisgiunto` enum('0','1') NOT NULL DEFAULT '0',
    305   PRIMARY KEY  (`id_conf`)
    306 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
     305  `votolista` enum('0','1') NOT NULL DEFAULT '0',
     306  `inffisso` enum('0','1') NOT NULL DEFAULT '0',
     307  `supfisso` enum('0','1') NOT NULL DEFAULT '0',
     308  `fascia_capoluogo` int(2) NOT NULL DEFAULT '0',
     309  PRIMARY KEY (`id_conf`)
     310) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
     311
    307312
    308313--
     
    313318/*!40000 ALTER TABLE `soraldo_ele_conf` DISABLE KEYS */;
    314319LOCK TABLES `soraldo_ele_conf` WRITE;
    315 INSERT INTO `soraldo_ele_conf` VALUES
    316 (1, 'Legge Italiana 267/2000', 3, '1', 67, 3, 60, 3, '1', '1', 40, 40, '0', '0'),
    317 (2, 'Regione Sicilia precedente al 2008', 2, '0', 67, 3, 60, 3, '1', '1', 40, 40, '0', '0'),
    318 (3, 'Regione Sicilia Legge n. 22 del 16/12/2008', 2, '0', 67, 5, 60, 3, '1', '0', 40, 40, '0', '0'),
    319 (4, 'Regione Sicilia Legge n.6/2011', 5, '1', 67, 5, 60, 5, '1', '1', 40, 40, '1', '1');
     320INSERT INTO `soraldo_ele_conf` (`id_conf`, `descrizione`, `limite`, `consin`, `infpremio`, `supsbarramento`, `suppremio`, `listinfsbar`, `listinfconta`, `listsupconta`, `supminpremio`, `infminpremio`, `infdisgiunto`, `supdisgiunto`, `votolista`, `inffisso`, `supfisso`, `fascia_capoluogo`) VALUES
     321(1, 'Legge Italiana 267/2000', 3, '1', 67, 3, 60, 3, '1', '1', 40, 40, '0', '0', '0', '0', '0', 6),
     322(2, 'Regione Sicilia precedente al 2008', 2, '0', 67, 3, 60, 3, '1', '1', 40, 40, '0', '0', '0', '0', '0', 6),
     323(3, 'Regione Sicilia Legge n. 22 del 16/12/2008', 2, '0', 67, 5, 60, 3, '1', '0', 40, 40, '0', '0', '0', '0', '0', 7),
     324(4, 'Regione Sicilia Legge n.6/2011', 5, '1', 67, 5, 60, 5, '1', '1', 40, 40, '1', '1', '0', '0', '0', 7),
     325(5, 'Legge Italiana 267/2000 con riduzione 2011', 3, '1', 67, 3, 60, 3, '1', '1', 40, 40, '0', '0', '0', '0', '0', 7),
     326(6, 'Legge Italiana 267/2000 con riduzione 2012', 3, '1', 67, 3, 60, 3, '1', '1', 40, 40, '0', '0', '0', '0', '0', 7);
    320327UNLOCK TABLES;
    321328/*!40000 ALTER TABLE `soraldo_ele_conf` ENABLE KEYS */;
     
    334341  `preferita` enum('0','1') NOT NULL default '0',
    335342  `preferenze` TINYINT( 1 ) NOT NULL DEFAULT '1',
     343  `id_fascia` INT( 2 ) NOT NULL DEFAULT '1',
     344  `vismf` ENUM( '0', '1' ) NOT NULL DEFAULT '0',
    336345  PRIMARY KEY  (`id_cons`),
    337346  UNIQUE KEY `comune` (`id_comune`,`id_cons_gen`)
     
    404413  `id_fascia` int(2) NOT NULL,
    405414  `abitanti` int(11) NOT NULL,
    406   `data_inizio` date NOT NULL,
    407   `data_fine` date NOT NULL,
    408415  `seggi` int(4) NOT NULL,
     416  `id_conf` int(11) DEFAULT '1',
    409417  KEY `id_fascia` (`id_fascia`)
    410418) ENGINE=MyISAM DEFAULT CHARSET=latin1;
     
    417425/*!40000 ALTER TABLE `soraldo_ele_fasce` DISABLE KEYS */;
    418426INSERT INTO `soraldo_ele_fasce` VALUES
    419 (1, 3000, '2000-01-01', '2010-12-31', 12),
    420 (2, 10000, '2000-01-01', '2010-12-31', 16),
    421 (3, 15000, '2000-01-01', '2010-12-31', 20),
    422 (4, 30000, '2000-01-01', '2010-12-31', 20),
    423 (5, 100000, '2000-01-01', '2010-12-31', 30),
    424 (6, 250000, '2000-01-01', '2010-12-31', 40),
    425 (7, 500000, '2000-01-01', '2010-12-31', 46),
    426 (8, 1000000, '2000-01-01', '2010-12-31', 50),
    427 (9, 100000000, '2000-01-01', '2010-12-31', 60),
    428 (4, 30000, '2011-01-01', '2011-09-14', 16),
    429 (1, 3000, '2011-01-01', '2011-09-14', 9),
    430 (2, 10000, '2011-01-01', '2011-09-14', 12),
    431 (3, 15000, '2011-01-01', '2011-09-14', 16),
    432 (5, 100000, '2011-01-01', '2011-09-14', 24),
    433 (6, 250000, '2011-01-01', '2011-09-14', 32),
    434 (7, 500000, '2011-01-01', '2011-09-14', 36),
    435 (8, 1000000, '2011-01-01', '2011-09-14', 40),
    436 (9, 100000000, '2011-01-01', '2011-09-14', 48),
    437 (1, 1000, '2011-09-15', '0000-00-00', 6),
    438 (2, 3000, '2011-09-15', '0000-00-00', 6),
    439 (3, 5000, '2011-09-15', '0000-00-00', 7),
    440 (4, 10000, '2011-09-15', '0000-00-00', 10),
    441 (5, 15000, '2011-09-15', '0000-00-00', 16),
    442 (6, 30000, '2011-09-15', '0000-00-00', 16),
    443 (7, 100000, '2011-09-15', '0000-00-00', 24),
    444 (8, 250000, '2011-09-15', '0000-00-00', 32),
    445 (9, 500000, '2011-09-15', '0000-00-00', 36),
    446 (10, 1000000, '2011-09-15', '0000-00-00', 40),
    447 (11, 100000000, '2011-09-15', '0000-00-00', 48);
     427(1, 3000, 12, 1),
     428(2, 10000, 16, 1),
     429(3, 15000, 20, 1),
     430(4, 30000, 20, 1),
     431(5, 100000, 30, 1),
     432(6, 250000, 40, 1),
     433(7, 500000, 46, 1),
     434(8, 1000000, 50, 1),
     435(9, 100000000, 60, 1),
     436(1, 3000, 9, 5),
     437(2, 5000, 9, 5),
     438(3, 10000, 12, 5),
     439(4, 15000, 16, 5),
     440(5, 30000, 16, 5),
     441(6, 100000, 24, 5),
     442(7, 250000, 32, 5),
     443(8, 500000, 36, 5),
     444(9, 1000000, 40, 5),
     445(10, 100000000, 48, 5),
     446(1, 3000, 6, 6),
     447(2, 5000, 7, 6),
     448(3, 10000, 10, 6),
     449(4, 15000, 16, 6),
     450(5, 30000, 16, 6),
     451(6, 100000, 24, 6),
     452(7, 250000, 32, 6),
     453(8, 500000, 36, 6),
     454(9, 1000000, 40, 6),
     455(10, 100000000, 48, 6),
     456(1, 3000, 12, 2),
     457(2, 10000, 16, 2),
     458(3, 15000, 20, 2),
     459(4, 30000, 20, 2),
     460(5, 100000, 30, 2),
     461(6, 250000, 40, 2),
     462(7, 500000, 46, 2),
     463(8, 1000000, 50, 2),
     464(9, 100000000, 60, 2),
     465(1, 3000, 9, 3),
     466(2, 5000, 9, 3),
     467(4, 15000, 16, 3),
     468(3, 10000, 12, 3),
     469(5, 30000, 16, 3),
     470(6, 100000, 24, 3),
     471(7, 250000, 32, 3),
     472(8, 500000, 36, 3),
     473(9, 1000000, 40, 3),
     474(10, 100000000, 48, 3),
     475(1, 3000, 6, 4),
     476(2, 5000, 7, 4),
     477(3, 10000, 12, 4),
     478(4, 15000, 16, 4),
     479(5, 30000, 16, 4),
     480(6, 100000, 24, 4),
     481(7, 250000, 32, 4),
     482(8, 500000, 36, 4),
     483(9, 1000000, 40, 4),
     484(10, 100000000, 48, 4);
    448485/*!40000 ALTER TABLE `soraldo_ele_fasce` ENABLE KEYS */;
    449486UNLOCK TABLES;
  • trunk/sql/README.txt

    r155 r189  
    88Sql e Update dababase
    99=====================
     10
     1102 marzo 2014
     12-------------
     13- modificata tabella soraldo_ele_fasce: tolte le date di inizio e fine validità e aggiunto id_conf che permette la gestione di più fasce e la scelta di quella da attribuire alla singola consultazione;
     14- modificata tabella soraldo_ele_conf: aggiunti i campi votolista, inffisso e supfisso (per successivi usi) e fascia_capoluogo che stabilisce a quale fascia minima appartengono le città capoluogo;
     15- modificata tabella soraldo_ele_cons_comune; aggiunti i campi idfascia e vismf,
     16il primo stabilisce la fascia di appartenenza per la singola consultazione e quindi il numero di consiglieri e le regole di attribuzione dei seggi. In questo modo l'attribuzione della fascia avviene nella singola consultazione e non più generale per tutte le consultazioni.
     17il secondo stabilisce se nella singola consultazione verranno inserite le affluenze complessive (tranne per l'ultima rilevazione) o distinte per maschi e femmine (per tutte le rilevazioni)
     18
     19Eliminati i vecchi db e aggiornato l'sql presente in install/sql/
     20Aggiunto l'aggiornamento
     21- aggiornamento-2.0_2014-03.02.sql
     22_________________________________
     23
     24
    10257 ottobre 2012
    11 
     26--------------
    1227Presenti nella dir sql
    1328- eleonline2-ori.sql (db versione iniziale) e vari aggiornamenti della versione iniziale
    14 
    1529- eleonline2.0.152.sql (db ultima revisione al 7 ottobre 2012)
    16 
    17 
    1830Per chi ha gia' installato la versione 2.0 iniziale di Eleonline dovrebbe installare anche i seguenti pacchetti in ordine cronologico:
    1931- aggiornamento-2.0_20090611.sql
     
    2234- aggiornamento-2.0_2012-04.22.sql
    2335- widget.sql
    24 
     36_________________________________
Note: See TracChangeset for help on using the changeset viewer.