|
Line 0
Link Here
|
|
|
1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# Copyright 2013 Amit Gupta (amitddng135@gmail.com) |
| 4 |
# This file is part of Koha. |
| 5 |
# |
| 6 |
# Koha is free software; you can redistribute it and/or modify it under the |
| 7 |
# terms of the GNU General Public License as published by the Free Software |
| 8 |
# Foundation; either version 2 of the License, or (at your option) any later |
| 9 |
# version. |
| 10 |
# |
| 11 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
| 13 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License along |
| 16 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
| 17 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 |
|
| 19 |
=head1 NAME |
| 20 |
|
| 21 |
receiptorder.pl |
| 22 |
|
| 23 |
=head1 DESCRIPTION |
| 24 |
|
| 25 |
Search for receiptorder by basketno (Choose system preference AcqCreateItem -> placing an order) |
| 26 |
|
| 27 |
=cut |
| 28 |
|
| 29 |
use strict; |
| 30 |
use warnings; |
| 31 |
|
| 32 |
use CGI; |
| 33 |
use C4::Auth; |
| 34 |
use C4::Output; |
| 35 |
use C4::Acquisition qw/ GetOrders GetOrder ModReceiveOrder /; |
| 36 |
|
| 37 |
my $input=new CGI; |
| 38 |
my $flagsrequired = {acquisition => 'order_receive'}; |
| 39 |
|
| 40 |
checkauth($input, 0, $flagsrequired, 'intranet'); |
| 41 |
|
| 42 |
my $basketno = $input->param('basketno'); |
| 43 |
my $datereceived = $input->param('datereceived'); |
| 44 |
my $booksellerid = $input->param('booksellerid'); |
| 45 |
my $invoiceid = $input->param('invoiceid'); |
| 46 |
my $user = $input->remote_user; |
| 47 |
|
| 48 |
my @details = GetOrders($basketno); |
| 49 |
|
| 50 |
foreach my $detail(@details) { |
| 51 |
my $order = GetOrder($detail->{'ordernumber'}); |
| 52 |
$order->{rrp} = $detail->{'rrp'}; |
| 53 |
$order->{ecost} = $detail->{'ecost'}; |
| 54 |
$order->{unitprice} = $detail->{'ecost'}; |
| 55 |
my $bookseller = C4::Bookseller::GetBookSellerFromId($booksellerid); |
| 56 |
if ( $bookseller->{listincgst} ) { |
| 57 |
if ( not $bookseller->{invoiceincgst} ) { |
| 58 |
$order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} ); |
| 59 |
$order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} ); |
| 60 |
$order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} ); |
| 61 |
} |
| 62 |
} else { |
| 63 |
if ( $bookseller->{invoiceincgst} ) { |
| 64 |
$order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} ); |
| 65 |
$order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} ); |
| 66 |
$order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} ); |
| 67 |
} |
| 68 |
} |
| 69 |
if ( $detail->{'quantity'} > 0 ) { |
| 70 |
($datereceived, $order) = ModReceiveOrder( |
| 71 |
$detail->{'biblionumber'}, |
| 72 |
$detail->{'ordernumber'}, |
| 73 |
$detail->{'quantity'}, |
| 74 |
$user, |
| 75 |
$order->{unitprice}, |
| 76 |
$order->{ecost}, |
| 77 |
$invoiceid, |
| 78 |
$order->{rrp}, |
| 79 |
undef, |
| 80 |
$datereceived, |
| 81 |
undef, |
| 82 |
); |
| 83 |
} |
| 84 |
|
| 85 |
} |
| 86 |
print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); |