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.
30 This script shows all order already receive and all pendings orders.
31 It permit to write a new order as 'received'.
39 to know on what supplier this script has to display receive order.
45 the number of this invoice.
51 The biblionumber of this order.
64 #use warnings; FIXME - Bug 2505
67 use C4
::Koha
; # GetKohaAuthorisedValues GetItemTypes
71 use C4
::Dates qw
/format_date/;
72 use C4
::Bookseller qw
/ GetBookSellerFromId /;
73 use C4
::Budgets qw
/ GetBudget /;
75 use C4
::Branch
; # GetBranches
83 my $dbh = C4
::Context
->dbh;
84 my $booksellerid = $input->param('booksellerid');
85 my $ordernumber = $input->param('ordernumber');
86 my $search = $input->param('receive');
87 my $invoice = $input->param('invoice');
88 my $freight = $input->param('freight');
89 my $datereceived = $input->param('datereceived');
92 $datereceived = $datereceived ? C4
::Dates
->new($datereceived, 'iso') : C4
::Dates
->new();
94 my $bookseller = GetBookSellerFromId
($booksellerid);
95 my $input_gst = ($input->param('gst') eq '' ?
undef : $input->param('gst'));
96 my $gst= $input_gst // $bookseller->{gstrate
} // C4
::Context
->preference("gist") // 0;
97 my $results = SearchOrder
($ordernumber,$search);
100 my $count = scalar @
$results;
101 my $order = GetOrder
($ordernumber);
104 my $date = @
$results[0]->{'entrydate'};
106 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
108 template_name
=> "acqui/orderreceive.tmpl",
111 authnotrequired
=> 0,
112 flagsrequired
=> {acquisition
=> 'order_receive'},
117 # prepare the form for receiving
119 if (C4
::Context
->preference('AcqCreateItem') eq 'receiving') {
120 # prepare empty item form
121 my $cell = PrepareItemrecordDisplay
('','','','ACQ');
123 $cell = PrepareItemrecordDisplay
('','','','');
124 $template->param('NoACQframework' => 1);
127 push @itemloop,$cell;
129 $template->param(items
=> \
@itemloop);
132 if ( @
$results[0]->{'quantityreceived'} == 0 ) {
133 @
$results[0]->{'quantityreceived'} = '';
135 if ( @
$results[0]->{'unitprice'} == 0 ) {
136 @
$results[0]->{'unitprice'} = '';
139 my $suggestion = GetSuggestionInfoFromBiblionumber
(@
$results[0]->{'biblionumber'});
141 my $authorisedby = @
$results[0]->{'authorisedby'};
142 my $member = GetMember
( borrowernumber
=> $authorisedby );
144 my $budget = GetBudget
( @
$results[0]->{'budget_id'} );
148 biblionumber
=> @
$results[0]->{'biblionumber'},
149 ordernumber
=> @
$results[0]->{'ordernumber'},
150 biblioitemnumber
=> @
$results[0]->{'biblioitemnumber'},
151 booksellerid
=> @
$results[0]->{'booksellerid'},
154 name
=> $bookseller->{'name'},
155 date
=> format_date
($date),
156 title
=> @
$results[0]->{'title'},
157 author
=> @
$results[0]->{'author'},
158 copyrightdate
=> @
$results[0]->{'copyrightdate'},
159 isbn
=> @
$results[0]->{'isbn'},
160 seriestitle
=> @
$results[0]->{'seriestitle'},
161 bookfund
=> $budget->{budget_name
},
162 quantity
=> @
$results[0]->{'quantity'},
163 quantityreceivedplus1
=> @
$results[0]->{'quantityreceived'} + 1,
164 quantityreceived
=> @
$results[0]->{'quantityreceived'},
165 rrp
=> @
$results[0]->{'rrp'},
166 ecost
=> @
$results[0]->{'ecost'},
167 unitprice
=> @
$results[0]->{'unitprice'},
168 memberfirstname
=> $member->{firstname
} || "",
169 membersurname
=> $member->{surname
} || "",
171 datereceived
=> $datereceived->output(),
172 datereceived_iso
=> $datereceived->output('iso'),
173 notes
=> $order->{notes
},
174 suggestionid
=> $suggestion->{suggestionid
},
175 surnamesuggestedby
=> $suggestion->{surnamesuggestedby
},
176 firstnamesuggestedby
=> $suggestion->{firstnamesuggestedby
},
181 for ( my $i = 0 ; $i < $count ; $i++ ) {
182 my %line = %{ @
$results[$i] };
184 $line{invoice
} = $invoice;
185 $line{datereceived
} = $datereceived->output();
186 $line{freight
} = $freight;
188 $line{title
} = @
$results[$i]->{'title'};
189 $line{author
} = @
$results[$i]->{'author'};
190 $line{booksellerid
} = $booksellerid;
196 booksellerid
=> $booksellerid,
199 my $op = $input->param('op');
201 $template->param(edit
=> 1);
203 output_html_with_http_headers
$input, $cookie, $template->output;