3 # Copyright 2011 BibLibre SARL
4 # This file is part of Koha.
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
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.
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.
37 use C4::Bookseller qw/GetBookSeller/;
41 my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
42 template_name => 'acqui/invoices.tmpl',
46 flagsrequired => { 'acquisition' => '*' },
50 my $invoicenumber = $input->param('invoicenumber');
51 my $supplier = $input->param('supplier');
52 my $shipmentdatefrom = $input->param('shipmentdatefrom');
53 my $shipmentdateto = $input->param('shipmentdateto');
54 my $billingdatefrom = $input->param('billingdatefrom');
55 my $billingdateto = $input->param('billingdateto');
56 my $isbneanissn = $input->param('isbneanissn');
57 my $title = $input->param('title');
58 my $author = $input->param('author');
59 my $publisher = $input->param('publisher');
60 my $publicationyear = $input->param('publicationyear');
61 my $branch = $input->param('branch');
62 my $op = $input->param('op');
64 my @results_loop = ();
65 if($op and $op eq "do_search") {
66 my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output("iso");
67 my $shipmentdateto_iso = C4::Dates->new($shipmentdateto)->output("iso");
68 my $billingdatefrom_iso = C4::Dates->new($billingdatefrom)->output("iso");
69 my $billingdateto_iso = C4::Dates->new($billingdateto)->output("iso");
70 my @invoices = GetInvoices(
71 invoicenumber => $invoicenumber,
72 suppliername => $supplier,
73 shipmentdatefrom => $shipmentdatefrom_iso,
74 shipmentdateto => $shipmentdateto_iso,
75 billingdatefrom => $billingdatefrom_iso,
76 billingdateto => $billingdateto_iso,
77 isbneanissn => $isbneanissn,
80 publisher => $publisher,
81 publicationyear => $publicationyear,
86 invoiceid => $_->{invoiceid},
87 billingdate => $_->{billingdate},
88 invoicenumber => $_->{invoicenumber},
89 suppliername => $_->{suppliername},
90 receivedbiblios => $_->{receivedbiblios},
91 receiveditems => $_->{receiveditems},
92 subscriptionid => $_->{subscriptionid},
93 closedate => $_->{closedate},
95 push @results_loop, \%row;
100 # Build suppliers list
101 my @suppliers = GetBookSeller(undef);
102 my @suppliers_loop = ();
104 foreach (@suppliers) {
106 if ($supplier && $supplier == $_->{'id'}) {
108 $suppliername = $_->{'name'};
111 suppliername => $_->{'name'},
112 supplierid => $_->{'id'},
113 selected => $selected,
115 push @suppliers_loop, \%row;
118 # Build branches list
119 my $branches = GetBranches();
120 my @branches_loop = ();
122 foreach (sort keys %$branches) {
124 if ($branch && $branch eq $_) {
126 $branchname = $branches->{$_}->{'branchname'};
130 branchname => $branches->{$_}->{'branchname'},
131 selected => $selected,
133 push @branches_loop, \%row;
137 do_search => ($op and $op eq "do_search") ? 1 : 0,
138 results_loop => \@results_loop,
139 invoicenumber => $invoicenumber,
140 supplier => $supplier,
141 suppliername => $suppliername,
142 billingdatefrom => $billingdatefrom,
143 billingdateto => $billingdateto,
144 isbneanissn => $isbneanissn,
147 publisher => $publisher,
148 publicationyear => $publicationyear,
150 branchname => $branchname,
151 suppliers_loop => \@suppliers_loop,
152 branches_loop => \@branches_loop,
153 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
156 output_html_with_http_headers $input, $cookie, $template->output;