Continuing work on Z39.50 search tool. Daemon now forks up to 12 processes
[koha.git] / charges.pl
blob6cf06b277983838523d086fb41497a4124060e6a
1 #!/usr/bin/perl
3 #script to display reports
4 #written 8/11/99
6 use strict;
7 use CGI;
8 use C4::Output;
9 use C4::Database;
11 my $input = new CGI;
12 print $input->header;
13 my $type=$input->param('type');
14 print startpage();
15 print startmenu('issue');
16 print "Each box needs to be filled in with fine,time to start charging,charging cycle<br>
17 eg 1,7,7 = $1 fine, after 7 days, every 7 days";
19 my $dbh=C4Connect;
20 my $query="Select description,categorycode from categories";
21 my $sth=$dbh->prepare($query);
22 $sth->execute;
23 print mktablehdr;
24 my @trow;
25 my @trow3;
26 my $i=0;
27 while (my $data=$sth->fetchrow_hashref){
28 $trow[$i]=$data->{'description'};
29 $trow3[$i]=$data->{'categorycode'};
30 $i++;
32 $sth->finish;
33 print mktablerow(10,'white','',@trow);
34 print "<form action=/cgi-bin/koha/updatecharges.pl method=post>";
35 $query="Select description,itemtype from itemtypes";
36 $sth=$dbh->prepare($query);
37 $sth->execute;
38 $i=0;
40 while (my $data=$sth->fetchrow_hashref){
41 my @trow2;
42 for ($i=0;$i<9;$i++){
43 $query="select * from categoryitem where categorycode='$trow3[$i]' and itemtype='$data->{'itemtype'}'";
44 my $sth2=$dbh->prepare($query);
45 $sth2->execute;
46 my $dat=$sth2->fetchrow_hashref;
47 $sth2->finish;
48 my $fine=$dat->{'fine'}+0;
49 $trow2[$i]="<input type=text name=\"$trow3[$i]$data->{'itemtype'}\" value=\"$fine,$dat->{'startcharge'},$dat->{'chargeperiod'}\" size=6>";
51 print mktablerow(11,'white',$data->{'description'},@trow2);
54 $sth->finish;
57 print "</table>";
58 print "<input type=submit></form>";
59 print endmenu('issue');
60 print endpage();