4 #script to recieve orders
5 #written by chris@katipo.co.nz 24/2/2000
7 # Copyright 2000-2002 Katipo Communications
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along
21 # with Koha; if not, write to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 This script shows all order already receive and all pendings orders.
30 It permit to write a new order as 'received'.
37 to know on what supplier this script has to display receive order.
42 the number of this invoice.
47 The biblionumber of this order.
60 #use warnings; FIXME - Bug 2505
63 use C4
::Koha
; # GetKohaAuthorisedValues GetItemTypes
67 use C4
::Dates qw
/format_date/;
70 use C4
::Branch
; # GetBranches
77 my $dbh = C4
::Context
->dbh;
78 my $supplierid = $input->param('supplierid');
79 my $ordernumber = $input->param('ordernumber');
80 my $search = $input->param('receive');
81 my $invoice = $input->param('invoice');
82 my $freight = $input->param('freight');
83 my $datereceived = $input->param('datereceived');
86 $datereceived = $datereceived ? C4
::Dates
->new($datereceived, 'iso') : C4
::Dates
->new();
88 my $bookseller = GetBookSellerFromId
($supplierid);
89 my $gst= $input->param('gst') || $bookseller->{gstrate
} || C4
::Context
->preference("gist") || 0;
90 my $results = SearchOrder
($ordernumber,$search);
93 my $count = scalar @
$results;
94 my $order = GetOrder
($ordernumber);
97 my $date = @
$results[0]->{'entrydate'};
99 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
101 template_name
=> "acqui/orderreceive.tmpl",
104 authnotrequired
=> 0,
105 flagsrequired
=> {acquisition
=> 'order_receive'},
110 # prepare the form for receiving
112 if (C4
::Context
->preference('AcqCreateItem') eq 'receiving') {
113 # prepare empty item form
114 my $cell = PrepareItemrecordDisplay
('','','','ACQ');
116 $cell = PrepareItemrecordDisplay
('','','','');
117 $template->param('NoACQframework' => 1);
120 push @itemloop,$cell;
122 $template->param(items
=> \
@itemloop);
125 if ( @
$results[0]->{'quantityreceived'} == 0 ) {
126 @
$results[0]->{'quantityreceived'} = '';
128 if ( @
$results[0]->{'unitprice'} == 0 ) {
129 @
$results[0]->{'unitprice'} = '';
133 biblionumber
=> @
$results[0]->{'biblionumber'},
134 ordernumber
=> @
$results[0]->{'ordernumber'},
135 biblioitemnumber
=> @
$results[0]->{'biblioitemnumber'},
136 supplierid
=> @
$results[0]->{'booksellerid'},
139 name
=> $bookseller->{'name'},
140 date
=> format_date
($date),
141 title
=> @
$results[0]->{'title'},
142 author
=> @
$results[0]->{'author'},
143 copyrightdate
=> @
$results[0]->{'copyrightdate'},
144 isbn
=> @
$results[0]->{'isbn'},
145 seriestitle
=> @
$results[0]->{'seriestitle'},
146 bookfund
=> @
$results[0]->{'bookfundid'},
147 quantity
=> @
$results[0]->{'quantity'},
148 quantityreceivedplus1
=> @
$results[0]->{'quantityreceived'} + 1,
149 quantityreceived
=> @
$results[0]->{'quantityreceived'},
150 rrp
=> @
$results[0]->{'rrp'},
151 ecost
=> @
$results[0]->{'ecost'},
152 unitprice
=> @
$results[0]->{'unitprice'},
154 datereceived
=> $datereceived->output(),
155 datereceived_iso
=> $datereceived->output('iso'),
156 notes
=> $order->{notes
}
161 for ( my $i = 0 ; $i < $count ; $i++ ) {
162 my %line = %{ @
$results[$i] };
164 $line{invoice
} = $invoice;
165 $line{datereceived
} = $datereceived->output();
166 $line{freight
} = $freight;
168 $line{title
} = @
$results[$i]->{'title'};
169 $line{author
} = @
$results[$i]->{'author'};
170 $line{supplierid
} = $supplierid;
176 supplierid
=> $supplierid,
179 my $op = $input->param('op');
181 $template->param(edit
=> 1);
183 output_html_with_http_headers
$input, $cookie, $template->output;