6 #script to show display basket of orders
7 #written by chris@katipo.co.nz 24/2/2000
10 # Copyright 2000-2002 Katipo Communications
12 # This file is part of Koha.
14 # Koha is free software; you can redistribute it and/or modify it under the
15 # terms of the GNU General Public License as published by the Free Software
16 # Foundation; either version 2 of the License, or (at your option) any later
19 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License along with
24 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
25 # Suite 330, Boston, MA 02111-1307 USA
30 use C4::Interface::CGI::Output;
37 my $supplierid=$input->param('supplierid');
38 my $order=$input->param('orderby') || "datereceived desc";
39 my $startfrom=$input->param('startfrom');
40 my $code=$input->param('filter');
41 my $datefrom=$input->param('datefrom');
42 my $dateto=$input->param('dateto');
43 my $resultsperpage = $input->param('resultsperpage');
45 my ($count,@booksellers)=bookseller($supplierid);
47 my ($template, $loggedinuser, $cookie)
48 = get_template_and_user({template_name => "acqui/parcels.tmpl",
52 flagsrequired => {acquisition => 1},
57 $resultsperpage = 20 unless ($resultsperpage);
58 my ($count,@results)=getparcels($supplierid, $order, $code,$datefrom,$dateto);
60 # multi page display gestion
61 $startfrom=0 unless ($startfrom);
62 if ($count>$resultsperpage){
64 my $displayprev=$startfrom;
65 if(($count - ($startfrom+$resultsperpage)) > 0 ) {
70 if ($count>$resultsperpage) {
71 for (my $i=1; $i<$count/$resultsperpage+1; $i++) {
74 ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
75 push @numbers, { number => $i,
76 highlight => $highlight ,
77 # searchdata=> "test",
78 startfrom => ($i-1)*$resultsperpage};
83 my $from = $startfrom*$resultsperpage+1;
86 if($count < (($startfrom+1)*$resultsperpage))
90 $to = (($startfrom+1)*$resultsperpage);
92 $template->param(numbers=>\@numbers,
93 displaynext=>$displaynext,
94 displayprev=>$displayprev,
95 nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count),
96 prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
102 for (my $i=$startfrom;$i<=($startfrom+$resultsperpage-1<$count-1?$startfrom+$resultsperpage-1:$count-1);$i++){
103 ### startfrom: $startfrom
104 ### resultsperpage: $resultsperpage
106 ### code: $results[$i]->{booksellerinvoicenumber}
107 ### datereceived: $results[$i]->{datereceived}
111 $cell{code}=$results[$i]->{booksellerinvoicenumber};
112 $cell{nullcode}=$results[$i]->{booksellerinvoicenumber} eq "NULL";
113 $cell{emptycode}=$results[$i]->{booksellerinvoicenumber} eq '';
114 $cell{raw_datereceived}=$results[$i]->{datereceived};
115 $cell{datereceived}=format_date($results[$i]->{datereceived});
116 $cell{bibcount}=$results[$i]->{biblio};
117 $cell{reccount}=$results[$i]->{itemsreceived};
118 $cell{itemcount}=$results[$i]->{itemsexpected};
119 $cell{hilighted} = $hilighted%2;
121 push @loopres, \%cell;
123 $template->param(searchresults=>\@loopres, count=>$count) if ($count);
124 $template->param(orderby=>$order, filter=>$code, datefrom=>$datefrom,dateto=>$dateto, resultsperpage=>$resultsperpage);
126 name => $booksellers[0]->{'name'},
127 supplierid => $supplierid,
128 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
129 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
130 IntranetNav => C4::Context->preference("IntranetNav"),
133 output_html_with_http_headers $input, $cookie, $template->output;