1 | 6 | 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 fio.cz</title> |
7 | | | </head> |
8 | | | <link rel="stylesheet" type="text/css" href="style.css"> |
9 | | | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> |
10 | | | </head> |
11 | | | <body topmargin=0 leftmargin=10> |
12 | | | <? |
13 | | | require('grab_globals.lib.php'); |
14 | | | include ("header.htm"); |
15 | | | include ("fce.php"); |
16 | | | $spojeni = MySQL_Connect($db_host, $db_user, $db_pass); |
17 | | | MySQL_Select_DB($db_name); |
18 | | | |
19 | | | if(!@$action) $action=""; |
20 | | | |
21 | | | ########################################################################################### |
22 | | | ########################################################################################### |
23 | | | if ($action=="") |
24 | | | { |
25 | | | $message=""; |
26 | | | exec('wget -q -O - https://www.fio.cz/scgi-bin/hermes/dz-transparent.cgi?ID_ucet=2600031002',$vypis); |
27 | | | foreach($vypis as $s) $message.=$s."\n"; |
28 | | | |
29 | | | $message=str_replace (" class=\"odd_row\"", "", $message); |
30 | | | $message=str_replace (" class=\"even_row\"", "", $message); |
31 | | | $message=str_replace (" class=\"t\"", "", $message); |
32 | | | $message=str_replace (" class=\"tr-r\"", "", $message); |
33 | | | $message=str_replace (" class=\"tr\"", "", $message); |
34 | | | $message=str_replace (" class=\"t-w\"", "", $message); |
35 | | | |
36 | | | $message=stristr($message, "<td>Objem</td>"); |
37 | | | $message=stristr($message, "<tr>"); |
38 | | | #klasicke ukonceni ale zatim se nepouzije aby se odfiltrovalo to co bylo pred3.1.2007 |
39 | | | # $konec=strpos($message,"</tbody>"); |
40 | | | #odfiltrovani vseho pred 4.1.2007 - uz to je v databazi a tak by to rusilo |
41 | | | # $konec=strpos($message,"2007-01-03"); |
42 | | | # $message=substr($message,0,$konec-1); |
43 | | | |
44 | | | #echo $message; |
45 | | | |
46 | | | #echo $message; |
47 | | | #count se o jednicku zmensi aby se nevypisoval posledni useknuty pohyb |
48 | | | $count=substr_count($message,"<tr>")-1; |
49 | | | |
50 | | | $output=spliti("<tr>",$message); |
51 | | | echo ' |
52 | | | <table width=100% cellspacing=1> |
53 | | | <tr> |
54 | | | <td bgcolor=#73BE1E> |
55 | | | |
56 | | | <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="100%" HEIGHT="" BGCOLOR="#FFFFFF" align="CENTER"> |
57 | | | <TR> |
58 | | | <td></td> |
59 | | | <TD class=text>DATUM</TD> |
60 | | | <TD class=text>OBJEM</TD> |
61 | | | <TD class=text>TYP</TD> |
62 | | | <TD class=text>KONSTANTNÍ SYMBOL</TD> |
63 | | | <TD class=text>VARIABILNÍ SYMBOL</TD> |
64 | | | <TD class=text>SPECIFICKÝ SYMBOL</TD> |
65 | | | <TD class=text>IDENTIFIKACE</TD> |
66 | | | <TD class=text>ZPRÁVA</TD> |
67 | | | <td></td> |
68 | | | </TR></td></tr> |
69 | | | <tr height=2> |
70 | | | <td colspan=10 bgcolor=#000000></td> |
71 | | | </tr>'; |
72 | | | |
73 | | | for ($i=1;$i<=$count;$i++) |
74 | | | { |
75 | | | #posunuti za poradove cislo |
76 | | | #$output[$i]=stristr($output[$i], "</td>"); |
77 | | | |
78 | | | $porovnani=sha1($output[$i]); |
79 | | | |
80 | | | $vysledek=MySQL_Query("SELECT * FROM ekonto WHERE value='$porovnani'"); |
81 | | | $pocet=MySQL_Num_Rows($vysledek); |
82 | | | |
83 | | | if ($pocet==0) |
84 | | | { #jde o novy pohyb na konte |
85 | | | $color="#E7FFF1"; |
86 | | | $msg=str_replace("<td", "<TD valign=top bgcolor=#E7FFF1 class=whitel", $output[$i]); |
87 | | | $msg=str_replace("</tr>", "", $msg); |
88 | | | } |
89 | | | else |
90 | | | { #jde o jiz zapsany pohyb na konte |
91 | | | $color="#e0e0e0"; |
92 | | | $msg=str_replace("<td", "<TD valign=top bgcolor=#e0e0e0 class=whitel", $output[$i]); |
93 | | | $msg=str_replace("</tr>", "", $msg); |
94 | | | } |
95 | | | |
96 | | | echo '<tr><td bgcolor='.$color.'>'.$msg; |
97 | | | |
98 | | | echo '<td bgcolor='.$color.'>'; |
99 | | | if ($pocet==0) |
100 | | | { |
101 | | | echo ' |
102 | | | <form action="fio.php?action=synchro" method=POST> |
103 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
104 | | | <input class=field value=" synchronizovat " type="submit"> |
105 | | | </form> |
106 | | | <form action="fio.php?action=zapsat&flag=0" method=POST> |
107 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
108 | | | <input name="textik" type="hidden" value="'.$output[$i].'"> |
109 | | | <input class=field value="zapsat transakci" type="submit"> |
110 | | | </form>'; |
111 | | | } |
112 | | | else |
113 | | | { |
114 | | | $vysledek=MySQL_Fetch_Array($vysledek); |
115 | | | if ($vysledek["id"]=="-1") |
116 | | | { |
117 | | | echo ' |
118 | | | <form action="fio.php?action=zapsat&flag=1" method=POST> |
119 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
120 | | | <input name="textik" type="hidden" value="'.$output[$i].'"> |
121 | | | <input class=field value="zapsat transakci" type="submit"> |
122 | | | </form> |
123 | | | <form action="fio.php?action=reset" method=POST> |
124 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
125 | | | <input class=field value="resetovat zaznam" type="submit"> |
126 | | | </form> |
127 | | | |
128 | | | '; |
129 | | | } |
130 | | | else |
131 | | | { |
132 | | | $iid=$vysledek["id"]; |
133 | | | $tmp=MySQL_Query("SELECT * FROM finance WHERE id='$iid'"); |
134 | | | $tmp=MySQL_Fetch_Array($tmp); |
135 | | | |
136 | | | echo ' |
137 | | | <form action="fio.php?action=reset" method=POST> |
138 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
139 | | | <input class=field value="resetovat zaznam" type="submit"> |
140 | | | </form> |
141 | | | </td> |
142 | | | <tr><td bgcolor='.$color.' colspan=10 class=text> |
143 | | | Zapsáno pro: <b>'.id_to_name($tmp["clen"]).'</b> v.s. <b>'.id_to_vs($tmp["clen"]).'</b> dne <b>'.sql2datum($vysledek["datum"]).'</b> |
144 | | | jako <b>'.id_to_platba($tmp["platba"]).'</b> částka: <b>'.$tmp["hodnota"].'</b> |
145 | | | |
146 | | | <a href="clen.php?clen='.$tmp["clen"].'" class=odkaz>zobrazit přehled o uživateli</a> |
147 | | | </tr> |
148 | | | '; |
149 | | | } |
150 | | | } |
151 | | | echo ' |
152 | | | </td></tr> |
153 | | | <tr height=2> |
154 | | | <td colspan=10 bgcolor=#000000></td> |
155 | | | </tr> |
156 | | | '; |
157 | | | } |
158 | | | echo ' |
159 | | | </table> |
160 | | | </td></table> |
161 | | | '; |
162 | | | } |
163 | | | |
164 | | | ########################################################################################### |
165 | | | ########################################################################################### |
166 | | | if ($action=="synchro") |
167 | | | { |
168 | | | #MySQL_Query("INSERT INTO ekonto VALUES ('$stuff','-1','')"); |
169 | | | echo '<br><img src=images/arrow.jpg> Synchronizováno... <a href="fio.php" class=odkaz>ZPĚT</a>'; |
170 | | | } |
171 | | | |
172 | | | ########################################################################################### |
173 | | | ########################################################################################### |
174 | | | if ($action=="zapsat") |
175 | | | { |
176 | | | #pokud uz byl tento zaznam ulozen neni dovoleno jeho dalsi uziti |
177 | | | $vysledek=MySQL_Query("SELECT * FROM ekonto WHERE value='$stuff'"); |
178 | | | $pocet=MySQL_Num_Rows($vysledek); |
179 | | | |
180 | | | if ($pocet!=0) |
181 | | | { |
182 | | | echo "V databázi je už záznam s tímto otiskem!<br><br>"; |
183 | | | echo '<img src=images/arrow.jpg> <a href="fio.php" class=odkaz>Reload</a> <a href="javascript:history.go(-1)" class=odkaz>zpět</a>'; |
184 | | | } |
185 | | | else |
186 | | | { |
187 | | | |
188 | | | echo ' |
189 | | | <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="100%" HEIGHT="" BGCOLOR="#FFFFFF" align="CENTER"> |
190 | | | <TR> |
191 | | | <TD class=text>DATUM</TD> |
192 | | | <TD class=text>OBJEM</TD> |
193 | | | <TD class=text>TYP</TD> |
194 | | | <TD class=text>KONSTANTNÍ SYMBOL</TD> |
195 | | | <TD class=text>VARIABILNÍ SYMBOL</TD> |
196 | | | <TD class=text>SPECIFICKÝ SYMBOL</TD> |
197 | | | <TD class=text>IDENTIFIKACE</TD> |
198 | | | <TD class=text>ZPRÁVA</TD> |
199 | | | </TR> <tr height=2> |
200 | | | <td colspan=8 bgcolor=#000000></td> |
201 | | | </tr> |
202 | | | '.$textik.' |
203 | | | </table>'; |
204 | | | |
205 | | | #rozdelime radek z vypisu ebanky na jednotliva pole |
206 | | | $sloupce=explode("td", $textik); |
207 | | | |
208 | | | #vyjmeme datum |
209 | | | $datumy=explode("<",$sloupce[1]); |
210 | | | $datum=str_replace (">", "", $datumy[0]); |
211 | | | $datum=str_replace ("\r", "", $datum); |
212 | | | $datum=str_replace ("\n", "", $datum); |
213 | | | $datum=str_replace (" ", "", $datum); |
214 | | | $datum=substr($datum,0,10); |
215 | | | #$datum=sql2datum($datum); |
216 | | | #echo "#".$datum."#"; |
217 | | | |
218 | | | #vyjmeme a sestavime poznamku |
219 | | | $poznamka=str_replace("<","",$sloupce[15]."\n".$sloupce[13]."\n".$sloupce[5]); |
220 | | | $poznamka=str_replace("br/>","",$poznamka); |
221 | | | $poznamka=str_replace(">","",$poznamka); |
222 | | | $poznamka=str_replace("/","",$poznamka); |
223 | | | $poznamka=str_replace(" "," ",$poznamka); |
224 | | | $poznamka=str_replace(" "," ",$poznamka); |
225 | | | $poznamka=str_replace(" "," ",$poznamka); |
226 | | | $poznamka=str_replace(" "," ",$poznamka); |
227 | | | $poznamka=str_replace("^ ","",$poznamka); |
228 | | | #echo "#".$poznamka."#"; |
229 | | | |
230 | | | #vyjmeme variabilni symbol |
231 | | | $vsy=explode("<",$sloupce[9]); |
232 | | | $vs=str_replace (">", "", $vsy[0]); |
233 | | | $vs=str_replace (" ", "", $vs); |
234 | | | $vs=str_replace ("\r", "", $vs); |
235 | | | $vs=str_replace ("\n", "", $vs); |
236 | | | #echo "#".$vs."#"; |
237 | | | |
238 | | | #vyjmeme castku |
239 | | | $hodnoty=explode("<",$sloupce[3]); |
240 | | | $hodnota=str_replace ("br />", "", $hodnoty[0]); |
241 | | | $hodnota=str_replace (" ", "", $hodnota); |
242 | | | $hodnota=str_replace (">", "", $hodnota); |
243 | | | $hodnota=str_replace ("\r", "", $hodnota); |
244 | | | $hodnota=str_replace ("\n", "", $hodnota); |
245 | | | #echo "#".$sloupce[9]."#"; |
246 | | | |
247 | | | echo ' |
248 | | | |
249 | | | <form action="fio.php?action=zapis" method=POST> |
250 | | | <table> |
251 | | | <tr> |
252 | | | <td> |
253 | | | <b>Člen:</b> |
254 | | | </td> |
255 | | | <td colspan=3> |
256 | | | <select class=field name="clen">'; |
257 | | | #vypis vsech moznosti a predvybrani podle vs |
258 | | | $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 ORDER BY prijmeni"); |
259 | | | while($vysledek=MySQL_Fetch_Array($string)) |
260 | | | { |
261 | | | echo '<option '; if($vs==$vysledek["vs"]){ echo 'selected';} echo' value='.$vysledek["cid"].'>'.$vysledek["prijmeni"]." ".$vysledek["jmeno"]." ".$vysledek["ip"]." ".$vysledek["vs"].'</option>'; |
262 | | | Next($vysledek); |
263 | | | } |
264 | | | echo ' |
265 | | | </select> |
266 | | | <input name="flag" type="hidden" value="'.$flag.'"> |
267 | | | <input name="stuff" type="hidden" value="'.$stuff.'"> |
268 | | | </td> |
269 | | | </tr> |
270 | | | <tr> |
271 | | | <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.$datum.'" size=15></td> |
272 | | | <td class=text>Hodnota:</td><td><input class=field name="hodnota" type="text" value="'.$hodnota.'" size=15></td> |
273 | | | </tr> |
274 | | | <tr> |
275 | | | <td class=text>Účtenka:</td><td><input class=field name="uctenka" type="text" value="0" size=15></td> |
276 | | | <td class=text>Pokladna:</td><td> |
277 | | | <select class=field name="pokladna">'; |
278 | | | $dotaz=MySQL_Query("SELECT * from pokladny ORDER BY id"); |
279 | | | $count=MySQL_Num_Rows($dotaz); |
280 | | | $count++; |
281 | | | for ($i=1;$i<$count;$i++) |
282 | | | { |
283 | | | $radek=MySQL_Fetch_Array($dotaz); |
284 | | | echo '<option '; if(4==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
285 | | | echo ' |
286 | | | '; |
287 | | | Next($string); |
288 | | | } |
289 | | | echo '</select> |
290 | | | </td> |
291 | | | </tr> |
292 | | | <tr> |
293 | | | <td class=text>Typ platby:</td> |
294 | | | <td> |
295 | | | <select class=field name="platba">'; |
296 | | | #vypiseme vsechny dostupne druhy plateb a predvybereme clensky prispevek protoze je nejpravdepodobnejsi |
297 | | | $dotaz=MySQL_Query("SELECT * from platby ORDER BY id"); |
298 | | | $count=MySQL_Num_Rows($dotaz); |
299 | | | $count++; |
300 | | | for ($i=1;$i<$count;$i++) |
301 | | | { |
302 | | | $radek=MySQL_Fetch_Array($dotaz); |
303 | | | echo '<option '; if($i==2){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
304 | | | echo ' |
305 | | | '; |
306 | | | Next($string); |
307 | | | } |
308 | | | echo '</select> |
309 | | | </td> |
310 | | | <td class=text>Dodavatel:</td> |
311 | | | <td> |
312 | | | <select class=field name="dodavatel">'; |
313 | | | $dotaz=MySQL_Query("SELECT * from dodavatele ORDER BY id"); |
314 | | | $count=MySQL_Num_Rows($dotaz); |
315 | | | $count++; |
316 | | | for ($i=1;$i<$count;$i++) |
317 | | | { |
318 | | | $radek=MySQL_Fetch_Array($dotaz); |
319 | | | echo '<option '; if(@$dodavatel==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
320 | | | echo ' |
321 | | | '; |
322 | | | Next($string); |
323 | | | } |
324 | | | echo '</select> |
325 | | | </td> |
326 | | | </tr> |
327 | | | <tr> |
328 | | | <td class=text valign=top>Komentář:</td><td colspan=3><textarea class=fieldthin name="komentar" rows=3 cols=45>'.$poznamka.'</textarea></td> |
329 | | | </tr> |
330 | | | </table> |
331 | | | <br><br> |
332 | | | <input class=field type="submit" name="OK" value=" přidat transakci "> |
333 | | | </form> |
334 | | | <img src=images/arrow.jpg> <a href="javascript:history.go(-1)" class=odkaz>zpět</a> |
335 | | | '; |
336 | | | } |
337 | | | } |
338 | | | |
339 | | | ########################################################################################### |
340 | | | ########################################################################################### |
341 | | | if ($action=="zapis") |
342 | | | { |
343 | | | $test=MySQL_Query("SELECT MAX(id) FROM finance"); |
344 | | | $test=MySQL_Fetch_Array($test); |
345 | | | $id=$test["MAX(id)"]; |
346 | | | $id++; |
347 | | | $datum=datum2sql($datum); |
348 | | | $aktualnidatum=date("Y-m-d"); |
349 | | | $pokladna=4; |
350 | | | $dodavatel=0; |
351 | | | $uctenka=0; |
352 | | | MySQL_Query("INSERT INTO finance VALUES ('$id','$clen','$platba','$hodnota','$datum','$komentar','$dodavatel','$uctenka','$pokladna')"); |
353 | | | echo ' |
354 | | | <br><b>Transakce přidána uživateli '.id_to_name($clen).' v této podobě:</b><br> |
355 | | | <br>Datum: '.sql2datum($datum).'<br> |
356 | | | Částka: '.$hodnota.'<br> |
357 | | | Druh platby: '.id_to_platba($platba).'<br> |
358 | | | Poznámka: '.$komentar.' |
359 | | | <br><br> |
360 | | | <img src=images/arrow.jpg> <a href="javascript:history.go(-2)" class=odkaz>zpět</a>'; |
361 | | | if ($flag=="0") |
362 | | | { |
363 | | | MySQL_Query("INSERT INTO ekonto VALUES ('$stuff','$id','$aktualnidatum')"); |
364 | | | } |
365 | | | else |
366 | | | { |
367 | | | MySQL_Query("UPDATE ekonto SET id='$id', datum='aktualnidatum' WHERE value='$stuff'"); |
368 | | | } |
369 | | | |
370 | | | } |
371 | | | |
372 | | | ########################################################################################### |
373 | | | ########################################################################################### |
374 | | | if($action=="reset") |
375 | | | { |
376 | | | echo '<br><br> |
377 | | | Záznam bude resetován do původního stavu. Bude se tedy jevit, jako kdyby byl nový. Transakce v databázi ale zůstane. |
378 | | | Pokud ji budete chtít odstranit, musíte tak učinit ručně! |
379 | | | <br> |
380 | | | <br> |
381 | | | <img src=images/arrow.jpg> <a href="fio.php?action=resetOK&stuff='.$stuff.'" class=odkaz>Resetovat</a> |
382 | | | <br> |
383 | | | <br> |
384 | | | <img src=images/arrow.jpg> <a href="fio.php" class=odkaz>Zpět</a>'; |
385 | | | } |
386 | | | |
387 | | | ########################################################################################### |
388 | | | ########################################################################################### |
389 | | | if($action=="resetOK") |
390 | | | { |
391 | | | MySQL_Query("DELETE FROM ekonto WHERE value='$stuff'"); |
392 | | | echo '<br><br> |
393 | | | Záznam byl resetován do původního stavu. Bude se tedy jevit, jako kdyby byl nový. Transakce v databázi ale zůstane. Pokud ji chcete odstranit, musíte tak učinit ručně! |
394 | | | <br> |
395 | | | <br> |
396 | | | <img src=images/arrow.jpg> <a href="fio.php" class=odkaz>Zpět</a>'; |
397 | | | } |
398 | | | |
399 | | | MySQL_Close($spojeni); |
400 | | | ?> |