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
36 my $dbh = C4::Context->dbh;
37 my $branches=GetBranches();
41 push @select_branch,"";
42 $select_branches{""} = "";
43 foreach my $branch (keys %$branches) {
44 push @select_branch, $branch;
45 $select_branches{$branch} = $branches->{$branch}->{'branchname'};
47 my $CGIbranch=CGI::scrolling_list( -name => 'value',
49 -values => \@select_branch,
50 -labels => \%select_branches,
53 $template->param(CGIbranch => $CGIbranch);
57 my ($parameters) = @_;
59 my $branch = @$parameters[0];
60 my $dbh = C4::Context->dbh;
63 $sth = $dbh->prepare("select description, biblio.itemtype, count(*) as total from itemtypes, biblio, items
64 where biblio.itemtype=itemtypes.itemtype
65 and items.biblionumber=biblio.biblionumber
66 and items.holdingbranch=?
67 group by biblio.itemtype");
68 $sth->execute($branch);
70 $sth = $dbh->prepare("select description, biblio.itemtype, count(*) as total from itemtypes, biblio where biblio.itemtype=itemtypes.itemtype group by biblio.itemtype");
73 my ($description,$biblioitems,$total);
76 while (($description,$biblioitems,$total) = $sth->fetchrow) {
83 $line{itemtype} = $description;
84 $line{count} = $total;
91 $globalline{loopitemtype} = \@results;
92 $globalline{total} = $grantotal;
93 $globalline{branch} = $branch;
94 push @mainloop,\%globalline;