#!/usr/bin/perl
#written 14/1/2000
#script to display reports
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use CGI qw/:standard/;
use C4::Output;
use C4::Groups;
use C4::Circulation::Circ2;
use C4::Print;
use DBI;
my $input=new CGI;
my $time=$input->param('time');
#print $input->header;
my $branches=getbranches(\%env);
my $printers=getprinters(\%env);
my $branch=$input->param('branch');
my $printer=$input->param('printer');
($branch) || ($branch=$input->cookie('branch'));
($printer) || ($printer=$input->cookie('printer'));
my ($oldbranch, $oldprinter);
if ($input->param('selectnewbranchprinter')) {
$oldbranch=$branch;
$oldprinter=$printer;
$branch='';
$printer='';
}
$env{'branchcode'}=$branch;
$env{'printer'}=$printer;
#$env{'queue'}=$printer;
my $branchcount=0;
my $printercount=0;
my $branchoptions;
my $printeroptions;
foreach (keys %$branches) {
(next) unless ($_);
(next) if (/^TR$/);
$branchcount++;
my $selected='';
($selected='selected') if ($_ eq $oldbranch);
($selected='selected') if ($_ eq $branch);
$branchoptions.="