Finishing of receiving

This commit is contained in:
chris 2000-03-06 21:13:58 +00:00
parent 84f78eccb2
commit 873db29f49
3 changed files with 55 additions and 15 deletions

View file

@ -13,7 +13,7 @@ $VERSION = 0.01;
@EXPORT = qw(&getorders &bookseller &breakdown &basket &newbasket &bookfunds
&ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder
&newordernum &modbiblio &modorder &getsingleorder &invoice &receiveorder
&bookfundbreakdown &curconvert &updatesup &insertsup);
&bookfundbreakdown &curconvert &updatesup &insertsup &makeitems);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -126,7 +126,7 @@ sub ordersearch {
$sth2->finish;
$data->{'author'}=$data2->{'author'};
$sth2=$dbh->prepare("Select * from aqorderbreakdown where
ordernumber='$data->{'ordernumber'}");
ordernumber='$data->{'ordernumber'}");
$sth2->execute;
$data2=$sth2->fetchrow_hashref;
$sth2->finish;
@ -273,11 +273,13 @@ sub newbiblio {
sub modbiblio {
my ($bibnum,$title,$author,$copyright)=@_;
my $dbh=C4Connect;
$title=~ s/\'/\\\'/g;
$author=~ s/\'/\\\'/g;
my $query="update biblio set title='$title',
author='$author',copyrightdate='$copyright' where
biblionumber=$bibnum";
my $sth=$dbh->prepare($query);
# print $query;
# print $query;
$sth->execute;
$sth->finish;
$dbh->disconnect;
@ -380,11 +382,11 @@ sub newordernum {
}
sub receiveorder {
my ($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno)=@_;
my ($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight)=@_;
my $dbh=C4Connect;
my $query="update aqorders set quantityreceived='$quantrec',
datereceived=now(),booksellerinvoicenumber='$invoiceno',
biblioitemnumber=$bibitemno,unitprice=$cost
biblioitemnumber=$bibitemno,unitprice=$cost,freight=$freight
where biblionumber=$biblio and ordernumber=$ordnum
";
# print $query;
@ -448,6 +450,29 @@ sub insertsup {
return($data->{'id'});
}
sub makeitems {
my ($count,$bibitemno,$biblio,$replacement,$price,$booksellerid,$branch,@barcodes)=@_;
my $dbh=C4Connect;
my $sth=$dbh->prepare("Select max(itemnumber) from items");
$sth->execute;
my $data=$sth->fetchrow_hashref;
my $item=$data->{'max(itemnumber)'};
$sth->finish;
$item++;
for (my $i=0;$i<$count;$i++){
my $query="Insert into items (biblionumber,biblioitemnumber,itemnumber,barcode,
booksellerid,dateaccessioned,homebranch,holdingbranch,price,replacementprice,
replacementpricedate) values
($biblio,$bibitemno,$item,'$barcodes[$i]','$booksellerid',now(),'$branch',
'$branch',$price,$replacement,now())";
my $sth=$dbh->prepare($query);
$sth->execute;
$sth->finish;
$item++;
# print $query;
}
$dbh->disconnect;
}
END { } # module clean-up code here (global destructor)

View file

@ -12,7 +12,7 @@ use strict;
my $input=new CGI;
print $input->header();
my $id=$input->param('id');
my ($count,@booksellers)=bookseller($id);
print startpage;
print startmenu('acquisitions');
@ -22,7 +22,8 @@ my $invoice=$input->param('invoice');
my $freight=$input->param('freight');
my $gst=$input->param('gst');
my ($count,@results)=ordersearch($search);
print $count;
my ($count2,@booksellers)=bookseller($results[0]->{'booksellerid'});
#print $count;
if ($count == 1){
@ -47,11 +48,12 @@ win.document.write("</font></body></html>");
<input type=hidden name=biblio value=$results[0]->{'biblionumber'}>
<input type=hidden name=ordnum value=$results[0]->{'ordernumber'}>
<input type=hidden name=biblioitemnum value=$results[0]->{'biblioitemnumber'}>
<input type=hidden name=bookseller value=$results[0]->{'booksellerid'}>
<input type=hidden name=freight value=$freight>
<input type=hidden name=gst value=$gst>
<input type=image name=submit src=/images/save-changes.gif border=0 width=187 height=42 align=right>
<FONT SIZE=6><em>$results[0]->{'ordernumber'} - Recieve Order</em></FONT><br>
Shopping Basket For: Whitcoulls New Zealand
Shopping Basket For: $booksellers[0]->{'name'}
<P>
<CENTER>
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="40%">
@ -90,10 +92,10 @@ Shopping Basket For: Whitcoulls New Zealand
<TR VALIGN=TOP>
<TD>Branch</td>
<td><select name=branch size=1>
<option value=1 selected>District
<option value=1>Levin
<option value=1>Foxton
<option value=1>Shannon
<option value=D selected>District
<option value=C>Levin
<option value=F>Foxton
<option value=S>Shannon
</select>
</td>
</tr>

View file

@ -19,12 +19,25 @@ my $cost=$input->param('cost');
my $invoiceno=$input->param('invoice');
my $id=$input->param('id');
my $bibitemno=$input->param('biblioitemnum');
my $replacement=$input->param('rrp');
my $branch=$input->param('branch');
my $bookfund=$input->param('bookfund');
my $bookseller=$input->param('bookseller');
my $title=$input->param('title');
my $author=$input->param('author');
my $copyright=$input->param('copyright');
my $gst=$input->param('gst');
my $freight=$input->param('freight');
receiveorder($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno);
receiveorder($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight);
modbiblio($biblio,$title,$author,$copyright);
my $barcode=$input->param('barcode');
my @barcodes;
if ($quantrec > 1){
@barcodes=split(',',$barcode);
} else {
$barcodes[0]=$barcode;
}
makeitems($quantrec,$bibitemno,$biblio,$replacement,$cost,$bookseller,$branch,@barcodes);
print $input->redirect("/cgi-bin/koha/acqui/receive.pl?invoice=$invoiceno&id=$id&freight=$freight&gst=$gst");