6 #script to recieve 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
32 use C4::Interface::CGI::Output;
38 my $supplierid=$input->param('supplierid');
39 my ($count,@booksellers)=bookseller($supplierid);
40 my $invoice=$input->param('code') || '';
41 my $freight=$input->param('freight');
42 my $gst=$input->param('gst');
43 my $date=$input->param('datereceived');
44 my $code=$input->param('code');
46 my ($template, $loggedinuser, $cookie)
47 = get_template_and_user({template_name => "acqui/parcel.tmpl",
51 flagsrequired => {acquisition => 1},
55 my ($countlines,@parcelitems)=getparcelinformation($supplierid,$invoice,$date);
62 my @loop_received = ();
63 for (my $i=0;$i<$countlines;$i++){
64 $total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre)
65 $parcelitems[$i]->{'unitprice'}+=0;
68 $line{color}='#EEEEEE';
74 $line{basketno} = $parcelitems[$i]->{'basketno'};
75 $line{isbn} = $parcelitems[$i]->{'isbn'};
76 $line{ordernumber} = $parcelitems[$i]->{'ordernumber'};
77 $line{biblionumber} = $parcelitems[$i]->{'biblionumber'};
78 $line{invoice} = $invoice;
80 $line{title} = $parcelitems[$i]->{'title'};
81 $line{author} = $parcelitems[$i]->{'author'};
82 $line{unitprice} = $parcelitems[$i]->{'unitprice'};
83 $line{ecost} = $parcelitems[$i]->{'ecost'};
84 $line{quantityrecieved} = $parcelitems[$i]->{'quantityreceived'};
85 $line{quantity} = $parcelitems[$i]->{'quantity'};
86 $line{total} = $total;
87 $line{supplierid} = $supplierid;
88 push @loop_received, \%line;
89 $totalprice+=$parcelitems[$i]->{'unitprice'};
90 $totalfreight+=$parcelitems[$i]->{'freight'};
91 $totalquantity+=$parcelitems[$i]->{'quantityreceived'};
94 my ($countpendings,@pendingorders)=getallorders($supplierid);
96 for (my $i=0;$i<$countpendings;$i++){
99 $line{color}='#EEEEEE';
102 $line{color}='white';
105 $line{basketno} = $pendingorders[$i]->{'basketno'};
106 $line{isbn} = $pendingorders[$i]->{'isbn'};
107 $line{ordernumber} = $pendingorders[$i]->{'ordernumber'};
108 $line{biblionumber} = $pendingorders[$i]->{'biblionumber'};
109 $line{invoice} = $invoice;
111 $line{title} = $pendingorders[$i]->{'title'};
112 $line{author} = $pendingorders[$i]->{'author'};
113 $line{unitprice} = $pendingorders[$i]->{'unitprice'};
114 $line{ecost} = $pendingorders[$i]->{'ecost'};
115 $line{quantityrecieved} = $pendingorders[$i]->{'quantityreceived'};
116 $line{quantity} = $pendingorders[$i]->{'quantity'};
117 $line{total} = $total;
118 $line{supplierid} = $supplierid;
119 push @loop_orders, \%line;
122 $totalfreight=$freight;
123 $tototal=$tototal+$freight;
125 $template->param(invoice => $invoice,
127 name => $booksellers[0]->{'name'},
128 supplierid => $supplierid,
132 countreceived => $countlines,
133 loop_received => \@loop_received,
134 countpending => $countpendings,
135 loop_orders => \@loop_orders,
136 totalprice => $totalprice,
137 totalfreight => $totalfreight,
138 totalquantity => $totalquantity,
141 grandtot => $tototal+$gst,
142 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
143 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
144 IntranetNav => C4::Context->preference("IntranetNav"),
146 output_html_with_http_headers $input, $cookie, $template->output;