3 #script to show display basket of orders
4 #written by chris@katipo.co.nz 24/2/2000
15 print $input->header();
16 my $id=$input->param('id');
17 my $title=$input->param('title');
18 my $author=$input->param('author');
19 my $copyright=$input->param('copyright');
20 my ($count,@booksellers)=bookseller($id);
21 my $ordnum=$input->param('ordnum');
22 my $biblio=$input->param('biblio');
29 $data=bibdata($biblio);
31 if ($data->{'title'} eq ''){
32 $data->{'title'}=$title;
33 $data->{'author'}=$author;
34 $data->{'copyrightdate'}=$copyright;
37 $data=getsingleorder($ordnum);
38 $biblio=$data->{'biblionumber'};
43 print startmenu('acquisitions');
46 my $basket=$input->param('basket');
50 <script language="javascript" type="text/javascript">
56 quantity=f.quantity.value
57 discount=f.discount.value
58 listinc=parseInt(f.listinc.value)
59 currency=f.currency.value
60 applygst=parseInt(f.applygst.value)
61 listprice=f.list_price.value
63 // ecost=f.ecost.value //budgetted cost
65 // total=f.total.value
66 //make useful constants out of the above
67 exchangerate=f.elements[currency].value //get exchange rate
68 gst_on=(!listinc && applygst);
70 rrp=listprice*exchangerate;
71 ecost=rrp*(100-discount)/100
78 total=(ecost+GST)*quantity
81 f.rrp.value=display(rrp)
82 f.ecost.value=display(ecost)
83 f.GST.value=display(GST)
84 f.total.value=display(total)
90 function messenger(X,Y,etc){
91 win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
94 win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size=2><p><br>");
95 win.document.write(etc);
96 win.document.write("<center><form><input type=button onclick='self.close()' value=Close></form></center>");
97 win.document.write("</font></body></html>");
102 <form action=/cgi-bin/koha/acqui/addorder.pl method=post name=frusin>
107 print "<input type=hidden name=existing value=no>";
112 <input type=hidden name=ordnum value=$ordnum>
113 <input type=hidden name=basket value=$basket>
114 <input type=hidden name=supplier value=$id>
115 <input type=hidden name=biblio value=$biblio>
116 <input type=hidden name=bibitemnum value=$data->{'biblioitemnumber'}>
117 <input type=hidden name=oldtype value=$data->{'itemtype'}>
118 <input type=hidden name=discount value=$booksellers[0]->{'discount'}>
119 <input type=hidden name=listinc value=$booksellers[0]->{'listincgst'}>
120 <input type=hidden name=currency value=$booksellers[0]->{'listprice'}>
121 <input type=hidden name=applygst value=$booksellers[0]->{'gstreg'}>
124 my ($count2,$currencies)=getcurrencies;
125 for (my $i=0;$i<$count2;$i++){
126 print "<input type=hidden name=\"$currencies->[$i]->{'currency'}\" value=$currencies->[0]->{'rate'}>\n";
129 print "<input type=hidden name=orderexists value=yes>\n";
132 <a href=basket.pl?basket=$basket><img src=/images/view-basket.gif width=187 heigth=42 border=0 align=right alt="View Basket"></a>
133 <FONT SIZE=6><em>$ordnum - Order Details </em></FONT><br>
134 Shopping Basket For: $booksellers[0]->{'name'}
137 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="40%">
138 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>CATALOGUE DETAILS</B></td></tr>
140 <TD><b>Title *</b></td>
141 <td><input type=text size=20 name=title value="$data->{'title'}">
146 <td><input type=text size=20 name=author value="$data->{'author'}" >
150 <TD>Copyright Date</td>
151 <td><input type=text size=20 name=copyright value="$data->{'copyrightdate'}">
157 <select name=format size=1>
162 my $query="Select itemtype,description from itemtypes order by description";
163 my $sth=$dbh->prepare($query);
165 print "<option value=\"\">Please choose:\n";
166 while (my $data2=$sth->fetchrow_hashref){
167 if ($data2->{'itemtype'} eq $data->{'itemtype'}) {
168 print "<option value=\"" . $data2->{'itemtype'} . "\" SELECTED>" . $data2->{'description'} . "\n";
170 print "<option value=\"" . $data2->{'itemtype'} . "\">" . $data2->{'description'} . "\n";
184 <td><input type=text size=20 name=ISBN value=$data->{'isbn'}>
189 <td><input type=text size=20 name=Series value="$data->{'seriestitle'}">
194 <td><select name=branch size=1>
198 ($count2,@branches)=branches();
199 for (my $i=0;$i<$count2;$i++){
200 print "<option value=$branches[$i]->{'branchcode'}";
201 if ($data->{'branchcode'} == $branches[$i]->{'branchcode'}){
204 print ">$branches[$i]->{'branchname'}";
211 <TR VALIGN=TOP bgcolor=#ffffcc>
212 <TD >Item Barcode</td>
213 <td><input type=text size=20 name=barcode value=
217 my %systemprefs=systemprefs();
218 if ($systemprefs{'autoBarcode'} eq '1') {
220 my $query="Select barcode from items order by barcode desc";
221 my $sth=$dbh->prepare($query);
223 my $data=$sth->fetchrow_hashref;
224 print $data->{'barcode'}+1;
234 <img src="/images/holder.gif" width=32 height=250 align=left>
235 <table border=1 cellspacing=0 cellpadding=5 width="40%">
236 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>ACCOUNTING DETAILS</B></td></tr>
239 <td><input type=text size=20 name=quantity value="$data->{'quantity'}" onchange='update(this.form)' >
244 <td><select name=bookfund size=1>
249 ($count2,@bookfund)=bookfunds();
250 for (my $i=0;$i<$count2;$i++){
251 print "<option value=$bookfund[$i]->{'bookfundid'}";
252 if ($data->{'bookfundid'} == $bookfund[$i]->{'bookfundid'}){
255 print ">$bookfund[$i]->{'bookfundname'}";
263 <TD>Suppliers List Price</td>
264 <td><input type=text size=20 name=list_price value="$data->{'listprice'}" onchange='update(this.form)'>
267 <TD>Replacement Cost <br>
268 <FONT SIZE=2>(NZ\$ inc GST)</td>
269 <td><input type=text size=20 name=rrp value="$data->{'rrp'}" onchange='update(this.form)'>
274 <FONT SIZE=2>(NZ\$ ex GST, inc discount)</FONT> </td>
275 <td><input type=text size=20 name=ecost value="$data->{'ecost'}" onchange='update(this.form)'>
281 <td><input type=text size=20 name=GST value="" onchange='update(this.form)'>
286 BUDGETED TOTAL</B></td>
287 <td><input type=text size=20 name=total value="" onchange='update(this.form)'>
290 <TR VALIGN=TOP bgcolor=#ffffcc>
292 <td><input type=text size=20 name=cost>
295 <TR VALIGN=TOP bgcolor=#ffffcc>
296 <TD>Invoice Number *</td>
297 <td><input type=text size=20 name=invoice >
300 <td><input type=text size=20 name=notes value="$data->{'notes'}">
305 <input type=image name=submit src=/images/add-order.gif border=0 width=187 height=42 align=right>
312 <tr><td bgcolor=#cccc99 background="/images/background-mem.gif"><B>HELP</B><br>
314 <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>
315 <LI><B>Bold</B> fields must be filled in to create a new bibilo and item.<p>
316 <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.
323 print endmenu('acquisitions');