--- print/izvjestaj.pl 2000/05/10 08:55:50 1.5
+++ print/izvjestaj.pl 2000/07/13 08:01:31 1.9
@@ -2,6 +2,9 @@
use strict;
+my $ic_mail='biljana.gombar@pliva.hr';
+my $mreze_mail='davorin.koprivnjak@pliva.hr';
+
my $debug=0;
use DBI;
@@ -11,18 +14,20 @@
print STDERR "Debug mod: output je u /tmp/debug*\n" if ($debug);
-my $currdate = strftime "%d.%m.%Y %H:%M:%S", localtime;
+my $currdate = strftime "%Y-%m-%d %H:%M:%S", localtime;
my $html_file=$currdate;
$html_file=~s/ /_/g;
$html_file="izvjestaji/$html_file.html";
+my $html_date=$currdate;
+$html_date=~s/ /%20/g;
if (! $debug) {
open(HTML,"> $html_file") || die "html: $!";
-open(MAIL,"|/usr/lib/sendmail biljana.gombar\@pliva.hr,izvjestaji\@support.pliva.hr") || die "sendmail: $!";
+open(MAIL,"|/usr/lib/sendmail $ic_mail,$mreze_mail,izvjestaji\@support.pliva.hr") || die "sendmail: $!";
} else {
-open(HTML,"> /tmp/debug.html") || warn "html: $!";
-open(MAIL,"> /tmp/debug.mail") || warn "sendmail: $!";
+open(HTML,"> /tmp/debug.html") || die "html: $!";
+open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!";
}
print HTML '
@@ -72,26 +77,28 @@
}
}
-print MAIL "Otvorenih računa: ",$#osoba_id_za_print+1,"
+print MAIL "
Datum i vrijeme generiranja izvještaja: $currdate
Izvještaj za štampanje se nalazi na
-http://support.pliva.hr/$html_file
+http://support.pliva.hr/ic.php?datum=$html_date
sa potpunim podacima o umrežavanju, lokaciji računala i osobe
";
-print HTML "Otvorenih računa: ",$#osoba_id_za_print+1,"
+print HTML "
Datum i vrijeme generiranja izvještaja: $currdate
"; $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 + lok_racunala,objekt,kat,soba,z_rac,umrezavanje, + kontakt_osobe.e_mail,podesavanje 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 + and kontakt_osobe.id=kontakt_osoba_id order by lokacije.naziv,org_jed.naziv ") || die $dbh->errstr(); $sth->execute() || die $sth->errstr(); @@ -108,22 +115,29 @@ my $bgcol=''; my $mreza=''; my @za_ic; +my %mail4ko; while (my @arr = $sth->fetchrow_array() ) { push @za_ic,$arr[0]; + $mail4ko{$arr[13]}.="\t$arr[1] $arr[2]"; + $mail4ko{$arr[13]}.=" (bez podešavanja)" if ($arr[14] == 0); printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n",$rbr,$arr[0],"$arr[1] $arr[2]",$arr[3],$arr[4],"$arr[5] $arr[6]"); if ($lokacija ne $arr[4]) { $lokacija=$arr[4]; print HTML "