3 #script to show display basket of orders
4 #written by chris@katipo.co.nz 24/2/2000
14 print $input->header();
15 my $id=$input->param('id');
16 my $title=$input->param('title');
17 my $author=$input->param('author');
18 my $copyright=$input->param('copyright');
19 my ($count,@booksellers)=bookseller($id);
20 my $ordnum=$input->param('ordnum');
21 my $biblio=$input->param('biblio');
28 $data=bibdata($biblio);
30 if ($data->{'title'} eq ''){
31 $data->{'title'}=$title;
32 $data->{'author'}=$author;
33 $data->{'copyrightdate'}=$copyright;
36 $data=getsingleorder($ordnum);
37 $biblio=$data->{'biblionumber'};
42 print startmenu('acquisitions');
45 my $basket=$input->param('basket');
49 <script language="javascript" type="text/javascript">
55 quantity=f.quantity.value
56 discount=f.discount.value
57 listinc=parseInt(f.listinc.value)
58 currency=f.currency.value
59 applygst=parseInt(f.applygst.value)
60 listprice=f.list_price.value
62 // ecost=f.ecost.value //budgetted cost
64 // total=f.total.value
65 //make useful constants out of the above
66 exchangerate=f.elements[currency].value //get exchange rate
67 gst_on=(!listinc && applygst);
69 rrp=listprice*exchangerate;
70 ecost=rrp*(100-discount)/100
77 total=(ecost+GST)*quantity
80 f.rrp.value=display(rrp)
81 f.ecost.value=display(ecost)
82 f.GST.value=display(GST)
83 f.total.value=display(total)
89 function messenger(X,Y,etc){
90 win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
93 win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size=2><p><br>");
94 win.document.write(etc);
95 win.document.write("<center><form><input type=button onclick='self.close()' value=Close></form></center>");
96 win.document.write("</font></body></html>");
101 <form action=/cgi-bin/koha/acqui/addorder.pl method=post name=frusin>
106 print "<input type=hidden name=existing value=no>";
111 <input type=hidden name=ordnum value=$ordnum>
112 <input type=hidden name=basket value=$basket>
113 <input type=hidden name=supplier value=$id>
114 <input type=hidden name=biblio value=$biblio>
115 <input type=hidden name=bibitemnum value=$data->{'biblioitemnumber'}>
116 <input type=hidden name=oldtype value=$data->{'itemtype'}>
117 <input type=hidden name=discount value=$booksellers[0]->{'discount'}>
118 <input type=hidden name=listinc value=$booksellers[0]->{'listincgst'}>
119 <input type=hidden name=currency value=$booksellers[0]->{'listprice'}>
120 <input type=hidden name=applygst value=$booksellers[0]->{'gstreg'}>
123 my ($count2,$currencies)=getcurrencies;
124 for (my $i=0;$i<$count2;$i++){
125 print "<input type=hidden name=\"$currencies->[$i]->{'currency'}\" value=$currencies->[0]->{'rate'}>\n";
128 print "<input type=hidden name=orderexists value=yes>\n";
131 <a href=basket.pl?basket=$basket><img src=/images/view-basket.gif width=187 heigth=42 border=0 align=right alt="View Basket"></a>
132 <FONT SIZE=6><em>$ordnum - Order Details </em></FONT><br>
133 Shopping Basket For: $booksellers[0]->{'name'}
136 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="40%">
137 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>CATALOGUE DETAILS</B></td></tr>
139 <TD><b>Title *</b></td>
140 <td><input type=text size=20 name=title value="$data->{'title'}">
145 <td><input type=text size=20 name=author value="$data->{'author'}" >
149 <TD>Copyright Date</td>
150 <td><input type=text size=20 name=copyright value="$data->{'copyrightdate'}">
156 <select name=format size=1>
161 my $query="Select itemtype,description from itemtypes order by description";
162 my $sth=$dbh->prepare($query);
164 print "<option value=\"\">Please choose:\n";
165 while (my $data=$sth->fetchrow_hashref){
166 print "<option value=\"" . $data->{'itemtype'} . "\">" . $data->{'description'} . "\n";
179 <td><input type=text size=20 name=ISBN value=$data->{'isbn'}>
184 <td><input type=text size=20 name=Series value="$data->{'seriestitle'}">
189 <td><select name=branch size=1>
192 my ($count2,@branches)=branches;
193 for (my $i=0;$i<$count2;$i++){
194 print "<option value=$branches[$i]->{'branchcode'}";
195 if ($data->{'branchcode'} == $branches[$i]->{'branchcode'}){
198 print ">$branches[$i]->{'branchname'}";
205 <TR VALIGN=TOP bgcolor=#ffffcc>
206 <TD >Item Barcode</td>
207 <td><input type=text size=20 name=barcode value=
211 my %systemprefs=systemprefs();
212 if ($systemprefs{'autoBarcode'} eq '1') {
214 my $query="Select barcode from items order by barcode desc";
215 my $sth=$dbh->prepare($query);
217 my $data=$sth->fetchrow_hashref;
218 print $data->{'barcode'}+1;
228 <img src="/images/holder.gif" width=32 height=250 align=left>
229 <table border=1 cellspacing=0 cellpadding=5 width="40%">
230 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>ACCOUNTING DETAILS</B></td></tr>
233 <td><input type=text size=20 name=quantity value="$data->{'quantity'}" onchange='update(this.form)' >
238 <td><select name=bookfund size=1>
242 my ($count2,@bookfund)=bookfunds;
243 for (my $i=0;$i<$count2;$i++){
244 print "<option value=$bookfund[$i]->{'bookfundid'}";
245 if ($data->{'bookfundid'} == $bookfund[$i]->{'bookfundid'}){
248 print ">$bookfund[$i]->{'bookfundname'}";
256 <TD>Suppliers List Price</td>
257 <td><input type=text size=20 name=list_price value="$data->{'listprice'}" onchange='update(this.form)'>
260 <TD>Replacement Cost <br>
261 <FONT SIZE=2>(NZ\$ inc GST)</td>
262 <td><input type=text size=20 name=rrp value="$data->{'rrp'}" onchange='update(this.form)'>
267 <FONT SIZE=2>(NZ\$ ex GST, inc discount)</FONT> </td>
268 <td><input type=text size=20 name=ecost value="$data->{'ecost'}" onchange='update(this.form)'>
274 <td><input type=text size=20 name=GST value="" onchange='update(this.form)'>
279 BUDGETED TOTAL</B></td>
280 <td><input type=text size=20 name=total value="" onchange='update(this.form)'>
283 <TR VALIGN=TOP bgcolor=#ffffcc>
285 <td><input type=text size=20 name=cost>
288 <TR VALIGN=TOP bgcolor=#ffffcc>
289 <TD>Invoice Number *</td>
290 <td><input type=text size=20 name=invoice >
293 <td><input type=text size=20 name=notes value="$data->{'notes'}">
298 <input type=image name=submit src=/images/add-order.gif border=0 width=187 height=42 align=right>
305 <tr><td bgcolor=#cccc99 background="/images/background-mem.gif"><B>HELP</B><br>
307 <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>
308 <LI><B>Bold</B> fields must be filled in to create a new bibilo and item.<p>
309 <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.
316 print endmenu('acquisitions');