5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
37 my $dbh = C4::Context->dbh;
38 my $branches=getbranches();
42 push @select_branch,"";
43 $select_branches{""} = "";
44 foreach my $branch (keys %$branches) {
45 push @select_branch, $branch;
46 $select_branches{$branch} = $branches->{$branch}->{'branchname'};
48 my $CGIbranch=CGI::scrolling_list( -name => 'value',
50 -values => \@select_branch,
51 -labels => \%select_branches,
54 $template->param(CGIbranch => $CGIbranch);
58 my ($parameters) = @_;
60 my $branch = @$parameters[0];
61 my $dbh = C4::Context->dbh;
64 $sth = $dbh->prepare("select description, biblioitems.itemtype, count(*) as total from itemtypes, biblioitems, items
65 where biblioitems.itemtype=itemtypes.itemtype
66 and items.biblionumber=biblioitems.biblionumber
67 and items.holdingbranch=?
68 group by biblioitems.itemtype");
69 $sth->execute($branch);
71 $sth = $dbh->prepare("select description, biblioitems.itemtype, count(*) as total from itemtypes, biblioitems where biblioitems.itemtype=itemtypes.itemtype group by biblioitems.itemtype");
74 my ($description,$biblioitems,$total);
76 while (($description,$biblioitems,$total) = $sth->fetchrow) {
78 $line{itemtype} = $description;
79 $line{count} = $total;
85 $globalline{loopitemtype} = \@results;
86 $globalline{total} = $grantotal;
87 $globalline{branch} = $branch;
88 push @mainloop,\%globalline;