From 873db29f49e69881fe46727cb63847fb0bffd89e Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 6 Mar 2000 21:13:58 +0000 Subject: [PATCH] Finishing of receiving --- C4/Acquisitions.pm | 35 ++++++++++++++++++++++++++++++----- acqui/acquire.pl | 16 +++++++++------- acqui/finishreceive.pl | 19 ++++++++++++++++--- 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/C4/Acquisitions.pm b/C4/Acquisitions.pm index 6ef8283..b30d787 100644 --- a/C4/Acquisitions.pm +++ b/C4/Acquisitions.pm @@ -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) diff --git a/acqui/acquire.pl b/acqui/acquire.pl index 2f6f678..0561765 100755 --- a/acqui/acquire.pl +++ b/acqui/acquire.pl @@ -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(""); {'biblionumber'}> {'ordernumber'}> {'biblioitemnumber'}> +{'booksellerid'}> $results[0]->{'ordernumber'} - Recieve Order
-Shopping Basket For: Whitcoulls New Zealand +Shopping Basket For: $booksellers[0]->{'name'}

@@ -90,10 +92,10 @@ Shopping Basket For: Whitcoulls New Zealand diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 2a2aec8..8a027ca 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -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");
Branch