Changeset 139 for trunk/client/modules/Elezioni/votanti.php
- Timestamp:
- May 6, 2012, 8:53:42 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/votanti.php
r127 r139 220 220 $tab3="_ele_voti_lista"; 221 221 if ($genere>0) { //se non e' un referendum 222 223 224 222 225 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 "; 224 228 225 229 }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' 227 236 FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez) 228 237 left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede) 229 238 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 } 230 246 } 231 247 248 249 232 250 $riga1 = ""; 233 251 if($pag==0)$riga1 .="<h2>"._DETTAGLIO." "._VOTIE."</h2>"; 234 else $riga1 .="<h 2>"._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_gruppo252 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 238 256 FROM ".$prefix."_ele_voti_ref as t1 left join ".$prefix."_ele_sezioni as t2 on (t1.id_sez=t2.id_sez) 239 257 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) … … 259 277 $riga3 .= "<td>"._SI."</td><td>"._NO."</td>"; 260 278 } 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 263 289 $riga3 .= "<td>"._VALIDI."</td><td>"._NULLI."</td><td>"._BIANCHI."</td><td>"._CONTESTATI."</td>" 264 290 ."</tr>\n"; … … 268 294 $scrutinate=1; 269 295 $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)){ 271 299 // inserimento numeri di sez non scrutinate 272 300 while ($scrutinate < $num) { … … 274 302 $scrutinate++; 275 303 } 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 276 311 $scrutinate++; 277 312 // fine inserimento … … 281 316 list($votid,$votiu,$voti) = mysql_fetch_row($res2); 282 317 // $voti=$votiu+$votid; 318 $tot_gruppo+=$sindaco; 283 319 $tot_u+=$votiu; 284 320 $tot_d+=$votid; … … 290 326 $tot_bianchi+=$bianchi; 291 327 $tot_contestati+=$contestati; 328 $tot_sololista+=$sololista; 292 329 $righe .= "<tr class=\"bggray2\"> 293 330 <td>$num</td> … … 295 332 <td>".number_format($votid,0,',','.')."</td> 296 333 <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 301 347 $righe .= "<td>".number_format($validi,0,',','.')."</td> 348 302 349 <td>$nulli</td> 303 350 <td>$bianchi</td> … … 320 367 $righet .= "<td>"._SI."</td><td>"._NO."</td>"; 321 368 } 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 323 376 } 324 377 if($totel==0) $totelrip="0.00"; else $totelrip=number_format($tot_voti*100/$totel,2); … … 330 383 331 384 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>"; 333 386 334 387 // se e' un referendum o una consultazione con raggruppamenti 335 388 336 389 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>"; 340 405 }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>"; 344 410 } 345 411 } … … 395 461 396 462 463 397 464 ############### stampa 398 465 if ($xls!='1' && $pdf!='1'){ … … 406 473 echo "$html \n"; 407 474 }elseif($pdf=='1'){ 475 476 408 477 $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>"; 411 485 412 486 require_once('inc/hpdf403/html2pdf.class.php'); … … 414 488 $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml'])); 415 489 $html2pdf->Output($nomefile); 416 } 490 491 492 } 493 494 417 495 418 496
Note:
See TracChangeset
for help on using the changeset viewer.