5 #script to show display basket of orders
6 #written by chris@katipo.co.nz 24/2/2000
9 # Copyright 2000-2002 Katipo Communications
11 # This file is part of Koha.
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA 02111-1307 USA
31 This script shows all orders/parcels receipt or pending for a given supplier.
32 It allows to write an order/parcels as 'received' when he arrives.
39 To know the supplier this script has to show orders.
42 sort list of order by 'orderby'.
43 Orderby can be equals to
44 * datereceived desc (default value)
45 * aqorders.booksellerinvoicenumber
47 * aqorders.booksellerinvoicenumber desc
58 To know how many results have to be display / page.
68 use C4::Interface::CGI::Output;
76 my $supplierid=$input->param('supplierid');
77 my $order=$input->param('orderby') || "datereceived desc";
78 my $startfrom=$input->param('startfrom');
79 my $code=$input->param('filter');
80 my $datefrom=$input->param('datefrom');
81 my $dateto=$input->param('dateto');
82 my $resultsperpage = $input->param('resultsperpage');
84 my @booksellers=GetBookSeller($supplierid);
85 my $count = scalar @booksellers;
87 my ($template, $loggedinuser, $cookie)
88 = get_template_and_user({template_name => "acqui/parcels.tmpl",
92 flagsrequired => {acquisition => 1},
97 $resultsperpage = 20 unless ($resultsperpage);
98 my @results =GetParcels($supplierid, $order, $code,$datefrom,$dateto);
99 my $count = scalar @results;
101 # multi page display gestion
102 $startfrom=0 unless ($startfrom);
103 if ($count>$resultsperpage){
105 my $displayprev=$startfrom;
106 if(($count - ($startfrom+$resultsperpage)) > 0 ) {
111 if ($count>$resultsperpage) {
112 for (my $i=1; $i<$count/$resultsperpage+1; $i++) {
115 ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
116 push @numbers, { number => $i,
117 highlight => $highlight ,
118 # searchdata=> "test",
119 startfrom => ($i-1)*$resultsperpage};
124 my $from = $startfrom*$resultsperpage+1;
126 if($count < (($startfrom+1)*$resultsperpage)){
129 $to = (($startfrom+1)*$resultsperpage);
131 $template->param(numbers=>\@numbers,
132 displaynext=>$displaynext,
133 displayprev=>$displayprev,
134 nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count),
135 prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
141 for (my $i=$startfrom;$i<=($startfrom+$resultsperpage-1<$count-1?$startfrom+$resultsperpage-1:$count-1);$i++){
142 ### startfrom: $startfrom
143 ### resultsperpage: $resultsperpage
145 ### code: $results[$i]->{booksellerinvoicenumber}
146 ### datereceived: $results[$i]->{datereceived}
150 $cell{code}=$results[$i]->{booksellerinvoicenumber};
151 $cell{nullcode}=$results[$i]->{booksellerinvoicenumber} eq "NULL";
152 $cell{emptycode}=$results[$i]->{booksellerinvoicenumber} eq '';
153 $cell{raw_datereceived}=$results[$i]->{datereceived};
154 $cell{datereceived}=format_date($results[$i]->{datereceived});
155 $cell{bibcount}=$results[$i]->{biblio};
156 $cell{reccount}=$results[$i]->{itemsreceived};
157 $cell{itemcount}=$results[$i]->{itemsexpected};
158 $cell{hilighted} = $hilighted%2;
160 push @loopres, \%cell;
162 $template->param(searchresults=>\@loopres, count=>$count) if ($count);
163 $template->param(orderby=>$order, filter=>$code, datefrom=>$datefrom,dateto=>$dateto, resultsperpage=>$resultsperpage);
165 name => $booksellers[0]->{'name'},
166 supplierid => $supplierid,
167 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
168 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
169 IntranetNav => C4::Context->preference("IntranetNav"),
172 output_html_with_http_headers $input, $cookie, $template->output;