is |
Subversion Repositories: |
Compare with Previous - Blame - Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css">
@import "style.css" screen;
@import "print.css" print;
</style>
<title>db.jablonka.cz - Dům </title>
</head>
<body>
<?
include ("header.htm");
require('grab_globals.lib.php');
include ("fce.php");
$spojeni = MySQL_Connect($db_host, $db_user, $db_pass);
MySQL_Select_DB($db_name);
if(!@$show) $show="all";
if(!@$order) $order="ulice,cp,byt";
if(!@$ulice) $ulice="vsechno";
if(!@$cp) $cp="vsechno";
#vybrani default trideni
if($ulice=="vsechno") {
$condition = "";
} else {
$condition = "AND ulice IN (\"$ulice\")";
}
switch ($cp) {
case "vsechno":
break;
case "jablonecka":
$condition = "AND cp IN (\"420/66\",\"419/64\",\"418/62\",\"417/60\",\"416/58\",\"415/56\",\"414/54\",\"413/52\",\"412/50\",\"411/48\",\"410/46\",\"409/44\",\"713/42\",\"714/40\")";
break;
case "sluknovska":
$condition = "AND cp IN (\"321/2\",\"320/4\",\"319/6\",\"318/8\",\"317/10\",\"316/12\",\"315/14\",\"314/16\",\"313/18\",\"312/20\",\"311/22\")";
break;
case "mimonska622":
$condition = "AND cp IN (\"622/1\",\"623/3\",\"624/5\",\"625/7\",\"626/9\",\"627/11\",\"628/13\",\"629/15\",\"630/17\",\"631/19\",\"632/21\")";
break;
case "mimonska633":
$condition = "AND cp IN (\"633/24\",\"634/22\",\"635/20\",\"636/18\",\"637/16\",\"638/14\",\"639/12\",\"640/10\",\"641/8\",\"642/6\",\"643/4\")";
break;
case "mimonska644":
$condition = "AND cp = \"644/2\"";
break;
case "martinicka":
$condition = "AND cp IN (\"988/5A\",\"990/9\",\"988/5\",\"987/3\",\"989/7\",\"986/1\",\"990/9\")";
break;
default:
$condition = "AND cp IN (\"$cp\")";
}
if(!@$show) $show="all";
if(!@$order) $order="prijmeni";
switch ($show) {
case "active":
$where="WHERE active IN (1) $condition";
echo '<b>Seznam aktivních uživatelů:</b> <a href="dum.php?show=inactive&order='.$order.'&ulice='.$ulice.'&cp='.$cp.'" class="odkaz">zobrazit pouze neaktivní</a> <a href="dum.php?show=all&order='.$order.'&ulice='.$ulice.'&cp='.$cp.'" class="odkaz">zobrazit vše</a>';
break;
case "inactive":
$where="WHERE active IN (0) $condition";
echo '<b>Seznam neaktivních uživatelů:</b> <a href="dum.php?show=active&order='.$order.'&ulice='.$ulice.'&cp='.$cp.'" class="odkaz">zobrazit pouze aktivní</a> <a href="dum.php?show=all&order='.$order.'&ulice='.$ulice.'&cp='.$cp.'" class="odkaz">zobrazit vše</a>';
break;
default:
$where="WHERE active IN (0,1) $condition";
echo '<b>Seznam všech uživatelů:</b> <a href="dum.php?show=active&order='.$order.'&ulice='.$ulice.'&cp='.$cp.'" class="odkaz">zobrazit pouze aktivní</a> <a href="dum.php?show=inactive&order='.$order.'&ulice='.$ulice.'&cp='.$cp.'" class="odkaz">zobrazit pouze neaktivní</a>';
}
echo "\n<br><div id=\"ulice\">\n";
#tisk ulic
echo "Ulice : ";
$dotaz=MySQL_Query("SELECT DISTINCT ulice from adresy ORDER BY ulice,cp,byt");
$count=MySQL_Num_Rows($dotaz);
$count++;
for ($i=1;$i<$count;$i++)
{
$radek=MySQL_Fetch_Array($dotaz);
echo "<a href=\"dum.php?show=$show&ulice=".$radek["ulice"]."&order=$order\">".$radek["ulice"].'</a> * ';
echo '
';
}
#dotisk posledni volby pro vsechny ulice
echo "<a href=\"dum.php?show=$show&ulice=vsechno&order=$order\">všechno</a>";
echo '
';
echo "<br>";
#tisk cisel popisnych
echo "č.p. : ";
if($ulice=="vsechno") {
$wherecp = "";
} else {
$wherecp="WHERE ulice = \"$ulice\"";
}
$dotaz=MySQL_Query("SELECT DISTINCT cp from adresy $wherecp ORDER BY cp");
$count=MySQL_Num_Rows($dotaz);
$count++;
for ($i=1;$i<$count;$i++)
{
$radek=MySQL_Fetch_Array($dotaz);
echo "<a href=\"dum.php?show=$show&cp=".$radek["cp"]."&order=$order&ulice=$ulice\">".$radek["cp"].'</a> * ';
echo '
';
}
#dotisk posledni volby pro vsechna cp
echo "<a href=\"dum.php?show=$show&cp=vsechno&order=$order&ulice=$ulice\">všechno</a>";
echo '
';
echo "<br>";
echo "Domy : ";
echo "<a href=\"dum.php?show=$show&cp=jablonecka&order=$order&ulice=Jablonecká\">Jablonecká</a> * ";
echo "<a href=\"dum.php?show=$show&cp=sluknovska&order=$order&ulice=Šluknovská\">Šluknovská</a> * ";
echo "<a href=\"dum.php?show=$show&cp=mimonska622&order=$order&ulice=Mimoňská\">Mimoňská 622</a> * ";
echo "<a href=\"dum.php?show=$show&cp=mimonska633&order=$order&ulice=Mimoňská\">Mimoňská 633</a> * ";
echo "<a href=\"dum.php?show=$show&cp=mimonska644&order=$order&ulice=Mimoňská\">Mimoňská 644</a> * ";
echo "<a href=\"dum.php?show=$show&cp=martinicka&order=$order&ulice=Martinická\">Martinická</a> * ";
#finalni dotaz do databaze pred vypisem zvolene sestavy
$adresy=MySQL_Query("SELECT c.id as cid, c.komentar as ckomentar, c.*, a.id as aid, a.*, i.id as iid, i.*
FROM (adresy a LEFT JOIN cleni c ON a.clen = c.id)
LEFT JOIN ipecka i ON a.id = i.adresa AND c.id = a.clen
$where AND a.clen > 0 GROUP BY a.id
ORDER BY $order");
echo"</div><br>Ulice <b>$ulice</b>";
#tohle zapne vykresleni panelaku pro cp z panelaku
if (($ulice="Jabloneck%E1") && (1)) {
switch ($cp) {
case "420/66" : $cp=jablonecka; break;
case "419/64" : $cp=jablonecka; break;
case "418/62" : $cp=jablonecka; break;
case "417/60" : $cp=jablonecka; break;
case "416/58" : $cp=jablonecka; break;
case "415/56" : $cp=jablonecka; break;
case "414/54" : $cp=jablonecka; break;
case "413/52" : $cp=jablonecka; break;
case "412/50" : $cp=jablonecka; break;
case "411/48" : $cp=jablonecka; break;
case "410/46" : $cp=jablonecka; break;
case "409/44" : $cp=jablonecka; break;
case "713/42" : $cp=jablonecka; break;
case "714/40" : $cp=jablonecka; break;
default:
}
}
#nastaveni parametru baraku
switch ($cp) {
case "jablonecka":
$bytu=3;
$pater=10;
$bytuvprizemi=2;
$vchody = array(14,"420/66","419/64","418/62","417/60","416/58","415/56","414/54","413/52","412/50","411/48","410/46","409/44","713/42","714/40");
$sizex=19;
$sizey=10;
$flip=false;
break;
case "sluknovska":
$bytu=3;
$pater=7;
$bytuvprizemi=2;
$vchody = array(11,"311/22","312/20","313/18","314/16","315/14","316/12","317/10","318/8","319/6","320/4","321/2");
$sizex=19;
$sizey=10;
$flip=true;
break;
case "mimonska622":
$bytu=2;
$pater=7;
$bytuvprizemi=2;
$vchody = array(11,"622/1","623/3","624/5","625/7","626/9","627/11","628/13","629/15","630/17","631/19","632/21");
$sizex=28;
$sizey=10;
$flip=false;
break;
case "mimonska633":
$bytu=2;
$pater=7;
$bytuvprizemi=2;
$vchody = array(11,"633/24","634/22","635/20","636/18","637/16","638/14","639/12","640/10","641/8","642/6","643/4");
$sizex=28;
$sizey=10;
$flip=true;
break;
case "mimonska644":
$bytu=7;
$pater=3;
$bytuvprizemi=0;
$vchody = array(1,"644/2");
$sizex=28;
$sizey=10;
$flip=false;
break;
case "martinicka":
$bytu=8;
$pater=4;
$bytuvprizemi=8;
$vchody = array(5,"988/5","987/3","989/7","986/1","990/9");
$sizex=18;
$sizey=10;
$flip=false;
break;
default:
$bytu=0;
$pater=0;
$bytuvprizemi=0;
$vchody = array(0);
$sizex=1;
$sizey=1;
$flip=false;
}
$bytucelkem=$bytu*($pater+1)*$vchody[0];
$bytunapatro=$bytu*$vchody[0];
#vytvoreni mapy domu z databaze
$mapa_bytu = array();
for($grid=1; $grid<=$bytucelkem; $grid++) $mapa_bytu[$grid]=false;
echo "<br>";
$pocet_vsech=0;
$pocet_pripojenych=0;
#projit vsechny nalezene adresy a predpripravit pole mapa_bytu pro snadne sekvencni vykresleni domu
if($bytucelkem) {
while($adresa=MySQL_Fetch_Array($adresy)) {
#zjistit jestli mame spravny cp a byt
$cspp=$adresa["cp"];
$byt=$adresa["byt"];
#toto v pripade martinicke vynuti zvlastni zachazeni i pro jednotlive vchody
if($ulice=="Martinická") {
$cp="martinicka";
}
switch ($cp) {
case "martinicka":
$bloky = " ABCDE";
$blok = $bloky{(round($byt/100))};
# $cspp=$cspp.$blok;
$vchod = cp_to_vchod($vchody,$cspp);
$patro = round(($byt - 100*$vchod - 4.9)/10);
$pozice = ($byt - 100*$vchod - 10*$patro);
$grid = ($pater-$patro)*$bytunapatro+($vchod-1)*$bytu+$pozice;
#ulozit tuto adresu s $i do pole
$mapa_bytu[$grid]=$adresa;
$pocet_vsech++;
break;
case "mimonska644":
$patro = substr($byt,1,1);
$tmp = strtr($byt,"ABCD","0123");
$a = (int)substr($tmp,0,1)*3;
$b = (int)substr($tmp,2,1);
$grid = ($pater-$patro)*$bytunapatro+$a+$b+1;
#ulozit tuto adresu s $i do pole
$mapa_bytu[$grid]=$adresa;
$pocet_vsech++;
break;
default:
$vchod=cp_to_vchod($vchody,$cspp);
if( ($vchod>0) && ($byt>0) && ($byt<=($bytuvprizemi+$pater*$bytu))) {
$patro = round(($byt+$bytu-$bytuvprizemi)/$bytu-0.51);
if($byt<=$bytuvprizemi) {
$pozice=$byt-1;
if(($bytu==3) && ($byt==2)) $pozice=2;
if(($bytu==3) && ($byt==0)) $pozice=1;
} else {
$pozice = (($byt-$bytuvprizemi-1)%$bytu);
}
if ($flip) $pozice = ($bytu-1) - $pozice;
#vypocitat pro tuto adresu $i neboli grid
$grid = ($pater-$patro)*$bytunapatro+($vchod-1)*$bytu+$pozice+1;
#echo "$cp byt $byt tam je v $vchod. vchode v $patro.patre na $pozice. pozici na gridu $grid<br>";
#ulozit tuto adresu s $i do pole
$mapa_bytu[$grid]=$adresa;
$pocet_vsech++;
} else {
if($byt == "obchod") {
$byt = 0;
$patro = round(($byt+$bytu-$bytuvprizemi)/$bytu-0.51);
$pozice = 1;
#vypocitat pro tuto adresu $i neboli grid
$grid = ($pater-$patro)*$bytunapatro+($vchod-1)*$bytu+$pozice+1;
#echo "$cp byt $byt tam je v $vchod. vchode v $patro.patre na $pozice. pozici na gridu $grid<br>";
#ulozit tuto adresu s $i do pole
$mapa_bytu[$grid]=$adresa;
#echo "byt $byt na $cspp tam je na $grid <br>";
} else {
echo $adresa["jmeno"]." ".$adresa["prijmeni"]." byt $byt na $cspp má adresu mimo tento dům nebo neúplnou<br>";
}
}
}
}
}
#projde vchody a zkontroluje jestli dane cp je v dome a vrati poradi vchodu
#pokud nenajde vrati nulu
function cp_to_vchod($vchody,$cp) {
for($i=1; $i<=$vchody[0]; $i++):
$cisla = explode("/",$vchody[$i]);
if(("$cisla[0]/$cisla[1]" == $cp) || ("$cisla[1]/$cisla[0]" == $cp) || ($cisla[0] == $cp) || ($cisla[1] == $cp)) {
return $i;
}
endfor;
return 0;
}
if($pocet_vsech>0) mysql_data_seek($adresy,0);
#tisk domu
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
#tisk popisnych cisel
echo "<tr>";
for($i=1; $i<=$vchody[0]; $i++):
echo "<td class=\"text\" colspan=$bytu align=\"center\"><a href=\"dum.php?show=$show&cp=".$vchody["$i"]."&order=$order&ulice=$ulice\">$vchody[$i]</a></td>";
endfor;
echo "</tr>";
$j=0;
for($i=1; $i<=$bytucelkem; $i++) {
$vchod=round(0.51+(($i-1)%$bytunapatro)/$bytu);
$patro=$pater-round(($i/$bytunapatro)-0.51);
$pozice=($i-1)%$bytu;
if ($flip) $pozice = ($bytu-1) - $pozice;
if($patro==0) {
$byt=1+$pozice;
if($bytu==3) {
if($pozice==1) $byt=0;
if($pozice==2) $byt=2;
}
} else {
$byt=$bytuvprizemi+($patro-1)*$bytu+$pozice+1;
}
#nove patro
if ((($i-1)/$bytunapatro)*$bytunapatro == ((($i-1)/$bytunapatro)-(($i-1)%$bytunapatro))*$bytunapatro) {
echo "<tr>\n";
};//if
if ($mapa_bytu[$i]) {
$jmeno=$mapa_bytu[$i]["prijmeni"];
$title= $mapa_bytu[$i]["prijmeni"]." ".$mapa_bytu[$i]["jmeno"]." byt ".$mapa_bytu[$i]["byt"]." IP ".$mapa_bytu[$i]["ip"];
$active_position= 0;
$mygrid= 11;
if ($mapa_bytu[$i]["ip"]) {
echo "<td><a class=\"odkaz\" target=\"_self\" href=\"clen.php?clen=".$mapa_bytu[$i]["cid"]."\">";
echo "<img src=\"./images/green.jpg\" alt=\" $title \" title=\" $title \" border=\"0\" width=\"$sizex\" height=\"$sizey\">"; //set green cell
echo "</a></td>";
$pocet_pripojenych++;
} else {
echo "<td><a class=\"odkaz\" target=\"_self\" href=\"clen.php?clen=".$mapa_bytu[$i]["cid"]."\">";
echo "<img src=\"./images/blue.jpg\" alt=\" $title \" title=\" $title \" border=\"0\" width=\"$sizex\" height=\"$sizey\">"; //set blue cell
echo "</a></td>";
};
$j++;
} else { //not a registered cell
if ($vchod%2 == 0) { //alternate grey color per 3 columns
echo "<td> <img src=\"./images/blank_light.jpg\" alt=\"nepřipojeno\" title=\"$patro.patro byt $byt\" border=\"0\" width=\"$sizex\" height=\"$sizey\"></td>";
} else {
echo "<td> <img src=\"./images/blank_dark.jpg\" alt=\"nepřipojeno\" title=\"$patro.patro byt $byt\" border=\"0\" width=\"$sizex\" height=\"$sizey\"></td>";
};//if
};//if - else
if (($i/$bytunapatro)*$bytunapatro == (($i/$bytunapatro)-($i%$bytunapatro))*$bytunapatro) { //end of line each 42 cells
echo "</tr>\n";
};//if
}
echo "</table>";
if($pocet_vsech>0) {
$celkembytu = (($bytu*$pater)+$bytuvprizemi)*$vchody[0];
$procent_vsech=round(100*$pocet_vsech/$celkembytu,2);
$procent_pripojenych=round(100*$pocet_pripojenych/$pocet_vsech,2);
echo "<br>Počet všech je $pocet_vsech z $celkembytu ($procent_vsech%)<br>";
echo "Počet připojených je $pocet_pripojenych ($procent_pripojenych%)<br>";
}
echo '
<table width="100%" class="list">
<tr bgcolor="#FFFFFF">
<td class="text">
<a title="seřadit podle ulice" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=ulice,cp,byt">Ulice</a>
</td>
<td class="text">
<a title="seřadit podle č.p." class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=cp">č.p.</a>
</td>
<td class="text">
<a title="seřadit podle bytů" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=byt">Byt</a>
</td>
<td > </td>
<td class="text">
<a title="seřadit podle ID" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=cid">ID</a>
</td>
<td bgcolor=#FFFFFF class=text width=80>
<a title="se.adit podle aktivity" class=odkaz href="seznam.php?show='.$show.'&order=active">A</a>
<a title="se.adit podle financ." class=odkaz href="seznam.php?show='.$show.'&order=finance">F</a>
<a title="se.adit podle internetu" class=odkaz href="seznam.php?show='.$show.'&order=internet">I</a>
<a title="se.adit podle elekt.iny" class=odkaz href="seznam.php?show='.$show.'&order=energy">E</a>
</td>
<td class="text">
<a title="seřadit podle jména" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=jmeno">Jméno</a>
</td>
<td class="text">
<a title="seřadit podle příjmení" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=prijmeni">Příjmení:</a>
</td>
<td class="text">
<a title="seřadit podle mailu" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=email">email:</a>
</td>
<td class="text">
<a title="seřadit podle telefonu" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=domu">Domů:</a>
</td>
<td class="text">
<a title="seřadit podle mobilu" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=mobil">Mobil:</a>
</td>
<td class="text">
<a title="seřadit podle pokladny" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=ip">IP</a>
</td>
<td class="text">
<a title="seřadit podle komentářů" class=odkaz href="dum.php?cp='.$cp.'&show='.$show.'&ulice='.$ulice.'&order=c.komentar">komentář</a>
</td>
</tr>
';
#######################################################################################
#######################################################################################
$row=1;
$celkem=0;
$castkacelkem=0;
$prijmy=0;
$vydaje=0;
while($vysledek=MySQL_Fetch_Array($adresy))
{
$celkem++;
if($vysledek["id"]<1000)
{
$dot="lan.bmp";
$alt="LAN Jablonka";
}
else
{
if($vysledek["id"]==1000)
{
$dot="apy.bmp";
$alt="AP Yenik";
}
if($vysledek["id"]==1001)
{
$dot="apj.bmp";
$alt="AP Jablonecká";
}
}
$icons="";
if($show=="all" && $vysledek["active"]==2) $icons=$icons.'<img title="Čekatel" src="images/actv.gif"> ';
if($show=="all" && $vysledek["active"]==1) $icons=$icons.'<img title="Člen" src="images/actv.gif"> ';
if($show=="all" && $vysledek["active"]==0) $icons=$icons.'<img title="Pasivní" src="images/passv.gif"> ';
if($vysledek["finance"]==1) $icons=$icons.'<img title="Finance" src="images/dolar.gif"> ';
if($vysledek["internet"]==1) $icons=$icons.'<img title="Internet" src="images/net.gif"> ';
if($vysledek["energy"]==1) $icons=$icons.'<img title="Elektřina sleva" src="images/energysleva.gif"> ';
if($vysledek["energy"]==2) $icons=$icons.'<img title="Elektřina" src="images/energy.gif"> ';
echo '
<tr class="row'.$row.'">
<td class="text">
<a class="odkaz" target="_self" href="edit_adres.php?id='.$vysledek["aid"].'">'.$vysledek["ulice"].'</a>
</td>
<td class="text">'.$vysledek["cp"].'</td>
<td class="text">'.$vysledek["byt"].'</td>
<td class="text"> <a class="odkaz"
target="_self" href="clen.php?clen='.$vysledek["cid"].'"><img src="images/'.$dot.'" title="'.$alt.'" alt="'.$alt.'" border="0"></a>
</td>
<td class="text"><a class="odkaz" target="_self" href="edit_user.php?id='.$vysledek["cid"].'">'.$vysledek["cid"].'</a></td>
<td class="text">'.$icons.'</td>
<td class="text">'.$vysledek["jmeno"].'</td>
<td class="text">'.$vysledek["prijmeni"].'</td>
<td class="text">'.$vysledek["email"].'</td>
<td class="text">'.$vysledek["domu"].'</td>
<td class="text">'.$vysledek["mobil"].'</td>
<td class="text">'.$vysledek["ip"].'</td>
<td class="text">'.$vysledek["ckomentar"].'</td>
</tr>
';
Next($vysledek);
$row = 3-$row;
}
echo '
</table>
<br>
Celkem zobrazeno '.$celkem.' záznamů.<br>
</center>
';
?>
</body>
</html>