introducint marcflavour in systempref file : used for character decoding
[koha.git] / charges.pl
1 #!/usr/bin/perl
2
3 #script to display reports
4 #written 8/11/99
5
6
7 # Copyright 2000-2002 Katipo Communications
8 #
9 # This file is part of Koha.
10 #
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 #
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA  02111-1307 USA
23
24 use strict;
25 use CGI;
26 use C4::Context;
27 use C4::Output;
28 use C4::Database;
29 use C4::Auth;
30
31 my $input = new CGI;
32
33 my $flagsrequired;
34 $flagsrequired->{circulation}=1;
35 my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
36
37
38 print $input->header;
39 my $type=$input->param('type');
40 print startpage();
41 print startmenu('issue');
42 print "Each box needs to be filled in with fine,time to start charging,charging cycle<br>
43 eg 1,7,7 = $1 fine, after 7 days, every 7 days";
44
45 my $dbh = C4::Context->dbh;
46 my $query="Select description,categorycode from categories";
47 my $sth=$dbh->prepare($query);
48 $sth->execute;
49 print mktablehdr;
50 my @trow;
51 my @trow3;
52 my $i=0;
53 while (my $data=$sth->fetchrow_hashref){
54   $trow[$i]=$data->{'description'};
55   $trow3[$i]=$data->{'categorycode'};
56   $i++;
57 }
58 $sth->finish;
59 print mktablerow(10,'white','',@trow);
60 print "<form action=/cgi-bin/koha/updatecharges.pl method=post>";
61 $query="Select description,itemtype from itemtypes";
62 $sth=$dbh->prepare($query);
63 $sth->execute;
64 $i=0;
65
66 while (my $data=$sth->fetchrow_hashref){
67   my @trow2;
68   for ($i=0;$i<9;$i++){
69     $query="select * from categoryitem where categorycode='$trow3[$i]' and itemtype='$data->{'itemtype'}'";
70     my $sth2=$dbh->prepare($query);
71     $sth2->execute;
72     my $dat=$sth2->fetchrow_hashref;
73     $sth2->finish;
74     my $fine=$dat->{'fine'}+0;
75     $trow2[$i]="<input type=text name=\"$trow3[$i]$data->{'itemtype'}\" value=\"$fine,$dat->{'startcharge'},$dat->{'chargeperiod'}\" size=6>";
76   }
77   print mktablerow(11,'white',$data->{'description'},@trow2);
78 }
79
80 $sth->finish;
81
82
83 print "</table>";
84 print "<input type=submit></form>";
85 print endmenu('issue');
86 print endpage();