prepare("$sql"); $res->execute(); list($tipo_cons,$id_cons,$dettnulli,$disgiunto) = $res->fetch(PDO::FETCH_NUM); $sql="SELECT genere,voto_g,voto_l FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' "; $res = $dbi->prepare("$sql"); $res->execute(); list($genere,$votog,$votol) = $res->fetch(PDO::FETCH_NUM); include("modules/Elezioni/funzionidata.php"); include("modules/Elezioni/ele.php"); if (! get_magic_quotes_gpc()) $magic='addslashes'; else $magic=''; if (isset($param['ops'])) get_magic_quotes_gpc() ? $ops=$param['ops']:$ops=addslashes($param['ops']); else $ops=''; if (isset($param['pag'])) $pag=intval($param['pag']); else $pag=0; if (isset($param['num_ref'])) $num_ref=intval($param['num_ref']); if (isset($param['num_refs'])) $num_refs=intval($param['num_refs']); ele(); //************************************************************************** // ELE //************************************************************************** global $prefix, $dbi,$fascia,$limite,$genere,$votog; $sql="SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'"; $res = $dbi->prepare("$sql"); $res->execute(); list($totm,$totf) = $res->fetch(PDO::FETCH_NUM); $totel=$totm+$totf; $sql="SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc, orario desc limit 0,1"; $res = $dbi->prepare("$sql"); $res->execute(); list($giorno,$ora)=$res->fetch(PDO::FETCH_NUM); $sql="SELECT sum(voti_donne),sum(voti_uomini),sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$giorno' and orario='$ora'"; $res = $dbi->prepare("$sql"); $res->execute(); list($votf,$votm,$votc) = $res->fetch(PDO::FETCH_NUM); if($genere!=0){ $sql="SELECT sum(solo_gruppo),sum(validi),sum(nulli),sum(bianchi),sum(contestati), sum(voti_nulli),sum(validi_lista),sum(voti_nulli_lista),sum(contestati_lista),sum(solo_lista) FROM ".$prefix."_ele_sezioni where id_cons=$id_cons"; $res = $dbi->prepare("$sql"); $res->execute(); list($sg,$validi,$nulli,$bianchi,$contestati,$votinulli,$validilista,$nullilista,$contestatilista,$sl)=$res->fetch(PDO::FETCH_NUM); echo "
"; echo "
"._VOTANTI.""; echo ""; ECHO "
"._ISCRITTI.""._UOMINI.""._DONNE.""._VOTIU.""._VOTID.""._VOTIE."
".number_format($totel,0,',','.')."".number_format($totm,0,',','.')."".number_format($totf,0,',','.')."".number_format($votm,0,',','.')."".number_format($votf,0,',','.')."".number_format($votc,0,',','.')."

"; ECHO "



"; $totnulli=$nulli+$bianchi+$contestati+$votinulli; if ($votog) echo "
"._VOTI_LISTA.""; else echo "
"._GRUPPO.""; echo ""; ECHO "
"._VALIDI.""._NULLI.""._BIANCHI.""._CONTESTATI.""._VOTINULLI.""._TOTNON."
".number_format($validi,0,',','.')."".number_format($nulli,0,',','.')."".number_format($bianchi,0,',','.')."".number_format($contestati,0,',','.')."".number_format($votinulli,0,',','.')."".number_format($totnulli,0,',','.')."

"; ECHO "



"; }else{ $sql="SELECT sum(si),sum(no),sum(validi),sum(nulli),sum(bianchi),sum(contestati),id_gruppo FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' group by id_gruppo"; $res = $dbi->prepare("$sql"); $res->execute(); while (list($si,$no,$validi,$nulli,$bianchi,$contestati,$idg) = $res->fetch(PDO::FETCH_NUM)){ $sql="SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'"; $resref = $dbi->prepare("$sql"); $resref->execute(); list($numgruppo,$descrizione) = $resref->fetch(PDO::FETCH_NUM); echo "
"._GRUPPO."N. $numgruppo - $descrizione"; echo ""; ECHO "
"._SI." "._NO.""._VALIDI.""._NULLI.""._BIANCHI.""._CONTESTATI.""._TOTNON."
".number_format($si,0,',','.')."".number_format($no,0,',','.')."".number_format($validi,0,',','.')."".number_format($nulli,0,',','.')."".number_format($bianchi,0,',','.')."".number_format($contestati,0,',','.')."".number_format($nulli+$bianchi+$contestati,0,',','.')."

