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},
51 $results[0]->{'booksellerid'}=$query->param('id');
52 $results[0]->{'authorisedby'} = $loggedinuser;
54 ($count,@results)=basket($basket);
57 my ($count2,@booksellers)=bookseller($results[0]->{'booksellerid'});
59 my $line_total; # total of each line
60 my $sub_total; # total of line totals
62 my $grand_total; # $subttotal + $gist
66 for (my $i=0;$i<$count;$i++){
67 my $rrp=$results[$i]->{'listprice'};
68 $rrp=curconvert($results[$i]->{'currency'},$rrp);
70 $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'};
71 $sub_total+=$line_total;
72 $gist=sprintf("%.2f",$sub_total*0.125);
73 $grand_total=$sub_total+$gist;
76 $line{color}='#ffffcc';
82 $line{ordernumber} = $results[$i]->{'ordernumber'};
83 $line{isbn} = $results[$i]->{'isbn'};
84 $line{booksellerid} = $results[$i]->{'booksellerid'};
85 $line{basket}=$basket;
86 $line{title} = $results[$i]->{'title'};
87 $line{author} = $results[$i]->{'author'};
89 $line{rrp} = $results[$i]->{'rrp'};
90 $line{ecost} = $results[$i]->{'ecost'};
91 $line{quantity} = $results[$i]->{'quantity'};
92 $line{line_total} = $line_total;
93 $line{biblionumber} = $results[$i]->{'biblionumber'};
94 push @books_loop, \%line;
96 $template->param(basket => $basket,
97 authorisedby => $results[0]->{'authorisedby'},
98 entrydate =>$results[0]->{'entrydate'},
99 id=> $results[0]->{'booksellerid'},
100 name => $booksellers[0]->{'name'},
101 books_loop => \@books_loop,
103 subtotal => $sub_total,
105 grand_total =>$grand_total,
107 output_html_with_http_headers $query, $cookie, $template->output;