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 - Finance </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 | | | |
18 | | | |
19 | | | echo ' |
20 | | | <center>'; |
21 | | | |
22 | | | if(!@$show) $show="all"; |
23 | | | if(!@$order) $order="prijmeni"; |
24 | | | if(!@$platba) $platba="vsechno"; |
25 | | | if(!@$pokladna) $pokladna="vsechno"; |
26 | | | if(!@$dodavatel) $dodavatel="vsechno"; |
27 | | | if(!@$rok) $rok="vsechno"; |
28 | | | |
29 | | | #vybrani default trideni |
30 | | | if($platba=="vsechno") { |
31 | | | $condition = ""; |
32 | | | } else { |
33 | | | $condition = "AND f.platba=$platba"; |
34 | | | } |
35 | | | |
36 | | | if($pokladna=="vsechno") { |
37 | | | $condition .= ""; |
38 | | | } else { |
39 | | | $condition .= " AND f.pokladna=$pokladna"; |
40 | | | } |
41 | | | |
42 | | | if($dodavatel=="vsechno") { |
43 | | | $condition .= ""; |
44 | | | } else { |
45 | | | $condition .= " AND f.dodavatel=$dodavatel"; |
46 | | | } |
47 | | | |
48 | | | if($rok=="vsechno") { |
49 | | | $condition .= ""; |
50 | | | } else { |
51 | | | $condition .= " AND YEAR(f.datum)=$rok"; |
52 | | | } |
53 | | | |
54 | | | if(!@$show) $show="all"; |
55 | | | if(!@$order) $order="prijmeni"; |
56 | | | if($show!="all") { |
57 | | | # $where="WHERE active BETWEEN 0 AND 1"; |
58 | | | $where="WHERE active IN (1) $condition"; |
59 | | | echo '<b>Seznam příspěvků aktivních uživatelů:</b> <a href="finance.php?show=all&pokladna='.$pokladna.'&order='.$order.'&platba='.$platba.'" class=odkaz>zobrazit vše</a>'; |
60 | | | } else { |
61 | | | $where="WHERE active IN (0,1) $condition"; |
62 | | | echo '<b>Seznam příspěvků všech uživatelů:</b> <a href="finance.php?show=active&pokladna='.$pokladna.'&order='.$order.'&platba='.$platba.'" class=odkaz>zobrazit pouze aktivní</a>'; |
63 | | | } |
64 | | | |
65 | | | echo "<br>"; |
66 | | | #tisk datumu plateb |
67 | | | echo "Rok : "; |
68 | | | $dotaz=MySQL_Query("SELECT DISTINCT YEAR(datum) from finance ORDER BY datum"); |
69 | | | $count=MySQL_Num_Rows($dotaz); |
70 | | | $count++; |
71 | | | for ($i=1;$i<$count;$i++) |
72 | | | { |
73 | | | $radek=MySQL_Fetch_Array($dotaz); |
74 | | | echo "<a href=\"finance.php?show=$show&pokladna=$pokladna&dodavatel=$dodavatel&platba=$platba&rok=".$radek["YEAR(datum)"]."&order=$order\">".$radek["YEAR(datum)"].'</a> * '; |
75 | | | echo ' |
76 | | | '; |
77 | | | } |
78 | | | #dotisk posledni volby pro vsechny roky |
79 | | | echo "<a href=\"finance.php?show=$show&pokladna=$pokladna&dodavatel=$dodavatel&platba=$platba&rok=vsechno&order=$order\">všechno</a>"; |
80 | | | echo ' |
81 | | | '; |
82 | | | |
83 | | | echo "<br>"; |
84 | | | #tisk vsech moznosti plateb |
85 | | | echo "Platby : "; |
86 | | | $dotaz=MySQL_Query("SELECT * from platby ORDER BY id"); |
87 | | | $count=MySQL_Num_Rows($dotaz); |
88 | | | $count++; |
89 | | | for ($i=1;$i<$count;$i++) |
90 | | | { |
91 | | | $radek=MySQL_Fetch_Array($dotaz); |
92 | | | echo "<a href=\"finance.php?show=$show&pokladna=$pokladna&dodavatel=$dodavatel&rok=$rok&platba=".$radek["id"]."&order=$order\">".$radek["nazev"].'</a> * '; |
93 | | | echo ' |
94 | | | '; |
95 | | | } |
96 | | | #dotisk posledni volby pro vsechny platby |
97 | | | echo "<a href=\"finance.php?show=$show&pokladna=$pokladna&dodavatel=$dodavatel&rok=$rok&platba=vsechno&order=$order\">všechno</a>"; |
98 | | | echo ' |
99 | | | '; |
100 | | | |
101 | | | echo "<br>"; |
102 | | | #tisk vsech moznosti dodavatelu |
103 | | | echo "Dodavatele : "; |
104 | | | $dotaz=MySQL_Query("SELECT * from dodavatele ORDER BY id"); |
105 | | | $count=MySQL_Num_Rows($dotaz); |
106 | | | $count++; |
107 | | | for ($i=1;$i<$count;$i++) |
108 | | | { |
109 | | | $radek=MySQL_Fetch_Array($dotaz); |
110 | | | echo "<a href=\"finance.php?show=$show&platba=$platba&rok=$rok&pokladna=$pokladna&dodavatel=".$radek["id"]."&order=$order\">".$radek["nazev"].'</a> * '; |
111 | | | echo ' |
112 | | | '; |
113 | | | } |
114 | | | #dotisk posledni volby pro vsechny dodavatele |
115 | | | echo "<a href=\"finance.php?show=$show&pokladna=$pokladna&dodavatel=vsechno&rok=$rok&platba=$platba&order=$order\">všechno</a>"; |
116 | | | echo ' |
117 | | | '; |
118 | | | |
119 | | | echo "<br>"; |
120 | | | #tisk vsech moznosti pokladen |
121 | | | echo "Pokladny : "; |
122 | | | $dotaz=MySQL_Query("SELECT * from pokladny ORDER BY id"); |
123 | | | $count=MySQL_Num_Rows($dotaz); |
124 | | | $count++; |
125 | | | for ($i=1;$i<$count;$i++) |
126 | | | { |
127 | | | $radek=MySQL_Fetch_Array($dotaz); |
128 | | | echo "<a href=\"finance.php?show=$show&platba=$platba&dodavatel=$dodavatel&rok=$rok&pokladna=".$radek["id"]."&order=$order\">".$radek["nazev"].'</a> * '; |
129 | | | echo ' |
130 | | | '; |
131 | | | } |
132 | | | #dotisk posledni volby pro vsechny pokladny |
133 | | | echo "<a href=\"finance.php?show=$show&pokladna=vsechno&dodavatel=$dodavatel&rok=$rok&platba=$platba&order=$order\">všechno</a>"; |
134 | | | echo ' |
135 | | | '; |
136 | | | |
137 | | | #finalni dotaz do databaze pred vypisem zvolene sestavy |
138 | | | $string=MySQL_Query("SELECT c.id as cid, c.*, f.id as fid, f.*, p.id as pid, p.* |
139 | | | FROM (cleni c LEFT JOIN finance f ON c.id = f.clen) |
140 | | | LEFT JOIN platby p ON f.platba = p.id $where ORDER BY $order"); |
141 | | | |
142 | | | echo ' |
143 | | | |
144 | | | <table width=100% cellspacing=1> |
145 | | | <tr> |
146 | | | <td bgcolor=#73BE1E> |
147 | | | <table cellspacing=0 cellpadding=0 width=100%> |
148 | | | <tr> |
149 | | | <td bgcolor=#FFFFFF> </td> |
150 | | | <td bgcolor=#FFFFFF class=text> |
151 | | | <a title="seřadit podle ID" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=cid">ID</a> |
152 | | | </td> |
153 | | | <td bgcolor=#FFFFFF class=text> |
154 | | | <a title="seřadit podle jména" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=jmeno">Jméno</a> |
155 | | | </td> |
156 | | | <td bgcolor=#FFFFFF class=text> |
157 | | | <a title="seřadit podle příjmení" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=prijmeni">Příjmení:</a> |
158 | | | </td> |
159 | | | <td bgcolor=#FFFFFF class=text width=80> |
160 | | | <a title="seřadit podle přezdívky" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=prezdivka">Přezdívka:</a> |
161 | | | </td> |
162 | | | <td bgcolor=#FFFFFF class=text width=80> |
163 | | | <a title="seřadit podle var.symb." class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=vs">v.s.:</a> |
164 | | | </td> |
165 | | | <td bgcolor=#FFFFFF class=text> |
166 | | | <a title="seřadit podle pokladny" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=pokladna">Pokladna</a> |
167 | | | </td> |
168 | | | <td bgcolor=#FFFFFF class=text> |
169 | | | <a title="seřadit podle čísla účtenky" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=uctenka">Účtenka</a> |
170 | | | </td> |
171 | | | <td bgcolor=#FFFFFF class=text> |
172 | | | <a title="seřadit podle komentáře" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=komentar">Komentář</a> |
173 | | | </td> |
174 | | | <td bgcolor=#FFFFFF class=text> |
175 | | | <a title="seřadit podle dodavatele" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=dodavatel">Dodavatel</a> |
176 | | | </td> |
177 | | | <td bgcolor=#FFFFFF class=text> |
178 | | | <a title="seřadit podle data" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=datum">Datum</a> |
179 | | | </td> |
180 | | | <td bgcolor=#FFFFFF class=text> |
181 | | | <a title="seřadit podle hodnoty" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=hodnota">Hodnota</a> |
182 | | | </td> |
183 | | | <td bgcolor=#FFFFFF class=text> |
184 | | | <a title="seřadit podle typu plateb" class=odkaz href="finance.php?show='.$show.'&pokladna='.$pokladna.'&dodavatel='.$dodavatel.'&rok='.$rok.'&platba='.$platba.'&order=platba">Platba</a> |
185 | | | </td> |
186 | | | </td> |
187 | | | <td bgcolor=#FFFFFF class=text> |
188 | | | Celkem |
189 | | | </td> |
190 | | | </tr> |
191 | | | '; |
192 | | | |
193 | | | ####################################################################################### |
194 | | | ####################################################################################### |
195 | | | |
196 | | | $color=1; |
197 | | | $celkem=0; |
198 | | | $castkacelkem=0; |
199 | | | $prijmy=0; |
200 | | | $vydaje=0; |
201 | | | |
202 | | | while($vysledek=MySQL_Fetch_Array($string)) |
203 | | | { |
204 | | | $celkem++; |
205 | | | if($color==0) |
206 | | | { |
207 | | | $color=1; |
208 | | | $barva="#E6E4E4"; |
209 | | | } |
210 | | | else |
211 | | | { |
212 | | | $color=0; |
213 | | | $barva="#FFFFFF"; |
214 | | | } |
215 | | | if($vysledek["id"]<1000) |
216 | | | { |
217 | | | $dot="lan.bmp"; |
218 | | | $alt="LAN Jablonka"; |
219 | | | } |
220 | | | else |
221 | | | { |
222 | | | if($vysledek["id"]==1000) |
223 | | | { |
224 | | | $dot="apy.bmp"; |
225 | | | $alt="AP Yenik"; |
226 | | | } |
227 | | | if($vysledek["id"]==1001) |
228 | | | { |
229 | | | $dot="apj.bmp"; |
230 | | | $alt="AP Jablonecká"; |
231 | | | } |
232 | | | } |
233 | | | |
234 | | | $icons=""; |
235 | | | if($show=="all" && $vysledek["active"]==2) $icons=$icons.'<img title="Čekatel" src="images/actv.gif"> '; |
236 | | | if($show=="all" && $vysledek["active"]==1) $icons=$icons.'<img title="Člen" src="images/actv.gif"> '; |
237 | | | if($show=="all" && $vysledek["active"]==0) $icons=$icons.'<img title="Pasivní" src="images/passv.gif"> '; |
238 | | | if($vysledek["finance"]==1) $icons=$icons.'<img title="Finance" src="images/dolar.gif"> '; |
239 | | | if($vysledek["internet"]==1) $icons=$icons.'<img title="Internet" src="images/net.gif"> '; |
240 | | | if($vysledek["energy"]==1) $icons=$icons.'<img title="Elektřina sleva" src="images/energysleva.gif"> '; |
241 | | | if($vysledek["energy"]==2) $icons=$icons.'<img title="Elektřina" src="images/energy.gif"> '; |
242 | | | echo ' |
243 | | | <tr> |
244 | | | <td bgcolor='.$barva.' class=text> <a class="odkaz" |
245 | | | target="_self" href="clen.php?clen='.$vysledek["cid"].'"><img src="images/'.$dot.'" title="'.$alt.'" border=0></a> |
246 | | | </td> |
247 | | | <td bgcolor='.$barva.' class="text"><a class="odkaz" target="_self" href="edit_user.php?id='.$vysledek["cid"].'">'.$vysledek["cid"].'</a></td> |
248 | | | <td bgcolor='.$barva.' class="text">'.$vysledek["jmeno"].'</td> |
249 | | | <td bgcolor='.$barva.' class="text">'.$vysledek["prijmeni"].'</td> |
250 | | | <td bgcolor='.$barva.' class="text">'.$vysledek["prezdivka"].'</td> |
251 | | | |
252 | | | <td bgcolor='.$barva.' class="text">'.$vysledek["vs"].'</td> |
253 | | | <td bgcolor='.$barva.' class="text">';echo id_to_pokladna($vysledek["pokladna"]);echo '</td> |
254 | | | '; |
255 | | | if ($pokladna==3) |
256 | | | { $uctenka=$celkem; |
257 | | | } else |
258 | | | { $uctenka=$vysledek["uctenka"]; |
259 | | | } |
260 | | | echo ' |
261 | | | <td bgcolor='.$barva.' class="text">'.$uctenka.'</td> |
262 | | | <td bgcolor='.$barva.' class="text">'.$vysledek["komentar"].'</td> |
263 | | | <td bgcolor='.$barva.' class="text">';echo id_to_dodavatel($vysledek["dodavatel"]);echo '</td> |
264 | | | |
265 | | | <td bgcolor='.$barva.' class="text"> |
266 | | | <a class="odkaz" target="_self" href="add_platba.php?clen='.$vysledek["cid"].'&pokladna='.$vysledek["pokladna"].'&uctenka='.$vysledek["uctenka"].'&platba='.$vysledek["platba"].'&dodavatel='.$vysledek["dodavatel"].'">+</a> |
267 | | | '; |
268 | | | |
269 | | | if(!@$vysledek["datum"]) |
270 | | | { |
271 | | | $datum=""; |
272 | | | } else |
273 | | | { |
274 | | | $datum=sql2datum($vysledek["datum"]); |
275 | | | } |
276 | | | |
277 | | | $hodnota=str_replace(",",".",$vysledek["hodnota"]); |
278 | | | $castkacelkem=$castkacelkem+$hodnota; |
279 | | | if ($castkacelkem>0) |
280 | | | { $castkacelkemhtml=$castkacelkem; |
281 | | | } else |
282 | | | { $castkacelkemhtml="<font color=red>".$castkacelkem."</font>"; |
283 | | | } |
284 | | | |
285 | | | echo ' |
286 | | | |
287 | | | <a class="odkaz" target="_self" href="edit_platba.php?id='.$vysledek["fid"].'">'.$datum.'</a> |
288 | | | </td> |
289 | | | <td bgcolor='.$barva.' class="text">'.$vysledek["hodnota"].'</td> |
290 | | | <td bgcolor='.$barva.' class="text">'.$vysledek["nazev"].'</td> |
291 | | | <td bgcolor='.$barva.' class="text">'.$castkacelkemhtml.'</td> |
292 | | | <td bgcolor='.$barva.'></td> |
293 | | | </tr> |
294 | | | '; |
295 | | | if ($hodnota>0) |
296 | | | { $prijmy=$prijmy+$hodnota; |
297 | | | } else |
298 | | | { $vydaje=$vydaje+$hodnota; |
299 | | | } |
300 | | | Next($vysledek); |
301 | | | } |
302 | | | |
303 | | | echo ' |
304 | | | </table></tr></td></table></center> |
305 | | | <br> |
306 | | | Celkem zobrazeno '.$celkem.' záznamů.<br> |
307 | | | Součet příjmů : '.$prijmy.'<br> |
308 | | | Součet výdajů : '.$vydaje.' <br> |
309 | | | Celková částka zobrazených záznamů je '.$castkacelkem.'Kč |
310 | | | '; |
311 | | | ?> |
312 | | | </body> |
313 | | | </html> |