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 with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307 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
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
();
116 push @itemloop,$cell;
118 $template->param(items
=> \
@itemloop);
121 if ( @
$results[0]->{'quantityreceived'} == 0 ) {
122 @
$results[0]->{'quantityreceived'} = '';
124 if ( @
$results[0]->{'unitprice'} == 0 ) {
125 @
$results[0]->{'unitprice'} = '';
129 biblionumber
=> @
$results[0]->{'biblionumber'},
130 ordernumber
=> @
$results[0]->{'ordernumber'},
131 biblioitemnumber
=> @
$results[0]->{'biblioitemnumber'},
132 supplierid
=> @
$results[0]->{'booksellerid'},
135 name
=> $bookseller->{'name'},
136 date
=> format_date
($date),
137 title
=> @
$results[0]->{'title'},
138 author
=> @
$results[0]->{'author'},
139 copyrightdate
=> @
$results[0]->{'copyrightdate'},
140 isbn
=> @
$results[0]->{'isbn'},
141 seriestitle
=> @
$results[0]->{'seriestitle'},
142 bookfund
=> @
$results[0]->{'bookfundid'},
143 quantity
=> @
$results[0]->{'quantity'},
144 quantityreceivedplus1
=> @
$results[0]->{'quantityreceived'} + 1,
145 quantityreceived
=> @
$results[0]->{'quantityreceived'},
146 rrp
=> @
$results[0]->{'rrp'},
147 ecost
=> @
$results[0]->{'ecost'},
148 unitprice
=> @
$results[0]->{'unitprice'},
150 datereceived
=> $datereceived->output(),
151 datereceived_iso
=> $datereceived->output('iso'),
152 notes
=> $order->{notes
}
157 for ( my $i = 0 ; $i < $count ; $i++ ) {
158 my %line = %{ @
$results[$i] };
160 $line{invoice
} = $invoice;
161 $line{datereceived
} = $datereceived->output();
162 $line{freight
} = $freight;
164 $line{title
} = @
$results[$i]->{'title'};
165 $line{author
} = @
$results[$i]->{'author'};
166 $line{supplierid
} = $supplierid;
172 supplierid
=> $supplierid,
175 my $op = $input->param('op');
177 $template->param(edit
=> 1);
179 output_html_with_http_headers
$input, $cookie, $template->output;