From ba0fcee95a7570ecaa05b70211ab31cd02ec8faa Mon Sep 17 00:00:00 2001 From: hdl Date: Tue, 14 Feb 2006 17:07:24 +0000 Subject: [PATCH] Adding parcels list to recieveorder.pl getparcels is cutout for that matter. Will add tomorrow the receive.pl making the proper actions. --- C4/Acquisition.pm | 40 +++++++++- acqui/recieveorder.pl | 73 ++++++++++++++++++ .../default/en/acqui/recieveorder.tmpl | 75 ++++++++++++++++++- 3 files changed, 184 insertions(+), 4 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 93dac02f8c..a87d38a6eb 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -23,6 +23,7 @@ use C4::Context; use C4::Date; use MARC::Record; use C4::Suggestions; +use Smart::Comments; # use C4::Biblio; use vars qw($VERSION @ISA @EXPORT); @@ -60,7 +61,8 @@ orders, converting money to different currencies, and so forth. &updaterecorder &newordernum &getsupplierlistwithlateorders &getlateorders - + &getparcels + &bookfunds &curconvert &getcurrencies &bookfundbreakdown &updatecurrencies &getcurrency @@ -1115,6 +1117,42 @@ sub insertsup { return($data->{'id'}); } +=item getparcels + + ($count, $results) = &getparcels($dbh, $bookseller, $order, $limit); + +get a lists of parcels +Returns the count of parcels returned and a pointer on a hash list containing parcel informations as such : + Creation date + Last operation + Number of biblio + Number of items + + +=cut +#' +sub getparcels { + my ($bookseller, $order, $code,$datefrom,$dateto, $limit)=@_; + my $dbh = C4::Context->dbh; + my $strsth = "SELECT aqorders.booksellerinvoicenumber, datereceived, count(DISTINCT biblionumber) as biblio, sum(quantity) as itemsexpected, sum(quantityreceived) as itemsreceived from aqorders, aqbasket where aqbasket.basketno = aqorders.basketno and aqbasket.booksellerid = $bookseller and datereceived is not null "; + $strsth .= "and aqorders.booksellerinvoicenumber like \"$code%\" " if ($code); + $strsth .= "and datereceived >=".$dbh->quote($datefrom)." " if ($datefrom); + $strsth .= "and datereceived <=".$dbh->quote($dateto)." " if ($dateto); + $strsth .= "group by aqorders.booksellerinvoicenumber,datereceived "; + $strsth .= "order by $order " if ($order); + $strsth .= " LIMIT 0,$limit" if ($limit); + my $sth=$dbh->prepare($strsth); +### getparcels: $strsth + $sth->execute; + my @results; + while (my $data2=$sth->fetchrow_hashref) { + push @results, $data2; + } + + $sth->finish; + return(scalar(@results), @results); +} + END { } # module clean-up code here (global destructor) 1; diff --git a/acqui/recieveorder.pl b/acqui/recieveorder.pl index 0ecba2e862..bd0e307dd7 100755 --- a/acqui/recieveorder.pl +++ b/acqui/recieveorder.pl @@ -30,9 +30,17 @@ use C4::Interface::CGI::Output; use C4::Database; use HTML::Template; use C4::Acquisition; +use Smart::Comments; my $input=new CGI; my $supplierid=$input->param('supplierid'); +my $order=$input->param('orderby'); +my $startfrom=$input->param('startfrom'); +my $code=$input->param('filter'); +my $datefrom=$input->param('datefrom'); +my $dateto=$input->param('dateto'); +my $resultsperpage = $input->param('resultsperpage'); + my ($count,@booksellers)=bookseller($supplierid); my ($template, $loggedinuser, $cookie) @@ -44,6 +52,71 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); + +$resultsperpage = 20 unless ($resultsperpage); +my ($count,@results)=getparcels($supplierid, $order, $code,$datefrom,$dateto); + +# multi page display gestion +$startfrom=0 unless ($startfrom); +if ($count>$resultsperpage){ + my $displaynext=0; + my $displayprev=$startfrom; + if(($count - ($startfrom+$resultsperpage)) > 0 ) { + $displaynext = 1; + } + + my @numbers = (); + if ($count>$resultsperpage) { + for (my $i=1; $i<$count/$resultsperpage+1; $i++) { + if ($i<16) { + my $highlight=0; + ($startfrom/$resultsperpage==($i-1)) && ($highlight=1); + push @numbers, { number => $i, + highlight => $highlight , +# searchdata=> "test", + startfrom => ($i-1)*$resultsperpage}; + } + } + } + + my $from = $startfrom*$resultsperpage+1; + my $to; + + if($count < (($startfrom+1)*$resultsperpage)) + { + $to = $count; + } else { + $to = (($startfrom+1)*$resultsperpage); + } + $template->param(numbers=>\@numbers, + displaynext=>$displaynext, + displayprev=>$displayprev, + nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count), + prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0) + ); +} +my @loopres; + +for (my $i=$startfrom;$i<=($startfrom+$resultsperpage-1<$count-1?$startfrom+$resultsperpage-1:$count-1);$i++){ +### startfrom: $startfrom +### resultsperpage: $resultsperpage +### count: $count +### code: $results[$i]->{booksellerinvoicenumber} +### datereceived: $results[$i]->{datereceived} + + my %cell; + $cell{number}=$i+1; + $cell{code}=$results[$i]->{booksellerinvoicenumber}; + $cell{nullcode}=$results[$i]->{booksellerinvoicenumber} eq "NULL"; + $cell{emptycode}=$results[$i]->{booksellerinvoicenumber} eq ''; + $cell{datereceived}=$results[$i]->{datereceived}; + $cell{bibcount}=$results[$i]->{biblio}; + $cell{reccount}=$results[$i]->{itemsreceived}; + $cell{itemcount}=$results[$i]->{itemsexpected}; + push @loopres, \%cell; +} +$template->param(searchresults=>\@loopres, count=>$count) if ($count); +$template->param(orderby=>$order, filter=>$code, datefrom=>$datefrom,dateto=>$dateto, resultsperpage=>$resultsperpage); $template->param( name => $booksellers[0]->{'name'}, supplierid => $supplierid, diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/recieveorder.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/recieveorder.tmpl index 518f2dd696..789ebce73d 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui/recieveorder.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/recieveorder.tmpl @@ -1,13 +1,82 @@

Receive Orders From Supplier ">

+ +

parcels found

+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + +
NumberCodeDate ReceivedItem CountBiblio countItems expected
 >">From :">

To :">

 Sort by :
+Results per page : +
+
class="hilighted"> + &datereceived="&code=> + + + class="hilighted"> + + class="hilighted"> class="hilighted"> class="hilighted"> + class="hilighted"> +
+
+
+

Receive a new Parcel

> -

Supplier invoice information

-

- +

-- 2.39.5