3 #script to show display basket of orders
4 #written by chris@katipo.co.nz 24/2/2000
7 # Copyright 2000-2002 Katipo Communications
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307 USA
33 print $input->header();
34 my $id=$input->param('id');
35 my $title=$input->param('title');
36 my $author=$input->param('author');
37 my $copyright=$input->param('copyright');
38 my ($count,@booksellers)=bookseller($id);
39 my $ordnum=$input->param('ordnum');
40 my $biblio=$input->param('biblio');
47 $data=bibdata($biblio);
49 if ($data->{'title'} eq ''){
50 $data->{'title'}=$title;
51 $data->{'author'}=$author;
52 $data->{'copyrightdate'}=$copyright;
55 $data=getsingleorder($ordnum);
56 $biblio=$data->{'biblionumber'};
61 print startmenu('acquisitions');
64 my $basket=$input->param('basket');
68 <script language="javascript" type="text/javascript">
74 quantity=f.quantity.value
75 discount=f.discount.value
76 listinc=parseInt(f.listinc.value)
77 currency=f.currency.value
78 applygst=parseInt(f.applygst.value)
79 listprice=f.list_price.value
81 // ecost=f.ecost.value //budgetted cost
83 // total=f.total.value
84 //make useful constants out of the above
85 exchangerate=f.elements[currency].value //get exchange rate
86 gst_on=(!listinc && applygst);
88 rrp=listprice*exchangerate;
89 ecost=rrp*(100-discount)/100
96 total=(ecost+GST)*quantity
99 f.rrp.value=display(rrp)
100 f.ecost.value=display(ecost)
101 f.GST.value=display(GST)
102 f.total.value=display(total)
108 function messenger(X,Y,etc){
109 win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
111 win.document.close();
112 win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size=2><p><br>");
113 win.document.write(etc);
114 win.document.write("<center><form><input type=button onclick='self.close()' value=Close></form></center>");
115 win.document.write("</font></body></html>");
120 <form action=/cgi-bin/koha/acqui/addorder.pl method=post name=frusin>
125 print "<input type=hidden name=existing value=no>";
130 <input type=hidden name=ordnum value=$ordnum>
131 <input type=hidden name=basket value=$basket>
132 <input type=hidden name=supplier value=$id>
133 <input type=hidden name=biblio value=$biblio>
134 <input type=hidden name=bibitemnum value=$data->{'biblioitemnumber'}>
135 <input type=hidden name=oldtype value=$data->{'itemtype'}>
136 <input type=hidden name=discount value=$booksellers[0]->{'discount'}>
137 <input type=hidden name=listinc value=$booksellers[0]->{'listincgst'}>
138 <input type=hidden name=currency value=$booksellers[0]->{'listprice'}>
139 <input type=hidden name=applygst value=$booksellers[0]->{'gstreg'}>
142 my ($count2,$currencies)=getcurrencies;
143 for (my $i=0;$i<$count2;$i++){
144 print "<input type=hidden name=\"$currencies->[$i]->{'currency'}\" value=$currencies->[0]->{'rate'}>\n";
147 print "<input type=hidden name=orderexists value=yes>\n";
150 <a href=basket.pl?basket=$basket><img src=/images/view-basket.gif width=187 heigth=42 border=0 align=right alt="View Basket"></a>
151 <FONT SIZE=6><em>$ordnum - Order Details </em></FONT><br>
152 Shopping Basket For: $booksellers[0]->{'name'}
155 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="40%">
156 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>CATALOGUE DETAILS</B></td></tr>
158 <TD><b>Title *</b></td>
159 <td><input type=text size=20 name=title value="$data->{'title'}">
164 <td><input type=text size=20 name=author value="$data->{'author'}" >
168 <TD>Copyright Date</td>
169 <td><input type=text size=20 name=copyright value="$data->{'copyrightdate'}">
175 <select name=format size=1>
179 my $dbh = C4::Context->dbh;
180 my $query="Select itemtype,description from itemtypes order by description";
181 my $sth=$dbh->prepare($query);
183 print "<option value=\"\">Please choose:\n";
184 while (my $data2=$sth->fetchrow_hashref){
185 if ($data2->{'itemtype'} eq $data->{'itemtype'}) {
186 print "<option value=\"" . $data2->{'itemtype'} . "\" SELECTED>" . $data2->{'description'} . "\n";
188 print "<option value=\"" . $data2->{'itemtype'} . "\">" . $data2->{'description'} . "\n";
201 <td><input type=text size=20 name=ISBN value=$data->{'isbn'}>
206 <td><input type=text size=20 name=Series value="$data->{'seriestitle'}">
211 <td><select name=branch size=1>
215 ($count2,@branches)=branches();
216 for (my $i=0;$i<$count2;$i++){
217 print "<option value=$branches[$i]->{'branchcode'}";
218 if ($data->{'branchcode'} == $branches[$i]->{'branchcode'}){
221 print ">$branches[$i]->{'branchname'}";
228 <TR VALIGN=TOP bgcolor=#ffffcc>
229 <TD >Item Barcode</td>
230 <td><input type=text size=20 name=barcode value=
234 my $auto_barcode = C4::Context->preference("autoBarcode") || 0;
235 # See whether barcodes should be automatically allocated.
236 # Defaults to 0, meaning "no".
237 if ($auto_barcode eq '1') {
238 my $dbh = C4::Context->dbh;
239 my $query="Select barcode from items order by barcode desc";
240 my $sth=$dbh->prepare($query);
242 my $data=$sth->fetchrow_hashref;
243 print $data->{'barcode'}+1;
252 <img src="/images/holder.gif" width=32 height=250 align=left>
253 <table border=1 cellspacing=0 cellpadding=5 width="40%">
254 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>ACCOUNTING DETAILS</B></td></tr>
257 <td><input type=text size=20 name=quantity value="$data->{'quantity'}" onchange='update(this.form)' >
262 <td><select name=bookfund size=1>
267 ($count2,@bookfund)=bookfunds();
268 for (my $i=0;$i<$count2;$i++){
269 print "<option value=$bookfund[$i]->{'bookfundid'}";
270 if ($data->{'bookfundid'} == $bookfund[$i]->{'bookfundid'}){
273 print ">$bookfund[$i]->{'bookfundname'}";
281 <TD>Suppliers List Price</td>
282 <td><input type=text size=20 name=list_price value="$data->{'listprice'}" onchange='update(this.form)'>
285 <TD>Replacement Cost <br>
286 <FONT SIZE=2>(NZ\$ inc GST)</td>
287 <td><input type=text size=20 name=rrp value="$data->{'rrp'}" onchange='update(this.form)'>
292 <FONT SIZE=2>(NZ\$ ex GST, inc discount)</FONT> </td>
293 <td><input type=text size=20 name=ecost value="$data->{'ecost'}" onchange='update(this.form)'>
299 <td><input type=text size=20 name=GST value="" onchange='update(this.form)'>
304 BUDGETED TOTAL</B></td>
305 <td><input type=text size=20 name=total value="" onchange='update(this.form)'>
308 <TR VALIGN=TOP bgcolor=#ffffcc>
310 <td><input type=text size=20 name=cost>
313 <TR VALIGN=TOP bgcolor=#ffffcc>
314 <TD>Invoice Number *</td>
315 <td><input type=text size=20 name=invoice >
318 <td><input type=text size=20 name=notes value="$data->{'notes'}">
323 <input type=image name=submit src=/images/add-order.gif border=0 width=187 height=42 align=right>
330 <tr><td bgcolor=#cccc99 background="/images/background-mem.gif"><B>HELP</B><br>
332 <LI>If ordering more than one copy of an item you will be prompted to choose additional bookfunds, and put in additional barcodes at the next screen<P>
333 <LI><B>Bold</B> fields must be filled in to create a new bibilo and item.<p>
334 <LI>Shaded fields can be used to do a "quick" receive, when items have been purchased locally or gifted. In this case the quantity "ordered" will also be entered into the database as the quantity received.
341 print endmenu('acquisitions');