3 #script to recieve 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');
38 print startmenu('acquisitions');
40 my $search=$input->param('recieve');
41 my $invoice=$input->param('invoice');
42 my $freight=$input->param('freight');
43 my $biblio=$input->param('biblio');
44 my $catview=$input->param('catview');
45 my $gst=$input->param('gst');
46 my ($count,@results)=ordersearch($search,$biblio,$catview);
47 my ($count2,@booksellers)=bookseller($results[0]->{'booksellerid'});
49 my @date=split('-',$results[0]->{'entrydate'});
50 my $date="$date[2]/$date[1]/$date[0]";
57 <script language="javascript" type="text/javascript">
59 function messenger(X,Y,etc){
60 win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
63 win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size=2><p><br>");
64 win.document.write(etc);
65 win.document.write("<center><form><input type=button onclick='self.close()' value=Close></form></center>");
66 win.document.write("</font></body></html>");
70 <form action="/cgi-bin/koha/acqui/finishreceive.pl" method=post>
71 <input type=hidden name=biblio value=$results[0]->{'biblionumber'}>
72 <input type=hidden name=ordnum value=$results[0]->{'ordernumber'}>
73 <input type=hidden name=biblioitemnum value=$results[0]->{'biblioitemnumber'}>
74 <input type=hidden name=bookseller value=$results[0]->{'booksellerid'}>
75 <input type=hidden name=freight value=$freight>
76 <input type=hidden name=gst value=$gst>
79 if ($catview ne 'yes'){
80 print "<input type=image name=submit src=/images/save-changes.gif border=0 width=187 height=42 align=right>";
82 print "<a href=/cgi-bin/koha/acqui/newbiblio.pl?ordnum=$results[0]->{'ordernumber'}&id=$results[0]->{'booksellerid'}><img src=/images/modify-mem.gif align=right border=0></a>";
85 <FONT SIZE=6><em>$results[0]->{'ordernumber'} - Receive Order</em></FONT><br>
86 Shopping Basket For: $booksellers[0]->{'name'}
87 <br> Order placed: $date
90 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="40%">
91 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>CATALOGUE DETAILS</B></td></tr>
94 <TD><b>Title *</b></td>
95 <td><input type=text size=20 name=title value="$results[0]->{'title'}" >
100 <td><input type=text size=20 name=author value="$results[0]->{'author'}" >
104 <TD>Copyright Date</td>
105 <td><input type=text size=20 name=copyright value="$results[0]->{'copyrightdate'}" >
112 <select name=format size=1>
116 my $dbh = C4::Context->dbh;
117 my $query="Select itemtype,description from itemtypes order by description";
118 my $sth=$dbh->prepare($query);
120 while (my $data=$sth->fetchrow_hashref){
121 if ($data->{'itemtype'} eq $results[0]->{'itemtype'}) {
122 print "<option SELECTED value=\"" . $data->{'itemtype'} . "\">" . $data->{'description'} . "\n";
124 print "<option value=\"" . $data->{'itemtype'} . "\">" . $data->{'description'} . "\n";
138 <td><input type=text size=20 name=ISBN value="$results[0]->{'isbn'}">
145 <td><input type=text size=20 name=Series value="$results[0]->{'seriestitle'}">
151 <td><select name=branch size=1>
154 my ($count2,@branches)=branches();
155 for (my $i=0;$i<$count2;$i++){
156 print "<option value=$branches[$i]->{'branchcode'}";
157 if ($results[0]->{'branchcode'} == $branches[$i]->{'branchcode'}){
160 print ">$branches[$i]->{'branchname'}";
167 <TR VALIGN=TOP bgcolor=#ffffcc >
168 <TD><B>Item Barcode *</B></td>
170 <td><input type=text size=20 name=barcode value=
174 my $auto_barcode = C4::Context->preference("autoBarcode") || 0;
175 # See whether barcodes should be automatically allocated.
176 # Defaults to 0, meaning "no".
177 if ($auto_barcode eq '1') {
178 my $dbh = C4::Context->dbh;
179 my $query="Select barcode from items order by barcode desc";
180 my $sth=$dbh->prepare($query);
182 my $data=$sth->fetchrow_hashref;
183 print $data->{'barcode'}+1;
192 <TR VALIGN=TOP bgcolor=#ffffcc >
193 <TD><B>Volume Info (for serials) *</B></td>
195 <td><input type=text size=20 name=volinf>
202 <img src="/images/holder.gif" width=32 height=250 align=left>
204 <table border=1 cellspacing=0 cellpadding=5 width="40%">
206 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>ACCOUNTING DETAILS</B></td></tr>
208 <TD><B>Bookfund *</B></td>
209 <td><select name=bookfund size=1>
213 ($count2,@bookfund)=bookfunds();
214 for (my $i=0;$i<$count2;$i++){
215 print "<option value=$bookfund[$i]->{'bookfundid'}";
216 if ($bookfund[$i]->{'bookfundid'}==$results[0]->{'bookfundid'}){
219 print ">$bookfund[$i]->{'bookfundname'}";
222 my $rrp=$results[0]->{'rrp'};
223 if ($results[0]->{'quantityreceived'} == 0){
224 $results[0]->{'quantityreceived'}='';
226 if ($results[0]->{'unitprice'} == 0){
227 $results[0]->{'unitprice'}='';
234 <TD>Quantity Ordered</td>
235 <td><input type=text size=20 name=quantity value=$results[0]->{'quantity'}>
238 <TR VALIGN=TOP bgcolor=#ffffcc>
239 <TD><B>Quantity Received *</B></td>
240 <td><input type=text size=20 name=quantityrec value=$results[0]->{'quantityreceived'}>
244 <TD>Replacement Cost</td>
245 <td><input type=text size=20 name=rrp value=$rrp>
250 <td><input type=text size=20 name=ecost value="$results[0]->{'ecost'}">
253 <TR VALIGN=TOP bgcolor=#ffffcc>
254 <TD><B>Actual Cost *</B></td>
255 <td><input type=text size=20 name=cost value="$results[0]->{'unitprice'}">
258 <TR VALIGN=TOP bgcolor=#ffffcc>
259 <TD>Invoice Number</td>
261 <input type=hidden name=invoice value="$invoice">
266 <td><input type=text size=20 name=notes value="$results[0]->{'notes'}">
278 print "<center><table>";
280 <tr valign=top bgcolor=#99cc33>
282 <td background="/images/background-mem.gif"><b>ISBN</b></td>
283 <td background="/images/background-mem.gif"><b>TITLE</b></td>
284 <td background="/images/background-mem.gif"><b>AUTHOR</b></td>
288 for (my $i=0;$i<$count;$i++){
289 print "<tr><td>$results[$i]->{'isbn'}</td>
290 <td><a href=acquire.pl?recieve=$results[$i]->{'ordernumber'}&biblio=$results[$i]->{'biblionumber'}&invoice=$invoice&freight=$freight&gst=$gst>$results[$i]->{'title'}</a></td>
291 <td>$results[$i]->{'author'}</td></tr>";
293 print "</table></center>";
298 print endmenu('acquisitions');