/[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.4 by dpavlin, Wed May 10 08:19:39 2000 UTC revision 1.5 by dpavlin, Wed May 10 08:55:50 2000 UTC
# Line 21  if (! $debug) { Line 21  if (! $debug) {
21  open(HTML,"> $html_file") || die "html: $!";  open(HTML,"> $html_file") || die "html: $!";
22  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: $!";
23  } else {  } else {
24  open(HTML,"> /tmp/debug.html") || die "html: $!";  open(HTML,"> /tmp/debug.html") || warn "html: $!";
25  open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!";  open(MAIL,"> /tmp/debug.mail") || warn "sendmail: $!";
26  }  }
27    
28  print HTML '  print HTML '
# Line 37  Subject: otvoreni računi za e-mail Line 37  Subject: otvoreni računi za e-mail
37    
38  ';  ';
39    
40  my $dbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr;  my $host = "host=support.pliva.hr;";
41    
42    open(WHO,"who -m |") || die "who am i? $!";
43    my $db_user=<WHO>;
44    $db_user=~s/[^!]+!//;
45    close(WHO);
46    if (! defined($db_user)) {
47            $db_user="user=dpavlin;"; $host="";     # works on localhost
48    } else {
49            $db_user=~s/\s.+$//g;
50            $db_user="user=$db_user;";
51    }
52    
53    
54    my $dbh = DBI->connect("DBI:Pg:dbname=informatika;${host}${db_user}","","") || die $DBI::errstr;
55  $dbh->do("set datestyle = 'german'") || die $dbh->errstr();  $dbh->do("set datestyle = 'german'") || die $dbh->errstr();
56    
57  my $sth = $dbh->prepare("select id from last_print order by id desc limit 1,1");  my $sth = $dbh->prepare("select id from last_print order by id desc limit 1,1");
# Line 93  print HTML '<table border=1> Line 107  print HTML '<table border=1>
107    
108  my $bgcol='';  my $bgcol='';
109  my $mreza='';  my $mreza='';
110    my @za_ic;
111    
112  while (my @arr = $sth->fetchrow_array() ) {  while (my @arr = $sth->fetchrow_array() ) {
113            push @za_ic,$arr[0];
114    
115          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]");
116          if ($lokacija ne $arr[4]) {          if ($lokacija ne $arr[4]) {
117                  $lokacija=$arr[4];                  $lokacija=$arr[4];
# Line 131  print HTML ' Line 148  print HTML '
148  close(HTML);  close(HTML);
149  close(MAIL);  close(MAIL);
150    
151    print "Printanje zahtjeva za print za IC:\n./print.pl ",join(",",@za_ic),"\n";

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.26