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" media="screen"> @import "style.css"; </style>
<title>db.jablonka.cz - Přidání majetku</title>
</head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body topmargin=0 leftmargin=10>
<?
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);
$aktualnidatum=date("d.m.Y");
$aktualnirok=date("Y");
if(!@$action)
{
echo '
<b>Přidání majetku uživatele '.id_to_name($clen).':</b><br>
<form action="add_majetek.php?action=zapis" method=POST>
<br>
<table>
<tr>
<td class=text>Člen:</td><td colspan=1>
<select class=field name="clen">'."\n";
#vypis vsech moznosti a predvybrani podle clena
$string=MySQL_Query("SELECT c.id as cid, c.*, i.id as iid, i.* FROM cleni c LEFT JOIN ipecka i ON c.id = i.clen WHERE active=1 ORDER BY prijmeni");
while($vysledek=MySQL_Fetch_Array($string))
{
echo '<option '; if($clen==$vysledek["cid"]){ echo 'selected';} echo' value='.$vysledek["cid"].'>'.$vysledek["prijmeni"]." ".$vysledek["jmeno"]." ".$vysledek["ip"]." ".$vysledek["vs"].'</option>'."\n";
}
echo '
</select>
</td>
<td class=text>Adresa:</td><td colspan=3>
<select class=field name="adresa">'."\n";
#vypis vsech moznosti a predvybrani podle clena
$string=MySQL_Query("SELECT * FROM adresy WHERE clen=$clen ORDER BY id");
while($vysledek=MySQL_Fetch_Array($string))
{
echo '<option '; if(197==$vysledek["id"]){ echo 'selected';} echo' value='.$vysledek["id"].'>'.$vysledek["ulice"]." ".$vysledek["cp"]." ".$vysledek["byt"].'</option>'."\n";
}
echo '
</select>
</td>
</tr>
<tr> <td> <hr> </td> </tr>
<tr>
<td class=text>Zařízení:</td>
<td>
<select class=field name="zarizeni">';
$dotaz=MySQL_Query("SELECT * from zarizeni ORDER BY id");
$count=MySQL_Num_Rows($dotaz);
$count++;
for ($i=1;$i<$count;$i++)
{
$radek=MySQL_Fetch_Array($dotaz);
echo '<option '; if(@$zarizeni==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
echo '
';
}
echo '</select>
</td>
</tr>
<tr>
<td class=text>Sériové číslo:</td><td><input class=field name="scislo" type="text" value="" size=35></td>
<td class=text>Spotřeba [W]:</td><td><input class=field name="spotreba" type="text" value="0" size=15></td>
</tr>
<tr>
<td class=text>MAC:</td><td><input class=field name="mac" type="text" value="" size=35></td>
</tr>
<tr> <td> <hr> </td> </tr>
<tr>
<td class=text>Finance(účtenka):</td>
<td colspan=3>
<select class=field name="finance">';
$dotaz=MySQL_Query("SELECT * from finance WHERE platba=9 ORDER BY datum");
$count=MySQL_Num_Rows($dotaz);
$count++;
echo '<option value=null>není</option>';
for ($i=1;$i<$count;$i++)
{
$radek=MySQL_Fetch_Array($dotaz);
echo '<option '; if(@$finance==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".sql2datum($radek["datum"])." ".substr($radek["komentar"],0,70).'</option>';
echo '
';
}
echo '</select>
</td>
</tr>
<tr>
<td class=text>Součást:</td>
<td>
<select class=field name="soucast">';
$dotaz=MySQL_Query("SELECT * from majetek ORDER BY id");
$count=MySQL_Num_Rows($dotaz);
$count++;
echo '<option value=null>není</option>';
for ($i=1;$i<$count;$i++)
{
$radek=MySQL_Fetch_Array($dotaz);
echo '<option '; if(@$soucast==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".id_to_zarizeni($radek["zarizeni"])." ".$radek["scislo"]." ".substr($radek["komentar"],0,70).'</option>';
echo '
';
}
echo '</select>
</td>
</tr>
<tr>
<td class=text valign=top>Komentář:</td><td colspan=3><textarea class=fieldthin name="komentar" rows=4 cols=100></textarea></td>
</tr>
</table>
<br><br>
<input class=field type="submit" name="OK" value=" přidat majetek ">
</form>
';
}
else
{
$test=MySQL_Query("SELECT MAX(id) FROM majetek");
$test=MySQL_Fetch_Array($test);
$id=$test["MAX(id)"];
$id++;
$result = MySQL_Query("INSERT INTO majetek VALUES ('$id','$clen','$adresa','$zarizeni','$finance','$spotreba','$soucast','$scislo','$komentar','$mac')");
if (!$result) {
echo "<br><b>Výsledek : ".mysql_error()."</b>";
} else {
echo "<br><b>Majetek uživatele ".id_to_name($clen)." byla úspěšně vložen!</b>";
}
echo '
<br><br>
<img src=images/arrow.jpg> <a href="javascript:history.go(-2)" class=odkaz>zpět</a>
<img src=images/arrow.jpg> <a href="majetek.php" class=odkaz>zpět na majetek</a>
';
}
MySQL_Close($spojeni);
?>
</body>
</html>