From 81278ce0944ab97e58ebf5cdb4913387e3c69d12 Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Sat, 22 Jun 2013 23:01:21 +0530 Subject: [PATCH] Bug 10472 - Receipt by line or invoice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To select to ‘receipt in’ items either by per line or the entire invoice. Test plan: 1) Acquisitions preferences should be "AcqCreateItem -> placing an order". 2) Create a basket. 3) Create orders under basket and close the basket. 4) Click on Receive shipment button. 5) Enter invoice number, shipmentdate and cost. 6) Search Basketno which you want to receive for ex: basketno 50 and click on filter button. 7) After search "Receipt all" link is appear. 8) Click on "Receipt all" link you would be able to receive all the order against the basketno. Sponsored-by: Staffordshire University/Halton Borough Council/PTFS Europe --- acqui/parcel.pl | 14 ++++ acqui/receiptorder.pl | 86 ++++++++++++++++++++ .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 4 +- 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100755 acqui/receiptorder.pl diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 8e82283..d6f1c15 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -219,6 +219,20 @@ if(!defined $invoice->{closedate}) { my $grouped; my $owner; $pendingorders = GetPendingOrders($booksellerid,$grouped,$owner,$basketno,$orderno,$search,$ean); + my $dbh = C4::Context->dbh; + my $rv = $dbh->selectall_arrayref( + 'SELECT COUNT(*) as count FROM aqorders_items LEFT JOIN aqorders + ON aqorders.ordernumber = aqorders_items.ordernumber WHERE + aqorders.basketno = ?', + { Slice => {} }, $basketno + ); + if ( $rv->[0]->{count} ) { + $template->param( + result => $rv->[0]->{count}, + basketno => $basketno, + datereceived => $datereceived + ); + } }else{ $pendingorders = GetPendingOrders($booksellerid); } diff --git a/acqui/receiptorder.pl b/acqui/receiptorder.pl new file mode 100755 index 0000000..e370b4c --- /dev/null +++ b/acqui/receiptorder.pl @@ -0,0 +1,86 @@ +#!/usr/bin/perl + +# Copyright 2013 Amit Gupta (amitddng135@gmail.com) +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +=head1 NAME + +receiptorder.pl + +=head1 DESCRIPTION + +Search for receiptorder by basketno (Choose system preference AcqCreateItem -> placing an order) + +=cut + +use strict; +use warnings; + +use CGI; +use C4::Auth; +use C4::Output; +use C4::Acquisition qw/ GetOrders GetOrder ModReceiveOrder /; + +my $input=new CGI; +my $flagsrequired = {acquisition => 'order_receive'}; + +checkauth($input, 0, $flagsrequired, 'intranet'); + +my $basketno = $input->param('basketno'); +my $datereceived = $input->param('datereceived'); +my $booksellerid = $input->param('booksellerid'); +my $invoiceid = $input->param('invoiceid'); +my $user = $input->remote_user; + +my @details = GetOrders($basketno); + +foreach my $detail(@details) { + my $order = GetOrder($detail->{'ordernumber'}); + $order->{rrp} = $detail->{'rrp'}; + $order->{ecost} = $detail->{'ecost'}; + $order->{unitprice} = $detail->{'ecost'}; + my $bookseller = C4::Bookseller::GetBookSellerFromId($booksellerid); + if ( $bookseller->{listincgst} ) { + if ( not $bookseller->{invoiceincgst} ) { + $order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} ); + $order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} ); + $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} ); + } + } else { + if ( $bookseller->{invoiceincgst} ) { + $order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} ); + $order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} ); + $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} ); + } + } + if ( $detail->{'quantity'} > 0 ) { + ($datereceived, $order) = ModReceiveOrder( + $detail->{'biblionumber'}, + $detail->{'ordernumber'}, + $detail->{'quantity'}, + $user, + $order->{unitprice}, + $order->{ecost}, + $invoiceid, + $order->{rrp}, + undef, + $datereceived, + undef, + ); + } + +} +print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index 415c7e8..b6c8e8d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -249,7 +249,9 @@ Reopen it.

[% END %] - +[% IF ( result )%] + Receipt all +[% END %]

Already received

-- 1.7.9.5