3 #script to add a new item and to mark orders as received
4 #written 1/3/00 by chris@katipo.co.nz
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA 02111-1307 USA
23 # this script makes the items, addorder.pl has already made the biblio and biblioitem records: MASON
46 use C4::Interface::CGI::Output;
52 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
54 template_name => "acqui/finishreceive.tmpl",
58 flagsrequired => { editcatalogue => 1 },
63 my @biblionumber = $input->param('biblionumber');
64 my @ordnum = $input->param('ordernumber');
65 my $cost = $input->param('invoicetotal');
66 my $locacost = $input->param('localtotal');
67 my $invoiceno = $input->param('invoice');
68 my @replacement = $input->param('actual');
69 my @gst = $input->param('gstrate');
70 my $freight = $input->param('actualfreight');
71 my @freightperitem = $input->param('freight');
72 my $supplierid = $input->param('supplierid');
73 my @title = $input->param('title');
74 my $currencyrate=$input->param('currencyrate');
75 my @bookfund = $input->param('bookfund');
76 my @discount = $input->param('discount');
77 my @quantrec = $input->param('received');
78 my $totalreceived=$input->param('totalreceived');
79 my $incgst=$input->param('incgst');
84 my @supplier=GetBookSeller($supplierid);
85 my $count=scalar @quantrec;
88 for (my $i=0; $i<$count;$i++){
89 $freightperitem[$i]=$freight/$totalreceived unless $freightperitem[$i];
90 $listprice=$replacement[$i];
91 $replacement[$i]= $replacement[$i]*$currencyrate;
93 $ecost= ($replacement[$i]*100/($gst[$i]+100))*(100 - $discount[$i])/100;
95 $ecost= $replacement[$i]*(100 - $discount[$i])/100;
97 $unitprice=$ecost + $ecost*$gst[$i]/100;
98 if ( $quantrec[$i] != 0 ) {
99 # save the quantity recieved.
100 ModReceiveOrder( $biblionumber[$i], $ordnum[$i], $quantrec[$i], $unitprice,
101 $invoiceno, $freightperitem[$i], $replacement[$i] ,$listprice,$input );
102 push @additems,{biblionumber=>$biblionumber[$i],itemcount=>$quantrec[$i], title=>$title[$i],supplier=>$supplier[0]->{name},rrp=>$replacement[$i],};
106 $template->param(loopbiblios => \@additems,);
108 output_html_with_http_headers $input, $cookie, $template->output;