5 #script to recieve 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
32 This script shows all orders receipt or pending for a given supplier.
33 It allows to write an order as 'received' when he arrives.
40 To know the supplier this script has to show orders.
43 is the bookseller invoice number.
52 To filter the results list on this given date.
64 use C4::Interface::CGI::Output;
70 my $supplierid=$input->param('supplierid');
71 my @booksellers=GetBookSeller($supplierid);
72 my $count = scalar @booksellers;
74 my $invoice=$input->param('code') || '';
75 my $freight=$input->param('freight');
76 my $gst=$input->param('gst');
77 my $date=$input->param('datereceived');
78 my $code=$input->param('code');
80 my ($template, $loggedinuser, $cookie)
81 = get_template_and_user({template_name => "acqui/parcel.tmpl",
85 flagsrequired => {acquisition => 1},
89 my @parcelitems=GetParcel($supplierid,$invoice,$date);
90 my $countlines = scalar @parcelitems;
98 my @loop_received = ();
99 for (my $i=0;$i<$countlines;$i++){
100 $total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre)
101 $parcelitems[$i]->{'unitprice'}+=0;
104 $line{color}='#EEEEEE';
107 $line{color}='white';
110 $line{basketno} = $parcelitems[$i]->{'basketno'};
111 $line{isbn} = $parcelitems[$i]->{'isbn'};
112 $line{ordernumber} = $parcelitems[$i]->{'ordernumber'};
113 $line{biblionumber} = $parcelitems[$i]->{'biblionumber'};
114 $line{invoice} = $invoice;
116 $line{title} = $parcelitems[$i]->{'title'};
117 $line{author} = $parcelitems[$i]->{'author'};
118 $line{unitprice} = $parcelitems[$i]->{'unitprice'};
119 $line{ecost} = $parcelitems[$i]->{'ecost'};
120 $line{quantityrecieved} = $parcelitems[$i]->{'quantityreceived'};
121 $line{quantity} = $parcelitems[$i]->{'quantity'};
122 $line{total} = $total;
123 $line{supplierid} = $supplierid;
124 push @loop_received, \%line;
125 $totalprice+=$parcelitems[$i]->{'unitprice'};
126 $totalfreight+=$parcelitems[$i]->{'freight'};
127 $totalquantity+=$parcelitems[$i]->{'quantityreceived'};
130 my $pendingorders = GetPendingOrders($supplierid);
131 my $countpendings = scalar @$pendingorders;
133 my @loop_orders = ();
134 for (my $i=0;$i<$countpendings;$i++){
137 $line{color}='#EEEEEE';
140 $line{color}='white';
143 $line{basketno} = $pendingorders->[$i]->{'basketno'};
144 $line{isbn} = $pendingorders->[$i]->{'isbn'};
145 $line{ordernumber} = $pendingorders->[$i]->{'ordernumber'};
146 $line{biblionumber} = $pendingorders->[$i]->{'biblionumber'};
147 $line{invoice} = $invoice;
149 $line{title} = $pendingorders->[$i]->{'title'};
150 $line{author} = $pendingorders->[$i]->{'author'};
151 $line{unitprice} = $pendingorders->[$i]->{'unitprice'};
152 $line{ecost} = $pendingorders->[$i]->{'ecost'};
153 $line{quantityrecieved} = $pendingorders->[$i]->{'quantityreceived'};
154 $line{quantity} = $pendingorders->[$i]->{'quantity'};
155 $line{total} = $total;
156 $line{supplierid} = $supplierid;
157 push @loop_orders, \%line;
160 $totalfreight=$freight;
161 $tototal=$tototal+$freight;
163 $template->param(invoice => $invoice,
165 name => $booksellers[0]->{'name'},
166 supplierid => $supplierid,
170 countreceived => $countlines,
171 loop_received => \@loop_received,
172 countpending => $countpendings,
173 loop_orders => \@loop_orders,
174 totalprice => $totalprice,
175 totalfreight => $totalfreight,
176 totalquantity => $totalquantity,
179 grandtot => $tototal+$gst,
180 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
181 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
182 IntranetNav => C4::Context->preference("IntranetNav"),
184 output_html_with_http_headers $input, $cookie, $template->output;