jablonka.czprosek.czf

is

Subversion Repositories:
[/] [trunk/] [html/] [edit_platba.php] - Blame information for rev 7

 

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 edit platba</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);
17if(!@$action)
18{
19$dbplatba=MySQL_Query("SELECT * from finance WHERE id=$id");
20$dbplatba=MySQL_Fetch_Array($dbplatba);
21 
22echo '
23<b>Editace platby '.$dbplatba["hodnota"].'Kč uživatele '.id_to_name($dbplatba["clen"]).' z '.sql2datum($dbplatba["datum"]).':</b><br>
24 
25<form action="edit_platba.php?action=zapis" method=POST>
26<br>
27<table>
28 <tr>
29 <td class=text>Člen:</td><td colspan=3>
30 <select class=field name="clen">'."\n";
31 #vypis vsech moznosti a predvybrani podle vs
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($dbplatba["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> <a href=del_platba.php?id='.$id.'>Smazat tuto platbu!</a></td>
41 </tr>
42 <tr>
43 <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.sql2datum($dbplatba["datum"]).'" size=15></td>
44 <td class=text>Hodnota:</td><td><input class=field name="hodnota" type="text" value="'.$dbplatba["hodnota"].'" size=15></td>
45 </tr>
46 <tr>
47 <td class=text>Účtenka:</td><td><input class=field name="uctenka" type="text" value="'.$dbplatba["uctenka"].'" size=15></td>
48 
49 <td class=text>Pokladna:</td><td>
50 <select class=field name="pokladna">';
51 $dotaz=MySQL_Query("SELECT * from pokladny ORDER BY id");
52 $count=MySQL_Num_Rows($dotaz);
53 $count++;
54 for ($i=1;$i<$count;$i++)
55 {
56 $radek=MySQL_Fetch_Array($dotaz);
57 echo '<option '; if($dbplatba["pokladna"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
58 echo '
59 ';
60 Next($string);
61 }
62 echo '</select>
63 </td>
64 
65 
66 </tr>
67 <tr>
68 <td class=text>Typ platby:</td>
69 <td>
70 <select class=field name="platba">';
71 $dotaz=MySQL_Query("SELECT * from platby ORDER BY id");
72 $count=MySQL_Num_Rows($dotaz);
73 $count++;
74 for ($i=1;$i<$count;$i++)
75 {
76 $radek=MySQL_Fetch_Array($dotaz);
77 echo '<option '; if($dbplatba["platba"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
78 echo '
79 ';
80 Next($string);
81 }
82 echo '</select>
83 </td>
84 <td class=text>Dodavatel:</td>
85 <td>
86 <select class=field name="dodavatel">';
87 $dotaz=MySQL_Query("SELECT * from dodavatele ORDER BY id");
88 $count=MySQL_Num_Rows($dotaz);
89 $count++;
90 for ($i=1;$i<$count;$i++)
91 {
92 $radek=MySQL_Fetch_Array($dotaz);
93 echo '<option '; if($dbplatba["dodavatel"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
94 echo '
95 ';
96 Next($string);
97 }
98 echo '</select>
99 </td>
100 </tr>
101 <tr>
102 <td class=text valign=top>Komentář:</td><td colspan=3><textarea class=fieldthin name="komentar" rows=4 cols=45>'.$dbplatba["komentar"].'</textarea></td>
103 </tr>
104</table>
105<input class=field type="submit" name="OK" value="&nbsp;uložit úpravy&nbsp;">
106<input name="id" type="hidden" value="'.$id.'">
107</form>
108';
109}
110else
111{
112 
113$datum=datum2sql($datum);
114 
115$result = MySQL_Query("UPDATE finance SET clen='$clen',platba='$platba',hodnota='$hodnota',datum='$datum',komentar='$komentar',dodavatel='$dodavatel',uctenka='$uctenka',pokladna='$pokladna' WHERE id='$id'");
116 
117if (!$result) {
118echo "<br><b>Výsledek : ".mysql_error()."</b>";
119} else {
120echo "<br><b>Platba uživatele ".id_to_name($clen)." byla úspěšně změněna!</b>";
121}
122echo '
123<br><br>
124<img src=images/arrow.jpg>&nbsp;<a href="javascript:history.go(-2)" class=odkaz>zpět</a>
125<img src=images/arrow.jpg>&nbsp;<a href="prispevky.php" class=odkaz>zpět na příspěvky</a>
126';
127}
128MySQL_Close($spojeni);
129?>
130</body>
131</html>

Powered by WebSVN 2.2.1