5 #script to show display basket of 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;
38 my $basketno = $query ->param('basket');
39 my $booksellerid = $query->param('supplierid');
40 my $order = $query->param('order');
41 my ($template, $loggedinuser, $cookie)
42 = get_template_and_user({template_name => "acqui/basket.tmpl",
46 flagsrequired => {acquisition => 1},
51 my $basket = getbasket($basketno);
52 # FIXME : the query->param('supplierid') below is probably useless. The bookseller is always known from the basket
53 # if no booksellerid in parameter, get it from basket
54 # warn "=>".$basket->{booksellerid};
55 $booksellerid = $basket->{booksellerid} unless $booksellerid;
56 my ($count2,@booksellers)=bookseller($booksellerid);
58 # if new basket, pre-fill infos
59 $basket->{creationdate} = "" unless ($basket->{creationdate});
60 $basket->{authorisedby} = $loggedinuser unless ($basket->{authorisedby});
61 ($count,@results)=getbasketcontent($basketno,'',$order);
63 my $line_total; # total of each line
64 my $sub_total; # total of line totals
66 my $grand_total; # $subttotal + $gist
70 for (my $i=0;$i<$count;$i++){
71 my $rrp=$results[$i]->{'listprice'};
72 $rrp=curconvert($results[$i]->{'currency'},$rrp);
74 $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'};
75 $sub_total+=$line_total;
78 $line{color}='#EEEEEE';
84 $line{ordernumber} = $results[$i]->{'ordernumber'};
85 $line{publishercode} = $results[$i]->{'publishercode'};
86 $line{isbn} = $results[$i]->{'isbn'};
87 $line{booksellerid} = $results[$i]->{'booksellerid'};
88 $line{basketno}=$basketno;
89 $line{title} = $results[$i]->{'title'};
90 $line{author} = $results[$i]->{'author'};
92 $line{rrp} = $results[$i]->{'rrp'};
93 $line{ecost} = $results[$i]->{'ecost'};
94 $line{quantity} = $results[$i]->{'quantity'};
95 $line{quantityrecieved} = $results[$i]->{'quantityreceived'};
96 $line{line_total} = $line_total;
97 $line{biblionumber} = $results[$i]->{'biblionumber'};
98 $line{bookfundid} = $results[$i]->{'bookfundid'};
99 push @books_loop, \%line;
101 my $prefgist =C4::Context->preference("gist");
102 $gist=sprintf("%.2f",$sub_total*$prefgist);
103 $grand_total=$sub_total+$gist;
104 $template->param(basketno => $basketno,
105 creationdate => $basket->{creationdate},
106 authorisedby => $basket->{authorisedby},
107 authorisedbyname => $basket->{authorisedbyname},
108 closedate => format_date($basket->{closedate}),
109 booksellerid=> $booksellers[0]->{'id'},
110 name => $booksellers[0]->{'name'},
111 entrydate => format_date($results[0]->{'entrydate'}),
112 books_loop => \@books_loop,
114 sub_total => $sub_total,
116 grand_total =>$grand_total,
117 currency => $booksellers[0]->{'listprice'},
119 output_html_with_http_headers $query, $cookie, $template->output;