Long is the road to MARC..
[koha.git] / acqui / basket.pl
1 #!/usr/bin/perl
2
3 #script to show display basket of orders
4 #written by chris@katipo.co.nz 24/2/2000
5
6 use C4::Catalogue;
7 use C4::Biblio;
8 use C4::Output;
9 use CGI;
10 use strict;
11
12 my $input=new CGI;
13 print $input->header();
14 my $basket=$input->param('basket');
15 my ($count,@results)=basket($basket);
16 print startpage;
17
18 my @inp=startmenu('acquisitions');
19
20 my $count3=@inp;
21 for (my $i=0;$i<$count3;$i++){
22       $inp[$i]=~ s/leftmargin=0 topmargin=0\>/leftmargin=0 topmargin=0 onload='update(orderform)'\>/;
23     }
24 print @inp;
25 # print $count;
26 my ($count2,@booksellers)=bookseller($results[0]->{'booksellerid'});
27
28 print <<printend
29 <div align=right>
30 Our Reference: $basket<br>
31 Authorised By: $results[0]->{'authorisedby'}<br>
32 $results[0]->{'entrydate'};
33 </div>
34 <FONT SIZE=6><em>Shopping Basket For: <a href=supplier.pl?id=$results[0]->{'booksellerid'}></a> $booksellers[0]->{'name'}</em></FONT>  
35 <a href=newbasket.pl?id=$results[0]->{'booksellerid'}&basket=$basket>Add more orders</a>
36 <CENTER>
37 <FORM ACTION="/cgi-bin/koha/search.pl" method=post>
38  <b>Search ISBN, Title or Author:</b> <INPUT TYPE="text"  SIZE="25"   NAME="recieve">
39 </form>
40 <p>
41 <FORM ACTION="/cgi-bin/koha/acqui/modorders.pl" method=post name=orderform>
42 <table border=0 cellspacing=0 cellpadding=5>
43 <tr valign=top bgcolor=#99cc33>
44   <td background="/images/background-mem.gif"><b>ORDER</b></td>
45   <td background="/images/background-mem.gif"><b>ISBN</b></td>
46   <td background="/images/background-mem.gif"><b>TITLE</b></td>
47   <td background="/images/background-mem.gif"><b>AUTHOR</b></td>
48   <td background="/images/background-mem.gif"><b>RRP</b></td>
49   <td background="/images/background-mem.gif"><b>\$EST</b></td>
50   <td background="/images/background-mem.gif"><b>QUANTITY</b></td>
51   <td background="/images/background-mem.gif"><b>TOTAL</b></td></tr>
52 printend
53 ;
54
55
56 my $line_total; # total of each line
57 my $sub_total; # total of line totals
58 my $gist;      # GST
59 my $grand_total; # $subttotal + $gist
60
61 for (my $i=0;$i<$count;$i++){
62 my $rrp=$results[$i]->{'listprice'};
63 if ($results[$i]->{'currency'} ne 'NZD'){
64 $rrp=curconvert($results[$i]->{'currency'},$rrp);
65 }
66
67 $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'};
68 $sub_total+=$line_total;
69 $gist=sprintf("%.2f",$sub_total*0.125);
70 $grand_total=$sub_total+$gist;
71
72 print <<EOP      
73 <tr valign=top bgcolor=#ffffcc>
74   <td>$results[$i]->{'ordernumber'}</td>
75   <td>$results[$i]->{'isbn'}</td>
76   <td><a href="newbiblio.pl?ordnum=$results[$i]->{'ordernumber'}&id=$results[$i]->{'booksellerid'}&basket=$basket">$results[$i]->{'title'}</a></td>
77   <td>$results[$i]->{'author'}</td>
78   <td>\$<input type=text name=rrp$i size=6 value="$results[$i]->{'rrp'}"></td>
79   <td>\$<input type=text name=eup$i size=6 value="$results[$i]->{'ecost'}"></td>
80   <td><input type=text name=quantity$i size=6 value=$results[$i]->{'quantity'} onchange='update(this.form)'></td>
81   <td>\$<input type=text name=total$i size=10 value=$line_total></td>
82   <input type=hidden name=ordnum$i value=$results[$i]->{'ordernumber'}>
83   <input type=hidden name=bibnum$i value=$results[$i]->{'biblionumber'}> 
84 </tr>
85 EOP
86 ;
87 }
88
89 print "<input type=hidden name=number value=$count>
90 <input type=hidden name=basketno value=\"$basket\">";
91 print <<EOP
92 <tr valign=top bgcolor=white><td colspan=6 rowspan=3  bgcolor=#cccc99  background="/images/background-mem.gif">
93   <b>HELP</b><br>
94   To cancel an order, just change the quantity to 0 and click "save changes".<br>
95   To change any of the catalogue or accounting information attached to an order,  click on the title.<br>
96   To add new orders to this supplier, start with a search. </td> 
97   <td><b>SubTotal</b></td>
98   <td>\$<input type=text name=subtotal size=10 value=$sub_total></td></tr>
99 <tr valign=top bgcolor=white>
100   <td><b>GST</b></td>
101   <td>\$<input type=text name=gst size=10 value=$gist></td></tr>
102 <tr valign=top bgcolor=white><td><b>TOTAL</b></td>
103   <td>\$<input type=text name=grandtotal size=10 value=$grand_total></td></tr>
104 <tr valign=top bgcolor=white>
105   <td></td>
106   <td></td>
107   <td></td>
108   <td></td>
109   <td></td>
110   <td></td>
111   <td colspan=3><input type=image  name=submit src=/images/save-changes.gif border=0 width=187 height=42 align=right></td></tr>
112 </table>
113 </CENTER>  
114 EOP
115   ;
116
117 print endmenu('acquisitions');
118
119 print endpage;