jablonka.czprosek.czf

is

Subversion Repositories:
[/] [trunk/] [html/] [add_platba.php] - Blame information for rev 5

 

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

Powered by WebSVN 2.2.1