/[informatika.old]/print/izvjestaj.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /print/izvjestaj.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dpavlin, Thu Apr 27 10:57:11 2000 UTC revision 1.3 by dpavlin, Thu Apr 27 12:21:29 2000 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  my $debug=1;  my $debug=0;
6    
7  use DBI;  use DBI;
8  use POSIX qw(strftime);  use POSIX qw(strftime);
# Line 19  if (! $debug) { Line 19  if (! $debug) {
19  open(HTML,"> $html_file") || die "html: $!";  open(HTML,"> $html_file") || die "html: $!";
20  open(MAIL,"|/usr/lib/sendmail biljana.gombar\@pliva.hr,izvjestaji\@support.pliva.hr") || die "sendmail: $!";  open(MAIL,"|/usr/lib/sendmail biljana.gombar\@pliva.hr,izvjestaji\@support.pliva.hr") || die "sendmail: $!";
21  } else {  } else {
22  open(HTML,"> /tmp/debug$$.html") || die "html: $!";  open(HTML,"> /tmp/debug.html") || die "html: $!";
23  open(MAIL,"> /tmp/debug$$.mail") || die "sendmail: $!";  open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!";
24  }  }
25    
26  print HTML '  print HTML '
# Line 59  while (my ($osoba_id,$status_tip_id) = $ Line 59  while (my ($osoba_id,$status_tip_id) = $
59  print MAIL "Otvorenih računa: ",$#osoba_id_za_print+1,"  print MAIL "Otvorenih računa: ",$#osoba_id_za_print+1,"
60  Datum i vrijeme generiranja izvještaja: $currdate  Datum i vrijeme generiranja izvještaja: $currdate
61    
62  Izvještaj se nalazi i na  Izvještaj za štampanje se nalazi na
63  http://support.pliva.hr/$html_file  http://support.pliva.hr/$html_file
64  (npr. za ispis na štampaču)  sa potpunim podacima o umrežavanju, lokaciji računala i osobe
65    
66  ";  ";
67  print HTML "Otvorenih računa: ",$#osoba_id_za_print+1,"  print HTML "Otvorenih računa: ",$#osoba_id_za_print+1,"
# Line 70  print HTML "Otvorenih računa: ",$#osoba_ Line 70  print HTML "Otvorenih računa: ",$#osoba_
70  $sth = $dbh->prepare("  $sth = $dbh->prepare("
71          select osobe.id,ime,prezime,tel,lokacije.naziv,          select osobe.id,ime,prezime,tel,lokacije.naziv,
72                  org_jed.naziv,org_pod_jed.pod_naziv,                  org_jed.naziv,org_pod_jed.pod_naziv,
73                  lok_racunala,objekt,kat,soba,z_rac                  lok_racunala,objekt,kat,soba,z_rac,umrezavanje
74          from osobe          from osobe
75          where osobe.id in (".join(",",@osoba_id_za_print).")          where osobe.id in (".join(",",@osoba_id_za_print).")
76                  and lokacija_id=lokacije.id and org_jed_id=org_jed.id                  and lokacija_id=lokacije.id and org_jed_id=org_jed.id
77                  and org_pod_jed_id=org_pod_jed.pod_id                  and org_pod_jed_id=org_pod_jed.pod_id
78                    and podesavanje=true
79          order by lokacije.naziv,org_jed.naziv          order by lokacije.naziv,org_jed.naziv
80          ") || die $dbh->errstr();          ") || die $dbh->errstr();
81  $sth->execute() || die $sth->errstr();  $sth->execute() || die $sth->errstr();
82    
83  my $rbr=1;  my $rbr=1;
84    my $lokacija='';
85    
86  printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n","rbr","id","ime i prezime","tel","lokacija","org.jed");  printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n","rbr","id","ime i prezime","tel","lokacija","org.jed");
87  print HTML '<table border=1>  print HTML '<table border=1>
88  <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>  <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>
89    <tr bgcolor="#e0e0f0"><th></th><th></th><th>lokacija računala, mreža</th><th>ž</th><th colspan=2>objekat / kat / soba</th></tr>
90  ';  ';
91    
92    my $bgcol='';
93    my $mreza='';
94    
95  while (my @arr = $sth->fetchrow_array() ) {  while (my @arr = $sth->fetchrow_array() ) {
96          printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n",$rbr,$arr[0],"$arr[1] $arr[2]",$arr[3],$arr[4],"$arr[5] $arr[6]");          printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n",$rbr,$arr[0],"$arr[1] $arr[2]",$arr[3],$arr[4],"$arr[5] $arr[6]");
97          print HTML "<tr><td>$rbr</td><td>$arr[0]</td><td>$arr[1] $arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]<br>$arr[6]</td></tr>\n";          if ($lokacija ne $arr[4]) {
98                    $lokacija=$arr[4];
99                    print HTML "<tr bgcolor=#000000><td colspan=6><font size=+1 color=#ffffff>$lokacija</font></td></tr>";
100            }
101            print HTML "<tr$bgcol><td>$rbr</td><td>$arr[0]</td><td>$arr[1] $arr[2]</td><td>tel: $arr[3]</td><td><small>$arr[4]</small></td><td>$arr[5]<br>$arr[6]</td></tr>\n";
102            if ($arr[12] == 0) {
103                    $mreza='umreženo';
104            } else {
105                    $mreza='<b>potrebno umrežavanje</b>';
106            }
107            print HTML "<tr$bgcol><td colspan=2>&nbsp;</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";
108          $rbr++;          $rbr++;
109            if ($rbr % 2 == 0) {
110                    $bgcol=' bgcolor=#eeeeee';
111            } else {
112                    $bgcol='';
113            }
114  }  }
115    
116  $sth->finish;  $sth->finish;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26