5 #script to recieve orders
6 #written by chris@katipo.co.nz 24/2/2000
9 # Copyright 2000-2002 Katipo Communications
11 # This file is part of Koha.
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA 02111-1307 USA
35 print $input->header();
36 my $id=$input->param('id');
40 print startmenu
('acquisitions');
42 my $search=$input->param('recieve');
43 my $invoice=$input->param('invoice');
44 my $freight=$input->param('freight');
45 my $biblio=$input->param('biblio');
46 my $catview=$input->param('catview');
47 my $gst=$input->param('gst');
48 my ($count,@results)=ordersearch
($search,$biblio,$catview);
49 my ($count2,@booksellers)=bookseller
($results[0]->{'booksellerid'});
51 my @date=split('-',$results[0]->{'entrydate'});
52 my $date="$date[2]/$date[1]/$date[0]";
59 <script language="javascript" type="text/javascript">
61 function messenger(X,Y,etc){
62 win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
65 win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size=2><p><br>");
66 win.document.write(etc);
67 win.document.write("<center><form><input type=button onclick='self.close()' value=Close></form></center>");
68 win.document.write("</font></body></html>");
72 <form action="/cgi-bin/koha/acqui/finishreceive.pl" method=post>
73 <input type=hidden name=biblio value=$results[0]->{'biblionumber'}>
74 <input type=hidden name=ordnum value=$results[0]->{'ordernumber'}>
75 <input type=hidden name=biblioitemnum value=$results[0]->{'biblioitemnumber'}>
76 <input type=hidden name=bookseller value=$results[0]->{'booksellerid'}>
77 <input type=hidden name=freight value=$freight>
78 <input type=hidden name=gst value=$gst>
81 if ($catview ne 'yes'){
82 print "<input type=image name=submit src=/images/save-changes.gif border=0 width=187 height=42 align=right>";
84 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>";
87 <FONT SIZE=6><em>$results[0]->{'ordernumber'} - Receive Order</em></FONT><br>
88 Shopping Basket For: $booksellers[0]->{'name'}
89 <br> Order placed: $date
92 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="40%">
93 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>CATALOGUE DETAILS</B></td></tr>
96 <TD><b>Title *</b></td>
97 <td><input type=text size=20 name=title value="$results[0]->{'title'}" >
102 <td><input type=text size=20 name=author value="$results[0]->{'author'}" >
106 <TD>Copyright Date</td>
107 <td><input type=text size=20 name=copyright value="$results[0]->{'copyrightdate'}" >
114 <select name=format size=1>
118 my $dbh = C4
::Context
->dbh;
119 my $query="Select itemtype,description from itemtypes order by description";
120 my $sth=$dbh->prepare($query);
122 while (my $data=$sth->fetchrow_hashref){
123 if ($data->{'itemtype'} eq $results[0]->{'itemtype'}) {
124 print "<option SELECTED value=\"" . $data->{'itemtype'} . "\">" . $data->{'description'} . "\n";
126 print "<option value=\"" . $data->{'itemtype'} . "\">" . $data->{'description'} . "\n";
140 <td><input type=text size=20 name=ISBN value="$results[0]->{'isbn'}">
147 <td><input type=text size=20 name=Series value="$results[0]->{'seriestitle'}">
153 <td><select name=branch size=1>
156 my ($count2,@branches)=branches
();
157 for (my $i=0;$i<$count2;$i++){
158 print "<option value=$branches[$i]->{'branchcode'}";
159 if ($results[0]->{'branchcode'} == $branches[$i]->{'branchcode'}){
162 print ">$branches[$i]->{'branchname'}";
169 <TR VALIGN=TOP bgcolor=#ffffcc >
170 <TD><B>Item Barcode *</B></td>
172 <td><input type=text size=20 name=barcode value=
176 my $auto_barcode = C4
::Context
->preference("autoBarcode") || 0;
177 # See whether barcodes should be automatically allocated.
178 # Defaults to 0, meaning "no".
179 if ($auto_barcode eq '1') {
180 my $dbh = C4
::Context
->dbh;
181 my $query="Select barcode from items order by barcode desc";
182 my $sth=$dbh->prepare($query);
184 my $data=$sth->fetchrow_hashref;
185 print $data->{'barcode'}+1;
194 <TR VALIGN=TOP bgcolor=#ffffcc >
195 <TD><B>Volume Info (for serials) *</B></td>
197 <td><input type=text size=20 name=volinf>
204 <img src="/images/holder.gif" width=32 height=250 align=left>
206 <table border=1 cellspacing=0 cellpadding=5 width="40%">
208 <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>ACCOUNTING DETAILS</B></td></tr>
210 <TD><B>Bookfund *</B></td>
211 <td><select name=bookfund size=1>
215 ($count2,@bookfund)=bookfunds
();
216 for (my $i=0;$i<$count2;$i++){
217 print "<option value=$bookfund[$i]->{'bookfundid'}";
218 if ($bookfund[$i]->{'bookfundid'}==$results[0]->{'bookfundid'}){
221 print ">$bookfund[$i]->{'bookfundname'}";
224 my $rrp=$results[0]->{'rrp'};
225 if ($results[0]->{'quantityreceived'} == 0){
226 $results[0]->{'quantityreceived'}='';
228 if ($results[0]->{'unitprice'} == 0){
229 $results[0]->{'unitprice'}='';
236 <TD>Quantity Ordered</td>
237 <td><input type=text size=20 name=quantity value=$results[0]->{'quantity'}>
240 <TR VALIGN=TOP bgcolor=#ffffcc>
241 <TD><B>Quantity Received *</B></td>
242 <td><input type=text size=20 name=quantityrec value=$results[0]->{'quantityreceived'}>
246 <TD>Replacement Cost</td>
247 <td><input type=text size=20 name=rrp value=$rrp>
252 <td><input type=text size=20 name=ecost value="$results[0]->{'ecost'}">
255 <TR VALIGN=TOP bgcolor=#ffffcc>
256 <TD><B>Actual Cost *</B></td>
257 <td><input type=text size=20 name=cost value="$results[0]->{'unitprice'}">
260 <TR VALIGN=TOP bgcolor=#ffffcc>
261 <TD>Invoice Number</td>
263 <input type=hidden name=invoice value="$invoice">
268 <td><input type=text size=20 name=notes value="$results[0]->{'notes'}">
280 print "<center><table>";
282 <tr valign=top bgcolor=#99cc33>
284 <td background="/images/background-mem.gif"><b>ISBN</b></td>
285 <td background="/images/background-mem.gif"><b>TITLE</b></td>
286 <td background="/images/background-mem.gif"><b>AUTHOR</b></td>
290 for (my $i=0;$i<$count;$i++){
291 print "<tr><td>$results[$i]->{'isbn'}</td>
292 <td><a href=acquire.pl?recieve=$results[$i]->{'ordernumber'}&biblio=$results[$i]->{'biblionumber'}&invoice=$invoice&freight=$freight&gst=$gst>$results[$i]->{'title'}</a></td>
293 <td>$results[$i]->{'author'}</td></tr>";
295 print "</table></center>";
300 print endmenu
('acquisitions');