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
31 use C4::Interface::CGI::Output;
37 my $supplierid=$input->param('supplierid');
38 my ($count,@booksellers)=bookseller($supplierid);
39 my $invoice=$input->param('code') || '';
40 my $freight=$input->param('freight');
41 my $gst=$input->param('gst');
42 my $date=$input->param('datereceived');
43 my $code=$input->param('code');
45 my ($template, $loggedinuser, $cookie)
46 = get_template_and_user({template_name => "acqui/recieve.tmpl",
50 flagsrequired => {acquisition => 1},
54 my ($countlines,@parcelitems)=getparcelinformation($supplierid,$invoice,$date);
61 my @loop_received = ();
62 for (my $i=0;$i<$countlines;$i++){
63 $total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre)
64 $parcelitems[$i]->{'unitprice'}+=0;
67 $line{color}='#EEEEEE';
73 $line{basketno} = $parcelitems[$i]->{'basketno'};
74 $line{isbn} = $parcelitems[$i]->{'isbn'};
75 $line{ordernumber} = $parcelitems[$i]->{'ordernumber'};
76 $line{biblionumber} = $parcelitems[$i]->{'biblionumber'};
77 $line{invoice} = $invoice;
79 $line{title} = $parcelitems[$i]->{'title'};
80 $line{author} = $parcelitems[$i]->{'author'};
81 $line{unitprice} = $parcelitems[$i]->{'unitprice'};
82 $line{ecost} = $parcelitems[$i]->{'ecost'};
83 $line{quantityrecieved} = $parcelitems[$i]->{'quantityreceived'};
84 $line{quantity} = $parcelitems[$i]->{'quantity'};
85 $line{total} = $total;
86 $line{supplierid} = $supplierid;
87 push @loop_received, \%line;
88 $totalprice+=$parcelitems[$i]->{'unitprice'};
89 $totalfreight+=$parcelitems[$i]->{'freight'};
90 $totalquantity+=$parcelitems[$i]->{'quantityreceived'};
93 my ($countpendings,@pendingorders)=getallorders($supplierid);
95 for (my $i=0;$i<$countpendings;$i++){
98 $line{color}='#EEEEEE';
101 $line{color}='white';
104 $line{basketno} = $pendingorders[$i]->{'basketno'};
105 $line{isbn} = $pendingorders[$i]->{'isbn'};
106 $line{ordernumber} = $pendingorders[$i]->{'ordernumber'};
107 $line{biblionumber} = $pendingorders[$i]->{'biblionumber'};
108 $line{invoice} = $invoice;
110 $line{title} = $pendingorders[$i]->{'title'};
111 $line{author} = $pendingorders[$i]->{'author'};
112 $line{unitprice} = $pendingorders[$i]->{'unitprice'};
113 $line{ecost} = $pendingorders[$i]->{'ecost'};
114 $line{quantityrecieved} = $pendingorders[$i]->{'quantityreceived'};
115 $line{quantity} = $pendingorders[$i]->{'quantity'};
116 $line{total} = $total;
117 $line{supplierid} = $supplierid;
118 push @loop_orders, \%line;
121 $totalfreight=$freight;
122 $tototal=$tototal+$freight;
124 $template->param(invoice => $invoice,
126 name => $booksellers[0]->{'name'},
127 supplierid => $supplierid,
131 countreceived => $countlines,
132 loop_received => \@loop_received,
133 countpending => $countpendings,
134 loop_orders => \@loop_orders,
135 totalprice => $totalprice,
136 totalfreight => $totalfreight,
137 totalquantity => $totalquantity,
140 grandtot => $tototal+$gst,
141 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
142 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
143 IntranetNav => C4::Context->preference("IntranetNav"),
145 output_html_with_http_headers $input, $cookie, $template->output;