Ignore:
Timestamp:
May 6, 2012, 8:53:42 PM (12 years ago)
Author:
roby
Message:

Modifiche per gestione Legge regione Sicilia 2011

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/modules/Elezioni/votanti.php

    r127 r139  
    220220        $tab3="_ele_voti_lista";
    221221        if ($genere>0) {  //se non e' un referendum
     222
     223
     224
    222225                if (!($genere==4) and $pag==0){  //se non e' una lista uninominale ed e' la prima pagina
    223                         $tab="SELECT 0,t2.id_sez,t2.num_sez,t2.validi,'0',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0' FROM ".$prefix."_ele_sezioni as t2 left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t2.id_cons='$id_cons' and t2.validi+t2.nulli+t2.bianchi+t2.contestati>0 group by t2.id_sez order by t2.num_sez ";
     226                       
     227                        $tab="SELECT 0,t2.id_sez,t2.num_sez,t2.validi,'0','0',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0' FROM ".$prefix."_ele_sezioni as t2 left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t2.id_cons='$id_cons' and t2.validi+t2.nulli+t2.bianchi+t2.contestati>0 group by t2.id_sez order by t2.num_sez ";
    224228               
    225229                }else{ // e' una lista uninominale o la seconda pagina
    226                         $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0'
     230
     231
     232
     233                        # voto disgiunto regione sicilia aggiunge il campo solo lista
     234                    if(isdisgiunto()){
     235                        $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0'
    227236                        FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
    228237                        left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
    229238                        where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t2.id_sez order by t1.num_sez ";
     239                     }else{
     240                       
     241                        $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0'
     242                        FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
     243                        left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
     244                        where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t2.id_sez order by t1.num_sez ";
     245                        }
    230246                }
    231                
     247       
     248
     249       
    232250                $riga1 = "";
    233251                if($pag==0)$riga1 .="<h2>"._DETTAGLIO." "._VOTIE."</h2>";
    234                 else $riga1 .="<h2>"._DETTAGLIO." "._VOTIE." "._ASOLA_LISTA."</h2>";
    235                
    236         }else{ // e' un referendum
    237                 $tab="SELECT t1.id_gruppo,t1.id_sez,t2.num_sez,t1.si,t1.no,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t2.id_sede,t3.num_gruppo
     252                else $riga1 .="<h4>"._DETTAGLIO." "._VOTIE." "._ASOLA_LISTA."</h4>";
     253               
     254        }else{ // e' un referendum --> t3.id_gruppo vuota per allineare il while (da rifare con array)
     255                $tab="SELECT t1.id_gruppo,t1.id_sez,t2.num_sez,t1.si,t1.no,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t2.id_sede,t3.num_gruppo
    238256                FROM ".$prefix."_ele_voti_ref as t1 left join ".$prefix."_ele_sezioni as t2 on (t1.id_sez=t2.id_sez)
    239257                left join  ".$prefix."_ele_gruppo as t3 on (t1.id_gruppo=t3.id_gruppo) left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede)
     
    259277                $riga3 .= "<td>"._SI."</td><td>"._NO."</td>";
    260278        } elseif ((($genere==5) or ($genere==3)) and $pag==1){
    261                 $riga3 .= "<td>"._ASOLA_LISTA."</td><td>"._ASOLO_GRUPPO."</td>";
    262         }
     279                $riga3 .= "<td>Voti "._LISTE."</td>";
     280                if(isdisgiunto()){
     281                        $riga3 .= "<td>Voti "._PRESI."</td>";
     282                        $riga3 .= "<td>"._SOLO_LISTA."</td>";
     283                       
     284                       
     285                } // voto disgiunto
     286                $riga3 .= "<td>"._ASOLO_GRUPPO."</td>";
     287        }
     288       
    263289        $riga3 .= "<td>"._VALIDI."</td><td>"._NULLI."</td><td>"._BIANCHI."</td><td>"._CONTESTATI."</td>"
    264290    ."</tr>\n";
     
    268294        $scrutinate=1;
    269295        $tot_u=0;$tot_d=0;$tot_voti=0; $tot_si=0;$tot_no=0;$tot_validi=0;$tot_nulli=0;$tot_bianchi=0;$tot_contestati=0;
    270         while (list($id_gruppo,$id,$num,$si,$no,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo) = mysql_fetch_row($res)){
     296        $tot_sololista=0;$tot_gruppo=0;
     297        #$si e $no sono valide anche per voti lista e solo gruppo per i non referendum
     298        while (list($id_gruppo,$id,$num,$si,$no,$sololista,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo) = mysql_fetch_row($res)){
    271299        // inserimento numeri di sez non scrutinate
    272300                while ($scrutinate < $num) {
     
    274302                        $scrutinate++;
    275303                }
     304
     305        # voti sindaco, gruppo o presidente
     306        $tab5="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id'";
     307        $res3 = mysql_query("$tab5", $dbi);
     308        list($sindaco) = mysql_fetch_row($res3);       
     309       
     310
    276311                $scrutinate++;
    277312        // fine inserimento     
     
    281316                list($votid,$votiu,$voti) = mysql_fetch_row($res2);
    282317//              $voti=$votiu+$votid;
     318                $tot_gruppo+=$sindaco;
    283319                $tot_u+=$votiu;
    284320                $tot_d+=$votid;
     
    290326                $tot_bianchi+=$bianchi;
    291327                $tot_contestati+=$contestati;
     328                $tot_sololista+=$sololista;
    292329                $righe .= "<tr class=\"bggray2\">
    293330                <td>$num</td>
     
    295332                <td>".number_format($votid,0,',','.')."</td>
    296333                <td>".number_format($voti,0,',','.')."</td>";
    297                 if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){$righe
    298                 .= "<td>".number_format($si,0,',','.')."</td>
    299                 <td>".number_format($no,0,',','.')."</td>";}
    300                
     334                if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
     335                $righe .= "<td>".number_format($si,0,',','.')."</td>";
     336               
     337                if(isdisgiunto()){
     338                        $righe .= "<td>".number_format($sindaco,0,',','.')."</td>";
     339                        $righe .= "<td>".number_format($sololista,0,',','.')."</td>";
     340                        }
     341                $righe .= "<td>".number_format($no,0,',','.')."</td>"; 
     342
     343
     344}
     345               
     346
    301347                $righe .= "<td>".number_format($validi,0,',','.')."</td>
     348
    302349                <td>$nulli</td>
    303350                <td>$bianchi</td>
     
    320367                $righet .= "<td>"._SI."</td><td>"._NO."</td>";
    321368        } elseif ((($genere==5) or ($genere==3)) and $pag==1){
    322                 $righet .= "<td>"._ASOLA_LISTA."</td><td>"._ASOLO_GRUPPO."</td>";
     369                $righet .= "<td>Voti "._LISTE."</td>";
     370                if(isdisgiunto()){
     371                        $righet .= "<td>Voti "._PRESI."</td>";
     372                        $righet .= "<td>"._SOLO_LISTA."</td>";
     373                } // voto disgiunto     
     374                $righet .= "<td>"._ASOLO_GRUPPO."</td>";
     375               
    323376        }
    324377        if($totel==0) $totelrip="0.00"; else $totelrip=number_format($tot_voti*100/$totel,2);
     
    330383
    331384
    332         <tr class=\"td-vuotoc\"><td><b>"._TOT."</b></td><td><b>".number_format($tot_u,0,',','.')."</b><br /><i>(".$totmrip." %)</i></td><td><b>".number_format($tot_d,0,',','.')."</b><br /><i>(".$totfrip." %)</i></td><td><b>".number_format($tot_voti,0,',','.')."</b><br /><i>(".$totelrip." %)</i></td>";
     385        <tr class=\"td-vuotoc\"><td><b>"._TOT."</b></td><td><b>".number_format($tot_u,0,',','.')."</b><br /><i>(".$totmrip."%)</i></td><td><b>".number_format($tot_d,0,',','.')."</b><br /><i>(".$totfrip."%)</i></td><td><b>".number_format($tot_voti,0,',','.')."</b><br /><i>(".$totelrip."%)</i></td>";
    333386       
    334387        // se e' un referendum o una consultazione con raggruppamenti
    335388
    336389        if($tot_validi){
    337         if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){$righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(".number_format($tot_si*100/$tot_validi,2)." %)</i></td><td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(".number_format($tot_no*100/$tot_validi,2)." %)</i></td>";}
    338         $righet .= "<td><b>".number_format($tot_validi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_validi*100/$tot_voti,2):'0.00')." %)</i></td><td><b>"
    339         .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0.00')." %)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0.00')." %)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0.00')." %)</i></td></tr>";
     390        if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
     391                $righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(".number_format($tot_si*100/$tot_validi,2)."%)</i></td>";
     392
     393                if(isdisgiunto()){
     394                        $righet .="<td><b>".number_format($tot_gruppo,0,',','.')."</b><br /><i>(".number_format($tot_gruppo*100/$tot_validi,2)."%)</i></td>";
     395                        $righet .="<td><b>".number_format($tot_sololista,0,',','.')."</b><br /><i>(".number_format($tot_sololista*100/$tot_validi,2)."%)</i></td>";
     396                }
     397
     398
     399        $righet .="<td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(".number_format($tot_no*100/$tot_validi,2)."%)</i></td>";   
     400        }
     401
     402
     403                $righet .= "<td><b>".number_format($tot_validi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_validi*100/$tot_voti,2):'0.00')."%)</i></td><td><b>"
     404        .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0.00')."%)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0.00')."%)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0.00')."%)</i></td></tr>";
    340405        }else{
    341         if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){$righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(0.00 %)</i></td><td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(0.00 %)</i></td>";}
    342         $righet .= "<td><b>0</b><br /><i>(0.00 %)</i></td><td><b>"
    343         .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0,00')." %)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0,00')." %)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0,00')." %)</i></td></tr>";
     406        if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
     407        $righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(0.00%)</i></td><td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(0.00%)</i></td>";}
     408        $righet .= "<td><b>0</b><br /><i>(0.00%)</i></td><td><b>"
     409        .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0,00')."%)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0,00')."%)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0,00')."%)</i></td></tr>";
    344410        }
    345411        }
     
    395461
    396462
     463
    397464############### stampa
    398465if ($xls!='1' && $pdf!='1'){
     
    406473        echo "$html \n";
    407474}elseif($pdf=='1'){
     475
     476
    408477                $nomefile="$descr_cons votanti.pdf";
    409                
    410                 $stampa ="$datipdf $html";
     478
     479
     480
     481
     482
     483               
     484                $stampa ="<div style=\"margin:0 auto;text-align:center;\">$datipdf $html</div>";
    411485               
    412486                require_once('inc/hpdf403/html2pdf.class.php');
     
    414488                $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
    415489                $html2pdf->Output($nomefile);
    416 }
     490
     491
     492}
     493
     494
    417495
    418496
Note: See TracChangeset for help on using the changeset viewer.