1 |
<? |
2 |
|
3 |
include("inc/head.inc"); |
4 |
include("inc/prava.inc"); |
5 |
include("inc/show_bool.inc"); |
6 |
include("inc/bgcolor.inc"); |
7 |
include("inc/radio.inc"); |
8 |
include("inc/sap_org_jed.inc"); |
9 |
|
10 |
if (!isset($datum) and !isset($lokacija)) { |
11 |
|
12 |
$result = pg_Exec ($conn, " |
13 |
select datum,count(*) as nr from izvjestaji group by datum |
14 |
order by datum desc |
15 |
"); |
16 |
|
17 |
print ' |
18 |
<h1>Izvje¹taji o otvaranju raèuna</h1> |
19 |
<table border=1> |
20 |
<tr bgcolor="#e0e0f0"><th>datum izvje¹taja</th><th>broj otvorenih raèuna</th></tr> |
21 |
'; |
22 |
|
23 |
for ($k=0; $k < pg_numrows($result); $k++) { |
24 |
$arr=pg_fetch_row($result,$k); |
25 |
print "<tr".bgcolor()."><td><a href=\"$PHP_SELF?datum=".rawurlencode($arr[0])."\">$arr[0]</a></td> |
26 |
<td align=center>$arr[1]</td></tr>\n"; |
27 |
} |
28 |
|
29 |
print '</table>'; |
30 |
|
31 |
print " |
32 |
<form action=$PHP_SELF> |
33 |
<table border=0> |
34 |
<tr><td> |
35 |
Zahtjevi koji |
36 |
</td><td> |
37 |
<input type=radio name=preskoci_podesene value=1 checked>èekaju pode¹avanje<br> |
38 |
<input type=radio name=preskoci_podesene value=0>pripadaju |
39 |
</td><td> |
40 |
lokacija |
41 |
<select name=lokacija> |
42 |
"; |
43 |
|
44 |
$result = pg_Exec ($conn, "select id,naziv from lokacije where aktivna is true order by naziv"); |
45 |
for ($k=0; $k < pg_numrows($result); $k++) { |
46 |
$arr=pg_fetch_row($result,$k); |
47 |
print "<option value=$arr[0]>$arr[1]</option>\n"; |
48 |
} |
49 |
print "</select> |
50 |
<input type=submit value=Prikazi> |
51 |
</td></tr> |
52 |
</table> |
53 |
</form> |
54 |
"; |
55 |
|
56 |
} else { // isset(datum) |
57 |
print "<h1>Izvje¹taj o otvaranju raèuna</h1>"; |
58 |
|
59 |
if (isset($datum)) { |
60 |
$result = pg_Exec ($conn, " |
61 |
select osobe.id,ime,prezime,tel,lokacije.naziv, |
62 |
sifra,'', |
63 |
lok_racunala,objekt,kat,soba,z_rac,umrezavanje, |
64 |
kontakt_osobe.e_mail,podesavanje |
65 |
from osobe |
66 |
where osobe.id in ( select osoba_id from izvjestaji where datum='$datum' ) |
67 |
and lokacija_id=lokacije.id |
68 |
and podesavanje=true |
69 |
and kontakt_osobe.id=kontakt_osoba_id |
70 |
order by lokacije.naziv,osobe.id |
71 |
"); |
72 |
print "<p>Izvje¹taj za: $datum<p>"; |
73 |
} else { |
74 |
$sql="select osobe.id,ime,prezime,tel,lokacije.naziv, |
75 |
sifra,'', |
76 |
lok_racunala,objekt,kat,soba,z_rac,umrezavanje, |
77 |
kontakt_osobe.e_mail,podesavanje |
78 |
from osobe |
79 |
where lokacija_id = $lokacija |
80 |
and lokacija_id=lokacije.id |
81 |
and podesavanje=true |
82 |
and kontakt_osobe.id=kontakt_osoba_id |
83 |
order by lokacije.naziv,osobe.id |
84 |
"; |
85 |
# print "<pre>$sql</pre>"; |
86 |
$result = pg_Exec ($conn, "$sql"); |
87 |
} |
88 |
|
89 |
|
90 |
print ' |
91 |
<table border=1> |
92 |
<tr bgcolor="#e0e0f0"><th>rbr</th><th>id</th><th>ime i prezime</th><th>tel</th><th>lokacija</th><th>org.jed</th></tr> |
93 |
<tr bgcolor="#e0e0f0"><th colspan=2>pode¹eno</th><th>lokacija raèunala, mre¾a</th><th>¾</th><th colspan=2>objekat / kat / soba</th></tr> |
94 |
'; |
95 |
|
96 |
$lokacija=""; |
97 |
$mreza=""; |
98 |
$rbr=1; |
99 |
$podeseno=" "; |
100 |
|
101 |
for ($k=0; $k < pg_numrows($result); $k++) { |
102 |
$arr=pg_fetch_row($result,$k); |
103 |
|
104 |
if ($lokacija != $arr[4]) { |
105 |
$lokacija=$arr[4]; |
106 |
print "<tr bgcolor=#000000><td colspan=6><font size=+1 color=#ffffff>$lokacija</font></td></tr>"; |
107 |
} |
108 |
|
109 |
$out="<tr".bgcolor()."><td>$rbr</td><td><a href=\"http://support.pliva.hr/obavijest.php?id=$arr[0]\">$arr[0]</a></td><td>$arr[1] $arr[2]</td><td>tel: $arr[3]</td><td><small>$arr[4]</small></td><td>".sap_org_jed($arr[5])."</td></tr>\n"; |
110 |
|
111 |
|
112 |
if ($arr[12] == "f") { |
113 |
$mreza='umre¾eno'; |
114 |
} else { |
115 |
$result2 = pg_Exec ($conn, " |
116 |
select count(status_tip_id) as nr_of_status8 from status |
117 |
where osoba_id = $arr[0] and status_tip_id=8"); |
118 |
$row2=pg_fetch_array($result2,0); |
119 |
if ($row2["nr_of_status8"] > 0) { |
120 |
$mreza='<i>umre¾avanje obavljeno</i>'; |
121 |
} else { |
122 |
$mreza='<b>potrebno umre¾avanje</b>'; |
123 |
} |
124 |
} |
125 |
|
126 |
$result3 = pg_Exec ($conn, " |
127 |
select count(status_tip_id) as nr_of_status6 from status |
128 |
where osoba_id = $arr[0] and status_tip_id=6"); |
129 |
$row3=pg_fetch_array($result3,0); |
130 |
if ($row3["nr_of_status6"] > 0) { |
131 |
$podeseno_html=show_bool("t"); |
132 |
$podeseno=1; |
133 |
} else { |
134 |
$podeseno_html="<a href=\"http://support.pliva.hr/obavijest.php?id=$arr[0]\">".show_bool("f")."</a>"; |
135 |
$podeseno=0; |
136 |
} |
137 |
|
138 |
# print "<tr><td colspan=6>$arr[12] | ".$row2["nr_of_status8"]." | ".$row3["nr_of_status6"]."</td></tr>\n"; |
139 |
|
140 |
$out.="<tr".bgcolor()."><td colspan=2>$podeseno_html</td><td><small>$arr[7] $mreza</small></a><td><small>¾-$arr[11]</small></td><td colspan=2><small>$arr[8] / $arr[9] / $arr[10]</small></td></tr>\n"; |
141 |
|
142 |
if ($preskoci_podesene & ! $podeseno || ! $preskoci_podesene) { |
143 |
print "$out"; |
144 |
} |
145 |
$rbr++; |
146 |
|
147 |
} |
148 |
print "</table>"; |
149 |
|
150 |
} // isset(datum) |
151 |
|
152 |
|
153 |
print "<p>Povratak na "; |
154 |
if (isset($HTTP_REFERER)) { |
155 |
print "<a href=\"$HTTP_REFERER\">stranicu sa koje ste do¹li</a> ili "; |
156 |
} |
157 |
print "<a href=\"/\">poèetnu stranicu</a>."; |
158 |
|
159 |
include("inc/footer.inc"); |
160 |
|
161 |
?> |
162 |
|