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 $basket=$query ->param('basket');
39 my ($template, $loggedinuser, $cookie)
40 = get_template_and_user({template_name => "acqui/basket.tmpl",
44 flagsrequired => {acquisition => 1},
50 $results[0]->{'booksellerid'}=$query->param('id');
51 $results[0]->{'authorisedby'} = $loggedinuser;
53 ($count,@results)=basket($basket);
56 my ($count2,@booksellers)=bookseller($results[0]->{'booksellerid'});
58 my $line_total; # total of each line
59 my $sub_total; # total of line totals
61 my $grand_total; # $subttotal + $gist
65 for (my $i=0;$i<$count;$i++){
66 my $rrp=$results[$i]->{'listprice'};
67 $rrp=curconvert($results[$i]->{'currency'},$rrp);
69 $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'};
70 $sub_total+=$line_total;
73 $line{color}='#ffffcc';
79 $line{ordernumber} = $results[$i]->{'ordernumber'};
80 $line{isbn} = $results[$i]->{'isbn'};
81 $line{booksellerid} = $results[$i]->{'booksellerid'};
82 $line{basket}=$basket;
83 $line{title} = $results[$i]->{'title'};
84 $line{author} = $results[$i]->{'author'};
86 $line{rrp} = $results[$i]->{'rrp'};
87 $line{ecost} = $results[$i]->{'ecost'};
88 $line{quantity} = $results[$i]->{'quantity'};
89 $line{line_total} = $line_total;
90 $line{biblionumber} = $results[$i]->{'biblionumber'};
91 push @books_loop, \%line;
93 $gist=sprintf("%.2f",$sub_total*C4::Context->preference("gist"));
94 $grand_total=$sub_total+$gist;
96 $template->param(basket => $basket,
97 authorisedby => $results[0]->{'authorisedby'},
98 entrydate => format_date($results[0]->{'entrydate'}),
99 id=> $results[0]->{'booksellerid'},
100 name => $booksellers[0]->{'name'},
101 books_loop => \@books_loop,
103 sub_total => $sub_total,
105 grand_total =>$grand_total,
106 currency => $booksellers[0]->{'listprice'},
108 output_html_with_http_headers $query, $cookie, $template->output;