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('invoice');
40 my $freight=$input->param('freight');
41 my $gst=$input->param('gst');
42 my $date=localtime(time);
44 my ($template, $loggedinuser, $cookie)
45 = get_template_and_user({template_name => "acqui/recieve.tmpl",
49 flagsrequired => {acquisition => 1},
54 ($count,@results)=invoice($invoice);
56 ($count,@results)=getallorders($supplierid);
65 for (my$i=0;$i<$count;$i++){
66 $total=($results[$i]->{'unitprice'} + $results[$i]->{'freight'}) * $results[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre)
67 $results[$i]->{'unitprice'}+=0;
70 $line{color}='#EEEEEE';
76 $line{basketno} = $results[$i]->{'basketno'};
77 $line{isbn} = $results[$i]->{'isbn'};
78 $line{ordernumber} = $results[$i]->{'ordernumber'};
79 $line{biblionumber} = $results[$i]->{'biblionumber'};
80 $line{invoice} = $invoice;
82 $line{title} = $results[$i]->{'title'};
83 $line{author} = $results[$i]->{'author'};
84 $line{unitprice} = $results[$i]->{'unitprice'};
85 $line{quantityrecieved} = $results[$i]->{'quantityreceived'};
86 $line{total} = $total;
87 $line{supplierid} = $supplierid;
88 push @loop_orders, \%line;
89 $totalprice+=$results[$i]->{'unitprice'};
90 $totalfreight+=$results[$i]->{'freight'};
91 $totalquantity+=$results[$i]->{'quantityreceived'};
95 $totalfreight=$freight;
96 $tototal=$tototal+$freight;
98 $template->param(invoice => $invoice,
100 name => $booksellers[0]->{'name'},
101 supplierid => $supplierid,
106 loop_orders => \@loop_orders,
107 totalprice => $totalprice,
108 totalfreight => $totalfreight,
109 totalquantity => $totalquantity,
112 grandtot => $tototal+$gst,
114 output_html_with_http_headers $input, $cookie, $template->output;