jablonka.czprosek.czf

is

Subversion Repositories:
[/] [trunk/] [html/] [add_majetek.php] - Blame information for rev 6

 

Line No. Rev Author Line
12simandl<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
5<style type="text/css" media="screen"> @import "style.css"; </style>
6<title>db.jablonka.cz - Přidání majetku</title>
7</head>
8<link rel="stylesheet" type="text/css" href="style.css">
9</head>
10<body topmargin=0 leftmargin=10>
11<?
12include("header.htm");
13require('grab_globals.lib.php');
14include ("fce.php");
15$spojeni = MySQL_Connect($db_host, $db_user, $db_pass);
16MySQL_Select_DB($db_name);
17$aktualnidatum=date("d.m.Y");
18$aktualnirok=date("Y");
19 
20if(!@$action)
21{
22echo '
23<b>Přidání majetku uživatele '.id_to_name($clen).':</b><br>
24 
25<form action="add_majetek.php?action=zapis" method=POST>
26<br>
27<table>
28 <tr>
29 <td class=text>Člen:</td><td colspan=1>
30 <select class=field name="clen">'."\n";
31 #vypis vsech moznosti a predvybrani podle clena
32 $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");
33 while($vysledek=MySQL_Fetch_Array($string))
34 {
35 echo '<option '; if($clen==$vysledek["cid"]){ echo 'selected';} echo' value='.$vysledek["cid"].'>'.$vysledek["prijmeni"]." ".$vysledek["jmeno"]." ".$vysledek["ip"]." ".$vysledek["vs"].'</option>'."\n";
36 }
37 echo '
38 </select>
39 </td>
40 <td class=text>Adresa:</td><td colspan=3>
41 <select class=field name="adresa">'."\n";
42 #vypis vsech moznosti a predvybrani podle clena
43 $string=MySQL_Query("SELECT * FROM adresy WHERE clen=$clen ORDER BY id");
44 while($vysledek=MySQL_Fetch_Array($string))
45 {
46 echo '<option '; if(197==$vysledek["id"]){ echo 'selected';} echo' value='.$vysledek["id"].'>'.$vysledek["ulice"]." ".$vysledek["cp"]." ".$vysledek["byt"].'</option>'."\n";
47 }
48 echo '
49 </select>
50 </td>
51 </tr>
52 
53 <tr> <td> <hr> </td> </tr>
54 
55 <tr>
56 <td class=text>Zařízení:</td>
57 <td>
58 <select class=field name="zarizeni">';
59 $dotaz=MySQL_Query("SELECT * from zarizeni ORDER BY id");
60 $count=MySQL_Num_Rows($dotaz);
61 $count++;
62 for ($i=1;$i<$count;$i++)
63 {
64 $radek=MySQL_Fetch_Array($dotaz);
65 echo '<option '; if(@$zarizeni==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
66 echo '
67 ';
68 }
69 echo '</select>
70 </td>
71 </tr>
72 <tr>
73 <td class=text>Sériové číslo:</td><td><input class=field name="scislo" type="text" value="" size=35></td>
74 <td class=text>Spotřeba [W]:</td><td><input class=field name="spotreba" type="text" value="0" size=15></td>
75 </tr>
76 <tr>
77 <td class=text>MAC:</td><td><input class=field name="mac" type="text" value="" size=35></td>
78 </tr>
79 
80 <tr> <td> <hr> </td> </tr>
81 
82 <tr>
83 <td class=text>Finance(účtenka):</td>
84 <td colspan=3>
85 <select class=field name="finance">';
86 $dotaz=MySQL_Query("SELECT * from finance WHERE platba=9 ORDER BY datum");
87 $count=MySQL_Num_Rows($dotaz);
88 $count++;
89 echo '<option value=null>není</option>';
90 for ($i=1;$i<$count;$i++)
91 {
92 $radek=MySQL_Fetch_Array($dotaz);
93 echo '<option '; if(@$finance==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".sql2datum($radek["datum"])." ".substr($radek["komentar"],0,70).'</option>';
94 echo '
95 ';
96 }
97 echo '</select>
98 </td>
99 
100 </tr>
101 <tr>
102 
103 <td class=text>Součást:</td>
104 <td>
105 <select class=field name="soucast">';
106 $dotaz=MySQL_Query("SELECT * from majetek ORDER BY id");
107 $count=MySQL_Num_Rows($dotaz);
108 $count++;
109 echo '<option value=null>není</option>';
110 for ($i=1;$i<$count;$i++)
111 {
112 $radek=MySQL_Fetch_Array($dotaz);
113 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>';
114 echo '
115 ';
116 }
117 echo '</select>
118 </td>
119 </tr>
120 <tr>
121 <td class=text valign=top>Komentář:</td><td colspan=3><textarea class=fieldthin name="komentar" rows=4 cols=100></textarea></td>
122 </tr>
123</table>
124<br><br>
125<input class=field type="submit" name="OK" value="&nbsp;přidat majetek&nbsp;">
126</form>
127';
128}
129else
130{
131 
132$test=MySQL_Query("SELECT MAX(id) FROM majetek");
133$test=MySQL_Fetch_Array($test);
134$id=$test["MAX(id)"];
135$id++;
136 
137$result = MySQL_Query("INSERT INTO majetek VALUES ('$id','$clen','$adresa','$zarizeni','$finance','$spotreba','$soucast','$scislo','$komentar','$mac')");
138 
139if (!$result) {
140echo "<br><b>Výsledek : ".mysql_error()."</b>";
141} else {
142echo "<br><b>Majetek uživatele ".id_to_name($clen)." byla úspěšně vložen!</b>";
143}
144 
145echo '
146<br><br>
147<img src=images/arrow.jpg>&nbsp;<a href="javascript:history.go(-2)" class=odkaz>zpět</a>
148<img src=images/arrow.jpg>&nbsp;<a href="majetek.php" class=odkaz>zpět na majetek</a>
149';
150}
151MySQL_Close($spojeni);
152?>
153</body>
154</html>

Powered by WebSVN 2.2.1