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>add úkon</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 | | | if(!@$action) |
19 | | | { |
20 | | | echo ' |
21 | | | <b>Přidání úkonu pro uživatele '.id_to_name($clen).':</b><br> |
22 | | | |
23 | | | <form action="add_ukon.php?action=zapis" method=POST> |
24 | | | <table> |
25 | | | <tr> |
26 | | | <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.$aktualnidatum.'" size=25></td> |
27 | | | </tr> |
28 | | | <tr> |
29 | | | <td class=text>Typ udalosti:</td> |
30 | | | <td> |
31 | | | <select class=field name="udalost">'; |
32 | | | $dotaz=MySQL_Query("SELECT * from udalosti ORDER BY id"); |
33 | | | $count=MySQL_Num_Rows($dotaz); |
34 | | | $count++; |
35 | | | for ($i=1;$i<$count;$i++) |
36 | | | { |
37 | | | $radek=MySQL_Fetch_Array($dotaz); |
38 | | | echo '<option value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
39 | | | Next($string); |
40 | | | } |
41 | | | echo '</select> |
42 | | | </td> |
43 | | | </tr> |
44 | | | <tr> |
45 | | | <td class=text>Předmětné IP:</td> |
46 | | | <td> |
47 | | | <select class=field name="predmet">'; |
48 | | | $dotaz=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 c.id=$clen AND i.id IS NOT NULL ORDER BY ip"); |
49 | | | $count=MySQL_Num_Rows($dotaz); |
50 | | | $count++; |
51 | | | echo '<option value=0>není</option>'; |
52 | | | for ($i=1;$i<$count;$i++) |
53 | | | { |
54 | | | $radek=MySQL_Fetch_Array($dotaz); |
55 | | | echo '<option value='.$radek["iid"].'>'.$radek["ip"].'</option>'; |
56 | | | Next($string); |
57 | | | } |
58 | | | echo '</select> |
59 | | | </td> |
60 | | | </tr> |
61 | | | <tr> |
62 | | | <td class=text>Adresa:</td> |
63 | | | <td> |
64 | | | <select class=field name="adresa">'; |
65 | | | $dotaz=MySQL_Query("SELECT * from adresy WHERE clen=$clen ORDER BY ulice,cp,byt"); |
66 | | | $count=MySQL_Num_Rows($dotaz); |
67 | | | $count++; |
68 | | | echo '<option value=0>není</option>'; |
69 | | | $nabidnutaadresa=clen_to_adresa($clen); |
70 | | | for ($i=1;$i<$count;$i++) |
71 | | | { |
72 | | | $radek=MySQL_Fetch_Array($dotaz); |
73 | | | echo '<option '; if($nabidnutaadresa==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".$radek["ulice"]." ".$radek["cp"]." byt ".$radek["byt"].'</option>'; |
74 | | | Next($string); |
75 | | | } |
76 | | | echo '</select> |
77 | | | </td> |
78 | | | </tr> |
79 | | | <tr> |
80 | | | <td class=text>Finance:</td> |
81 | | | <td> |
82 | | | <select class=field name="finance">'; |
83 | | | $dotaz=MySQL_Query("SELECT * from finance ORDER BY datum"); |
84 | | | $count=MySQL_Num_Rows($dotaz); |
85 | | | $count++; |
86 | | | echo '<option value=0>není</option>'; |
87 | | | for ($i=1;$i<$count;$i++) |
88 | | | { |
89 | | | $radek=MySQL_Fetch_Array($dotaz); |
90 | | | echo '<option value='.$radek["id"].'>'.$radek["datum"]." ".$radek["hodnota"]."Kč ".$radek["pokladna"].'</option>'; |
91 | | | Next($string); |
92 | | | } |
93 | | | echo '</select> |
94 | | | </td> |
95 | | | </tr> |
96 | | | <tr> |
97 | | | <td class=text>Majetek:</td> |
98 | | | <td> |
99 | | | <select class=field name="majetek">'; |
100 | | | $dotaz=MySQL_Query("SELECT * from majetek ORDER BY id"); |
101 | | | $count=MySQL_Num_Rows($dotaz); |
102 | | | $count++; |
103 | | | echo '<option value=0>není</option>'; |
104 | | | for ($i=1;$i<$count;$i++) |
105 | | | { |
106 | | | $radek=MySQL_Fetch_Array($dotaz); |
107 | | | echo '<option '; if($majetek==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".id_to_zarizeni($radek["zarizeni"])." ".$radek["komentar"]." ".$radek["scislo"]." ".$radek["mac"].'</option>'; |
108 | | | Next($string); |
109 | | | } |
110 | | | echo '</select> |
111 | | | </td> |
112 | | | </tr> |
113 | | | <tr> |
114 | | | <td class=text valign=top>Komentář:</td><td><textarea class=fieldthin name="komentar" rows=8 cols=25></textarea></td> |
115 | | | </tr> |
116 | | | </table> |
117 | | | <br><br> |
118 | | | <input class=field type="submit" name="OK" value=" přidat úkon "> |
119 | | | <input name="clen" type="hidden" value="'.$clen.'"> |
120 | | | |
121 | | | </form> |
122 | | | '; |
123 | | | } |
124 | | | else |
125 | | | { |
126 | | | |
127 | | | $test=MySQL_Query("SELECT MAX(id) FROM ukony"); |
128 | | | $test=MySQL_Fetch_Array($test); |
129 | | | $id=$test["MAX(id)"]; |
130 | | | $id++; |
131 | | | $datum=datum2sql($datum); |
132 | | | $result = MySQL_Query("INSERT INTO ukony VALUES ('$id','$clen','$udalost','$predmet','$datum','$komentar','$adresa','$finance','$majetek')"); |
133 | | | |
134 | | | if (!$result) { |
135 | | | echo "<br><b>Výsledek : ".mysql_error()."</b>"; |
136 | | | } else { |
137 | | | echo ' |
138 | | | <br><b>Úkon uživatele <a class="odkaz" target="_self" href="clen.php?clen='.$clen.'">'.id_to_name($clen).'</a> byl úspěšně přidán!</b> |
139 | | | '; |
140 | | | } |
141 | | | |
142 | | | echo ' |
143 | | | <br><br> |
144 | | | <img src=images/arrow.jpg> <a href="javascript:history.go(-2)" class=odkaz>zpět</a> |
145 | | | '; |
146 | | | } |
147 | | | MySQL_Close($spojeni); |
148 | | | ?> |
149 | | | </body> |
150 | | | </html> |