3 # Copyright 2006 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
26 my $dbh = C4::Context->dbh;
28 my $bookfund = $input->param('bookfund');
29 my $start = $input->param('start');
30 my $end = $input->param('end');
32 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
34 template_name => "acqui/bookfund.tmpl",
38 flagsrequired => { acquisition => 1 },
50 quantityreceived AS qrev,
54 aqorders.biblionumber,
55 aqorders.booksellerinvoicenumber,
56 quantity-quantityreceived AS tleft,
57 aqorders.ordernumber AS ordnum,
63 INNER JOIN aqorderbreakdown
64 ON aqorderbreakdown.ordernumber = aqorders.ordernumber
66 ON aqbasket.basketno = aqorders.basketno
68 ON biblioitems.biblioitemnumber = aqorders.biblioitemnumber
72 AND (datecancellationprinted IS NULL
73 OR datecancellationprinted = \'0000-00-00\')
75 my $sth = $dbh->prepare($query);
76 $sth->execute( $bookfund, $start, $end );
80 while ( my $data = $sth->fetchrow_hashref ) {
81 my $left = $data->{'tleft'};
82 if ( !$left || $left eq '' ) {
83 $left = $data->{'quantity'};
85 if ( $left && $left > 0 ) {
86 my $subtotal = $left * $data->{'ecost'};
87 $data->{subtotal} = $subtotal;
88 $data->{'left'} = $left;
89 push @commited_loop, $data;
95 COMMITEDLOOP => \@commited_loop,
101 output_html_with_http_headers $input, $cookie, $template->output;