--- html/ic.php 2000/07/31 10:41:57 1.4.2.2
+++ html/ic.php 2000/10/05 11:48:55 1.6
@@ -6,53 +6,91 @@
include("inc/bgcolor.inc");
include("inc/radio.inc");
-if (! isset($datum)) {
+if (!isset($datum) and !isset($lokacija)) {
-$sth = $dbh->prepare("
+$result = pg_Exec ($conn, "
select datum,count(*) as nr from izvjestaji group by datum
order by datum desc
");
-$sth->execute();
print '
Izvještaji o otvaranju računa
-
datum izvještaja | broj otvorenih računa |
';
-while ($arr=$sth->fetchrow_array()) {
+for ($k=0; $k < pg_numrows($result); $k++) {
+ $arr=pg_fetch_row($result,$k);
print "$arr[0] |
$arr[1] |
\n";
}
print '
';
+print "
+
+";
} else { // isset(datum)
+ print "Izvještaj o otvaranju računa
";
+ if (isset($datum)) {
+ $result = pg_Exec ($conn, "
+ select osobe.id,ime,prezime,tel,lokacije.naziv,
+ org_jed.naziv,org_pod_jed.pod_naziv,
+ lok_racunala,objekt,kat,soba,z_rac,umrezavanje,
+ kontakt_osobe.e_mail,podesavanje
+ from osobe
+ where osobe.id in ( select osoba_id from izvjestaji where datum='$datum' )
+ and lokacija_id=lokacije.id
+ and org_jed_id=org_jed.id
+ and org_pod_jed_id=org_pod_jed.pod_id
+ and podesavanje=true
+ and kontakt_osobe.id=kontakt_osoba_id
+ order by lokacije.naziv,org_jed.naziv,osobe.id
+ ");
+ print "Izvještaj za: $datum
";
+ } else {
+ $sql="select osobe.id,ime,prezime,tel,lokacije.naziv,
+ org_jed.naziv,org_pod_jed.pod_naziv,
+ lok_racunala,objekt,kat,soba,z_rac,umrezavanje,
+ kontakt_osobe.e_mail,podesavanje
+ from osobe
+ where lokacija_id = $lokacija
+ and lokacija_id=lokacije.id
+ and org_jed_id=org_jed.id
+ and org_pod_jed_id=org_pod_jed.pod_id
+ and podesavanje=true
+ and kontakt_osobe.id=kontakt_osoba_id
+ order by lokacije.naziv,org_jed.naziv,osobe.id
+ ";
+# print "
$sql
";
+ $result = pg_Exec ($conn, "$sql");
+ }
-$sth = $dbh->prepare("
- select osobe.id,ime,prezime,tel,lokacije.naziv,
- org_jed.naziv,org_pod_jed.pod_naziv,
- lok_racunala,objekt,kat,soba,z_rac,umrezavanje,
- kontakt_osobe.e_mail,podesavanje
- from osobe
- where osobe.id in ( select osoba_id from izvjestaji where datum='$datum' )
- and lokacija_id=lokacije.id and org_jed_id=org_jed.id
- and org_pod_jed_id=org_pod_jed.pod_id
- and podesavanje=true
- and kontakt_osobe.id=kontakt_osoba_id
- order by lokacije.naziv,org_jed.naziv,osobe.id
-
- ");
-$sth->execute();
print '
-Izvještaj o otvaranju računa
-
-Izvještaj za: '.$datum.'
-
rbr | id | ime i prezime | tel | lokacija | org.jed |
podešeno | lokacija računala, mreža | ž | objekat / kat / soba |
@@ -63,24 +101,24 @@
$rbr=1;
$podeseno=" ";
-while ($arr=$sth->fetchrow_array()) {
+for ($k=0; $k < pg_numrows($result); $k++) {
+ $arr=pg_fetch_row($result,$k);
if ($lokacija != $arr[4]) {
$lokacija=$arr[4];
print "$lokacija |
";
}
- print "$rbr | $arr[0] | $arr[1] $arr[2] | tel: $arr[3] | $arr[4] | $arr[5] $arr[6] |
\n";
+ $out="$rbr | $arr[0] | $arr[1] $arr[2] | tel: $arr[3] | $arr[4] | $arr[5] $arr[6] |
\n";
if ($arr[12] == "f") {
$mreza='umreženo';
} else {
- $sth2 = $dbh->prepare("
+ $result2 = pg_Exec ($conn, "
select count(status_tip_id) as nr_of_status8 from status
where osoba_id = $arr[0] and status_tip_id=8");
- $sth2->execute();
- $row2=$sth2->fetchrow_hash();
+ $row2=pg_fetch_array($result2,0);
if ($row2["nr_of_status8"] > 0) {
$mreza='umrežavanje obavljeno';
} else {
@@ -88,20 +126,25 @@
}
}
- $sth3 = $dbh->prepare("
+ $result3 = pg_Exec ($conn, "
select count(status_tip_id) as nr_of_status6 from status
where osoba_id = $arr[0] and status_tip_id=6");
- $sth3->execute();
- $row3=$sth3->fetchrow_hash();
+ $row3=pg_fetch_array($result3,0);
if ($row3["nr_of_status6"] > 0) {
- $podeseno=show_bool("t");
+ $podeseno_html=show_bool("t");
+ $podeseno=1;
} else {
- $podeseno="".show_bool("f")."";
+ $podeseno_html="".show_bool("f")."";
+ $podeseno=0;
}
# print "$arr[12] | ".$row2["nr_of_status8"]." | ".$row3["nr_of_status6"]." |
\n";
- print "$podeseno | $arr[7] $mreza | ž-$arr[11] | $arr[8] / $arr[9] / $arr[10] |
\n";
+ $out.="$podeseno_html | $arr[7] $mreza | ž-$arr[11] | $arr[8] / $arr[9] / $arr[10] |
\n";
+
+ if ($preskoci_podesene & ! $podeseno || ! $preskoci_podesene) {
+ print "$out";
+ }
$rbr++;
}