1 | 2 | simandl | <!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 - Editace majetku</title> |
7 | | | </head> |
8 | | | <link rel="stylesheet" type="text/css" href="style.css"> |
9 | | | </head> |
10 | | | <body topmargin=0 leftmargin=10> |
11 | | | <? |
12 | | | include("header.htm"); |
13 | | | require('grab_globals.lib.php'); |
14 | | | include ("fce.php"); |
15 | | | $spojeni = MySQL_Connect($db_host, $db_user, $db_pass); |
16 | | | MySQL_Select_DB($db_name); |
17 | | | $aktualnidatum=date("d.m.Y"); |
18 | | | $aktualnirok=date("Y"); |
19 | | | |
20 | | | if(!@$action) |
21 | | | { |
22 | | | $dbmajetek=MySQL_Query("SELECT * from majetek WHERE id=$id"); |
23 | | | $dbmajetek=MySQL_Fetch_Array($dbmajetek); |
24 | | | |
25 | | | $clen=$dbmajetek["clen"]; |
26 | | | |
27 | | | echo ' |
28 | | | <b>Editace majetku (id='.$id.') uživatele '.id_to_name($dbmajetek["clen"]).':</b><br> |
29 | | | |
30 | | | <form action="edit_majetek.php?action=zapis" method=POST> |
31 | | | <br> |
32 | | | <table> |
33 | | | <tr> |
34 | | | <td class=text>Člen:</td><td colspan=1> |
35 | | | <select class=field name="clen">'."\n"; |
36 | | | #vypis vsech moznosti a predvybrani podle clena |
37 | | | $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"); |
38 | | | while($vysledek=MySQL_Fetch_Array($string)) |
39 | | | { |
40 | | | echo '<option '; if($clen==$vysledek["cid"]){ echo 'selected';} echo' value='.$vysledek["cid"].'>'.$vysledek["prijmeni"]." ".$vysledek["jmeno"]." ".$vysledek["ip"]." ".$vysledek["vs"].'</option>'."\n"; |
41 | | | } |
42 | | | echo ' |
43 | | | </select> |
44 | | | </td> |
45 | | | <td class=text>Adresa:</td><td colspan=3> |
46 | | | <select class=field name="adresa">'."\n"; |
47 | | | #vypis vsech moznosti a predvybrani podle clena |
48 | | | $string=MySQL_Query("SELECT * FROM adresy WHERE clen=$clen ORDER BY id"); |
49 | | | while($vysledek=MySQL_Fetch_Array($string)) |
50 | | | { |
51 | | | echo '<option '; if($dbmajetek["adresa"]==$vysledek["id"]){ echo 'selected';} echo' value='.$vysledek["id"].'>'.$vysledek["ulice"]." ".$vysledek["cp"]." ".$vysledek["byt"].'</option>'."\n"; |
52 | | | } |
53 | | | echo ' |
54 | | | </select> |
55 | | | </td> |
56 | | | <td class=text><a href=del_majetek.php?id='.$id.'>Smazat tento majetek!</a></td> |
57 | | | </tr> |
58 | | | |
59 | | | <tr> <td> <hr> </td> </tr> |
60 | | | |
61 | | | <tr> |
62 | | | <td class=text>Zařízení:</td> |
63 | | | <td> |
64 | | | <select class=field name="zarizeni">'; |
65 | | | $dotaz=MySQL_Query("SELECT * from zarizeni ORDER BY id"); |
66 | | | $count=MySQL_Num_Rows($dotaz); |
67 | | | $count++; |
68 | | | for ($i=1;$i<$count;$i++) |
69 | | | { |
70 | | | $radek=MySQL_Fetch_Array($dotaz); |
71 | | | echo '<option '; if($dbmajetek["zarizeni"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
72 | | | echo ' |
73 | | | '; |
74 | | | Next($string); |
75 | | | } |
76 | | | echo '</select> |
77 | | | </td> |
78 | | | </tr> |
79 | | | <tr> |
80 | | | <td class=text>Sériové číslo:</td><td><input class=field name="scislo" type="text" value="'.$dbmajetek["scislo"].'" size=35></td> |
81 | | | <td class=text>Spotřeba [W]:</td><td><input class=field name="spotreba" type="text" value="'.$dbmajetek["spotreba"].'" size=15></td> |
82 | | | </tr> |
83 | | | <tr> |
84 | | | <td class=text>MAC:</td><td><input class=field name="mac" type="text" value="'.$dbmajetek["mac"].'" size=35></td> |
85 | | | </tr> |
86 | | | |
87 | | | <tr> <td> <hr> </td> </tr> |
88 | | | |
89 | | | <tr> |
90 | | | <td class=text>Finance(účtenka):</td> |
91 | | | <td colspan=3> |
92 | | | <select class=field name="finance">'; |
93 | | | $dotaz=MySQL_Query("SELECT * from finance WHERE platba=9 ORDER BY datum"); |
94 | | | $count=MySQL_Num_Rows($dotaz); |
95 | | | $count++; |
96 | | | echo '<option value=null>není</option>'; |
97 | | | for ($i=1;$i<$count;$i++) |
98 | | | { |
99 | | | $radek=MySQL_Fetch_Array($dotaz); |
100 | | | echo '<option '; if($dbmajetek["finance"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".sql2datum($radek["datum"])." ".substr($radek["komentar"],0,70).'</option>'; |
101 | | | echo ' |
102 | | | '; |
103 | | | Next($string); |
104 | | | } |
105 | | | echo '</select> |
106 | | | </td> |
107 | | | |
108 | | | </tr> |
109 | | | <tr> |
110 | | | |
111 | | | <td class=text>Součást:</td> |
112 | | | <td> |
113 | | | <select class=field name="soucast">'; |
114 | | | $dotaz=MySQL_Query("SELECT * from majetek ORDER BY id"); |
115 | | | $count=MySQL_Num_Rows($dotaz); |
116 | | | $count++; |
117 | | | echo '<option value=null>není</option>'; |
118 | | | for ($i=1;$i<$count;$i++) |
119 | | | { |
120 | | | $radek=MySQL_Fetch_Array($dotaz); |
121 | | | echo '<option '; if($dbmajetek["soucast"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".substr(id_to_majetek($radek["id"])." ".$radek["komentar"],0,70).'</option>'; |
122 | | | echo ' |
123 | | | '; |
124 | | | Next($string); |
125 | | | } |
126 | | | echo '</select> |
127 | | | </td> |
128 | | | </tr> |
129 | | | <tr> |
130 | | | <td class=text valign=top>Komentář:</td><td colspan=3><textarea class=fieldthin name="komentar" rows=4 cols=100>'.$dbmajetek["komentar"].'</textarea></td> |
131 | | | </tr> |
132 | | | </table> |
133 | | | <br><br> |
134 | | | <input class=field type="submit" name="OK" value=" Uložit změny "> |
135 | | | <input name="id" type="hidden" value="'.$id.'"> |
136 | | | </form> |
137 | | | <br> |
138 | | | Úkony spojené s tímto majetkem: |
139 | | | <br> |
140 | | | '; |
141 | | | |
142 | | | $ukony=MySQL_Query("SELECT * FROM ukony WHERE majetek=$id ORDER BY datum ASC"); |
143 | | | while ($ukon=MySQL_Fetch_Array($ukony)) { |
144 | | | echo '<a href="edit_ukon.php?id='.$ukon["id"].'">'.id_to_ukon($ukon["id"]).'</a><br>'; |
145 | | | } |
146 | | | |
147 | | | echo ' |
148 | | | <br> |
149 | | | <br> |
150 | | | <a href="add_ukon.php?clen='.$clen.'&majetek='.$id.'">Přidat úkon k tomuto majetku</a> |
151 | | | '; |
152 | | | } |
153 | | | else |
154 | | | { |
155 | | | |
156 | | | $result = MySQL_Query("UPDATE majetek SET clen='$clen',adresa='$adresa',zarizeni='$zarizeni',finance='$finance',spotreba='$spotreba',soucast='$soucast',scislo='$scislo',komentar='$komentar',mac='$mac' WHERE id='$id'"); |
157 | | | |
158 | | | if (!$result) { |
159 | | | echo "<br><b>Výsledek : ".mysql_error()."</b>"; |
160 | | | } else { |
161 | | | echo "<br><b>Majetek uživatele ".id_to_name($clen)." byl úspěšně upraven!</b>"; |
162 | | | } |
163 | | | |
164 | | | echo ' |
165 | | | <br><br> |
166 | | | <img src=images/arrow.jpg> <a href="javascript:history.go(-2)" class=odkaz>zpět</a> |
167 | | | <img src=images/arrow.jpg> <a href="majetek.php" class=odkaz>zpět na majetek</a> |
168 | | | '; |
169 | | | } |
170 | | | MySQL_Close($spojeni); |
171 | | | ?> |
172 | | | </body> |
173 | | | </html> |