--- print/izvjestaj.pl 2000/04/12 08:10:24 1.1 +++ print/izvjestaj.pl 2000/05/10 08:19:39 1.4 @@ -2,17 +2,28 @@ use strict; +my $debug=0; + use DBI; use POSIX qw(strftime); +$debug++ if ($ARGV[0] eq "-d"); + +print STDERR "Debug mod: output je u /tmp/debug*\n" if ($debug); + my $currdate = strftime "%d.%m.%Y %H:%M:%S", localtime; my $html_file=$currdate; $html_file=~s/ /_/g; $html_file="izvjestaji/$html_file.html"; +if (! $debug) { open(HTML,"> $html_file") || die "html: $!"; open(MAIL,"|/usr/lib/sendmail biljana.gombar\@pliva.hr,izvjestaji\@support.pliva.hr") || die "sendmail: $!"; +} else { +open(HTML,"> /tmp/debug.html") || die "html: $!"; +open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!"; +} print HTML ' @@ -42,7 +53,7 @@ my @osoba_id_za_print; while (my ($osoba_id,$status_tip_id) = $sth->fetchrow_array() ) { - if ($status_tip_id == 5) { # print + if ($status_tip_id == 5 || $status_tip_id == 8 ) { # print/umrežavanje push @osoba_id_za_print,$osoba_id; } } @@ -50,9 +61,9 @@ print MAIL "Otvorenih računa: ",$#osoba_id_za_print+1," Datum i vrijeme generiranja izvještaja: $currdate -Izvještaj se nalazi i na +Izvještaj za štampanje se nalazi na http://support.pliva.hr/$html_file -(npr. za ispis na štampaču) +sa potpunim podacima o umrežavanju, lokaciji računala i osobe "; print HTML "Otvorenih računa: ",$#osoba_id_za_print+1," @@ -61,26 +72,53 @@ $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 + lok_racunala,objekt,kat,soba,z_rac,umrezavanje from osobe where osobe.id in (".join(",",@osoba_id_za_print).") 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 order by lokacije.naziv,org_jed.naziv ") || die $dbh->errstr(); $sth->execute() || die $sth->errstr(); my $rbr=1; +my $lokacija=''; printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n","rbr","id","ime i prezime","tel","lokacija","org.jed"); print HTML ' + '; +my $bgcol=''; +my $mreza=''; + while (my @arr = $sth->fetchrow_array() ) { printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n",$rbr,$arr[0],"$arr[1] $arr[2]",$arr[3],$arr[4],"$arr[5] $arr[6]"); - print HTML "\n"; + if ($lokacija ne $arr[4]) { + $lokacija=$arr[4]; + print HTML ""; + } + print HTML "\n"; + if ($arr[12] == 0) { + $mreza='umreženo'; + } else { + my $rows = $dbh->do("select max(status_tip_id) from status + where osoba_id = $arr[0] and status_tip_id=8") || die $dbh->errstr(); + if ($rows > 0) { + $mreza='umrežavanje obavljeno'; + } else { + $mreza='potrebno umrežavanje'; + } + } + print HTML "\n"; $rbr++; + if ($rbr % 2 == 0) { + $bgcol=' bgcolor=#eeeeee'; + } else { + $bgcol=''; + } } $sth->finish; @@ -92,3 +130,4 @@ close(HTML); close(MAIL); +
rbridime i prezimetellokacijaorg.jed
lokacija računala, mrežažobjekat / kat / soba
$rbr$arr[0]$arr[1] $arr[2]$arr[3]$arr[4]$arr[5]
$arr[6]
$lokacija
$rbr$arr[0]$arr[1] $arr[2]tel: $arr[3]$arr[4]$arr[5]
$arr[6]
 $arr[7] $mrezaž-$arr[11]$arr[8] / $arr[9] / $arr[10]