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.
75 my $supplierid=$input->param('supplierid');
76 my $order=$input->param('orderby') || "datereceived desc";
77 my $startfrom=$input->param('startfrom');
78 my $code=$input->param('filter');
79 my $datefrom=$input->param('datefrom');
80 my $dateto=$input->param('dateto');
81 my $resultsperpage = $input->param('resultsperpage');
83 my @booksellers=GetBookSeller($supplierid);
84 my $count = scalar @booksellers;
86 my ($template, $loggedinuser, $cookie)
87 = get_template_and_user({template_name => "acqui/parcels.tmpl",
91 flagsrequired => {acquisition => 1},
96 $resultsperpage = 20 unless ($resultsperpage);
97 my @results =GetParcels($supplierid, $order, $code,$datefrom,$dateto);
98 $count = scalar @results;
100 # multi page display gestion
101 $startfrom=0 unless ($startfrom);
102 if ($count>$resultsperpage){
104 my $displayprev=$startfrom;
105 if(($count - ($startfrom+$resultsperpage)) > 0 ) {
110 if ($count>$resultsperpage) {
111 for (my $i=1; $i<$count/$resultsperpage+1; $i++) {
114 ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
115 push @numbers, { number => $i,
116 highlight => $highlight ,
117 # searchdata=> "test",
118 startfrom => ($i-1)*$resultsperpage};
123 my $from = $startfrom*$resultsperpage+1;
125 if($count < (($startfrom+1)*$resultsperpage)){
128 $to = (($startfrom+1)*$resultsperpage);
130 $template->param(numbers=>\@numbers,
131 displaynext=>$displaynext,
132 displayprev=>$displayprev,
133 nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count),
134 prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
140 for (my $i=$startfrom;$i<=($startfrom+$resultsperpage-1<$count-1?$startfrom+$resultsperpage-1:$count-1);$i++){
141 ### startfrom: $startfrom
142 ### resultsperpage: $resultsperpage
144 ### code: $results[$i]->{booksellerinvoicenumber}
145 ### datereceived: $results[$i]->{datereceived}
149 $cell{code}=$results[$i]->{booksellerinvoicenumber};
150 $cell{nullcode}=$results[$i]->{booksellerinvoicenumber} eq "NULL";
151 $cell{emptycode}=$results[$i]->{booksellerinvoicenumber} eq '';
152 $cell{raw_datereceived}=$results[$i]->{datereceived};
153 $cell{datereceived}=format_date($results[$i]->{datereceived});
154 $cell{bibcount}=$results[$i]->{biblio};
155 $cell{reccount}=$results[$i]->{itemsreceived};
156 $cell{itemcount}=$results[$i]->{itemsexpected};
157 $cell{hilighted} = $hilighted%2;
159 push @loopres, \%cell;
161 $template->param(searchresults=>\@loopres, count=>$count) if ($count);
162 $template->param(orderby=>$order, filter=>$code, datefrom=>$datefrom,dateto=>$dateto, resultsperpage=>$resultsperpage);
164 name => $booksellers[0]->{'name'},
165 supplierid => $supplierid,
166 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
167 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
168 IntranetNav => C4::Context->preference("IntranetNav"),
171 output_html_with_http_headers $input, $cookie, $template->output;