prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $descr_consultazione=$row[0]; $tipo_cons=$row[1]; $id_cons=$row[2]; $sql="SELECT genere FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' "; $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $genere = $row[0]; 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']); include("modules/Elezioni/funzionidata.php"); include("modules/Elezioni/ele.php"); // echo "\n"; ele(); //************************************************************************** // ELE //************************************************************************** global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $genere, $id_gruppo; $cond=''; if ($genere==0) { if (!IsSet($pag)) {$pag=0;} //inizializza il numero di pagina if (!IsSet($num_ref)) { $num_ref=1; $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons"; $sth = $dbi->prepare("$sql"); $sth->execute(); $num_refs= $sth->rowCount(); //quante pagine? } $sql="SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref"; $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $idg=$row[0]; $numg=$row[1]; $id_gruppo=$idg; $cond= "and id_gruppo=$id_gruppo"; echo "\n
"._CONSULTAZIONE." N. ".$numg."
\n
"; } $i=1; $sql"SELECT num_sez,id_sez,t1.id_sede, t2.id_circ,maschi,femmine,(maschi+femmine) as elettori FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede order by num_sez"; $sth = $dbi->prepare("$sql"); $sth->execute(); while ($linka[$i++] = $sth->fetch(PDO::FETCH_BOTH)); $num_sez = $sth->rowCount(); //numero totale delle sezioni $tot_compl=0;$tot_u=0;$tot_d=0; // $ar['riga1'][0]="
"; $ar[0][0]=""._TOTS.""; $ar['perc'][0]=_PERC; // $ar['riga2'][0]="
"; for ($i=1;$i<=$num_sez;$i++) { $ar[$i]['numsez']=$i; $ar[$i]['elettori']=number_format($linka[$i]['elettori'],0,',','.'); $tot_compl+=$linka[$i]['elettori']; $tot_u+=$linka[$i]['maschi']; $tot_d+=$linka[$i]['femmine']; } $ar[0][1]="".number_format($tot_compl,0,',','.').""; // $ar['riga1'][1]="
"; $ar['perc'][1]=" "; // $ar['riga2'][1]="
"; $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1"; $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $ultora=$row[0]; $ultdata=$row[1]; $sql = "SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' order by data,orario"; $resril = $dbi->prepare("$sql"); $resril->execute(); $num_ril = $resril->rowCount(); //numero delle rilevazioni previste echo "\n"; echo ""; $sql="SELECT data,orario,sum(voti_complessivi),sum(voti_uomini),sum(voti_donne) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons $cond group by data,orario"; $sth = $dbi->prepare("$sql"); $sth->execute(); while ($row = $sth->fetch(PDO::FETCH_BOTH)) { $data=$row[0]; $ora=$row[1]; $somma=$row[2]; $votiu=$row[3]; $votid=$row[4]; $perc_u='';$perc_d='';$perc_c=''; # if($votiu or $votid) if(($data==$ultdata) and ($ora==$ultora)) { $tot[$data.$ora]="\n
"._SEZIONI.""._ISCRITTI."
"._INSEZ."
".number_format($votiu,0,',','.')."".number_format($votid,0,',','.')."".number_format($somma,0,',','.')."
\n"; if($tot_u) $perc_u=number_format($votiu*100/$tot_u,2); if($tot_d) $perc_d=number_format($votid*100/$tot_d,2); $perc_c=number_format($somma*100/$tot_compl,2); } else $tot[$data.$ora]=$somma; } $ud=0;$ora_rif=""; while ($row2 = $resril->fetch(PDO::FETCH_BOTH)) { $data1=$row2[0]; $ora1=$row2[1]; $ud++; list($hour, $minute, $second) = explode(":", $ora1); $ora_ril=$hour.":".$minute; echo "".form_data($data1)."
"._ORE." ".$ora_ril; $sql="SELECT count(data) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$data1' and orario='$ora_ril' $cond"; $resaff = $dbi->prepare("$sql"); $resaff->execute(); $num_scr=$resaff->rowCount(); //numero delle sezioni inserite echo "
"._SEZIONI." $num_scr "._SU." $num_sez"; if ($ud==$num_ril) echo "
\n
"._UOMINI.""._DONNE.""._COMPLESSIVI."
\n"; echo ""; // $ar['riga1'][$data1.$ora1]="
"; if (isset($tot[$data1.$ora1])){ if ($ora_rif=="$data1.$ora1") { $ar['perc'][$data1.$ora1]="\n
$perc_u%$perc_d%$perc_c%
\n"; $ar[0][$data1.$ora1]=$tot[$data1.$ora1]; } else { $ar['perc'][$data1.$ora1]="".number_format($tot[$data1.$ora1]*100/$tot_compl,2)."%"; $ar[0][$data1.$ora1]="".(number_format($tot[$data1.$ora1],0,',','.')).""; } // $ar['riga2'][$data1.$ora1]="
"; if (intval(preg_match("/[1-9]/",$tot[$data1.$ora1]))>0) { for ($i=1;$i<=$num_sez;$i++) { $ar[$i][$data1.$ora1]="non rilevata"; } } } } $sql="SELECT data,orario,t2.num_sez,voti_uomini, voti_donne, voti_complessivi from ".$prefix."_ele_voti_parziale as t1, ".$prefix."_ele_sezioni as t2 where t1.id_cons=$id_cons and t1.id_sez=t2.id_sez $cond order by data,orario,t2.num_sez"; $sth = $dbi->prepare("$sql"); $sth->execute(); $ud=0; while ($row = $sth->fetch(PDO::FETCH_BOTH)) { $data=$row[0]; $ora=$row[1]; $numsez=$row[2]; $uomini=$row[3]; $donne=$row[4]; $complessivi=$row[5]; if ($ora_rif=="$data.$ora") $ar[$numsez][$data.$ora]="\n
$uomini$donne$complessivi
\n"; else $ar[$numsez][$data.$ora]=$complessivi; if ($uomini+$donne>0) { if ($uomini+$donne!=$complessivi) { $ar[$numsez]['controllo']= "
ERRORE"; } else { $ar[$numsez]['controllo']= "OK"; } } } echo ""._STATO."\n"; foreach ($ar as $i => $arr) { echo ""; foreach ($arr as $valore) { echo "$valore"; } echo "\n"; } if($genere==0){ //se e' referendum #'Pagina precedente' e 'Pagina Successiva' echo "\n"; $cur=$num_ref; if ($cur>1) { $num_ref--; echo ""; } if ($cur<$num_refs) { $cur++; echo ""; } echo "
"; echo ""._PREV_MATCH.""; echo ""._NEXT_MATCH."
\n"; } echo "\n
\n"; echo "\n"; include ("footer.php"); ?>