"; # votanti-------------- "._GRUPPO.""._DESCR." --- ".$numgruppo."".$descrizione." $sql="SELECT sum(voti_donne),sum(voti_uomini),sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$giorno' and orario='$ora' and id_gruppo='$idg'"; $resv = $dbi->prepare("$sql"); $resv->execute(); list($votf,$votm,$votc) = $resv->fetch(PDO::FETCH_NUM); echo "
"._VOTANTI.""; echo ""; ECHO "
"._ISCRITTI.""._UOMINI.""._DONNE.""._VOTIU.""._VOTID.""._VOTIE."
".number_format($totel,0,',','.')."".number_format($totm,0,',','.')."".number_format($totf,0,',','.')."".number_format($votm,0,',','.')."".number_format($votf,0,',','.')."".number_format($votc,0,',','.')."
"; ECHO "

"; ECHO "



"; #----------- } } if ($genere==5 and !$votog) { $totnullil=$nullilista+$contestatilista; $id_conf=0; $sql="SELECT t1.id_conf,t1.id_fascia, t2.limite, t1.solo_gruppo from ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_conf as t2 on t1.id_conf=t2.id_conf where t1.id_cons='$id_cons'"; $res = $dbi->prepare("$sql"); $res->execute(); if($res->rowCount()) list($id_conf,$fascia,$limite,$dettnulli) = $res->fetch(PDO::FETCH_NUM); if ($id_conf and $fascia<=$limite) { echo "
"._VOTI_LISTA.""; echo ""; ECHO "
"._VALIDI.""._NULLI.""._BIANCHI.""._CONTESTATI.""._VOTINULLI.""._TOTNON."
".number_format($validi,0,',','.')."".number_format($nulli,0,',','.')."".number_format($bianchi,0,',','.')."".number_format($contestati,0,',','.')."".number_format($votinulli,0,',','.')."".number_format($totnulli,0,',','.')."

"; ECHO "



"; }else{ if ($dettnulli or $disgiunto){ $sql="SELECT id_gruppo,num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_cons='$id_cons' order by num_gruppo"; $res = $dbi->prepare("$sql"); $res->execute(); echo "
"._GRUPPO.""; echo ""; if ($disgiunto) echo ""; else echo ""; echo ""; $t_voti=0;$t_solo_gruppo=0;$t_nulli_lista=0;$t_perlista=0; while(list($id_gruppo,$num_gruppo,$desc) = $res->fetch(PDO::FETCH_NUM)){ $sql="SELECT sum(voti),sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo'"; $resv = $dbi->prepare("$sql"); $resv->execute(); list($voti,$solo_gruppo)=$resv->fetch(PDO::FETCH_NUM); if($disgiunto){ $sql="SELECT sum(t1.solo_lista) from ".$prefix."_ele_voti_lista as t1 left join ".$prefix."_ele_lista as t2 on t1.id_lista=t2.id_lista where t2.id_gruppo='$id_gruppo'"; }else{ $sql="SELECT sum(t1.nulli_lista) from ".$prefix."_ele_voti_lista as t1 left join ".$prefix."_ele_lista as t2 on t1.id_lista=t2.id_lista where t2.id_gruppo='$id_gruppo'"; } $resv = $dbi->prepare("$sql"); $resv->execute(); list($perlista)=$resv->fetch(PDO::FETCH_NUM); $t_voti+=$voti;$t_solo_gruppo+=$solo_gruppo;$t_perlista+=$perlista; ECHO ""; } echo ""; ECHO "
Candidato"._VALIDI.""._SOLO_GRUPPO."
Senza indicazione di lista"._SOLOLIS.""._VOTINULLI." di Lista
".$num_gruppo."".$desc."".number_format($voti,0,',','.')."".number_format($solo_gruppo,0,',','.')."".number_format($perlista,0,',','.')."
Totale$t_voti$t_solo_gruppo$t_perlista




"; } echo "
"._VOTI_LISTA.""; echo ""; // if ($genere==5 and !$votog) echo ""; echo ""; ECHO ""; if($genere==5 and !$votog) echo ""; echo "
"._VALIDI.""._VOTINULLI.""._CONTESTATI.""._SOLO_GRUPPO.""._TOTNON."
".number_format($validilista,0,',','.')."".number_format($nullilista,0,',','.')."".number_format($contestatilista,0,',','.')."".number_format($sg,0,',','.')."".number_format($totnullil,0,',','.')."

"; ECHO "
"; } } echo "
"; echo "\n\n"; include ("footer.php"); ?>