Lines 33-43
use CGI;
Link Here
|
33 |
use C4::Auth; |
33 |
use C4::Auth; |
34 |
use C4::Output; |
34 |
use C4::Output; |
35 |
|
35 |
|
36 |
use C4::Acquisition; |
36 |
use C4::Acquisition qw/GetInvoices/; |
37 |
use C4::Bookseller qw/GetBookSeller/; |
37 |
use C4::Bookseller qw/GetBookSeller/; |
38 |
use C4::Branch; |
38 |
use C4::Branch qw/GetBranches/; |
39 |
|
39 |
|
40 |
my $input = new CGI; |
40 |
my $input = CGI->new; |
41 |
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( |
41 |
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( |
42 |
{ |
42 |
{ |
43 |
template_name => 'acqui/invoices.tmpl', |
43 |
template_name => 'acqui/invoices.tmpl', |
Lines 63-75
my $publicationyear = $input->param('publicationyear');
Link Here
|
63 |
my $branch = $input->param('branch'); |
63 |
my $branch = $input->param('branch'); |
64 |
my $op = $input->param('op'); |
64 |
my $op = $input->param('op'); |
65 |
|
65 |
|
66 |
my @results_loop = (); |
66 |
my $invoices = []; |
67 |
if ( $op and $op eq "do_search" ) { |
67 |
if ( $op and $op eq 'do_search' ) { |
68 |
my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output("iso"); |
68 |
my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output('iso'); |
69 |
my $shipmentdateto_iso = C4::Dates->new($shipmentdateto)->output("iso"); |
69 |
my $shipmentdateto_iso = C4::Dates->new($shipmentdateto)->output('iso'); |
70 |
my $billingdatefrom_iso = C4::Dates->new($billingdatefrom)->output("iso"); |
70 |
my $billingdatefrom_iso = C4::Dates->new($billingdatefrom)->output('iso'); |
71 |
my $billingdateto_iso = C4::Dates->new($billingdateto)->output("iso"); |
71 |
my $billingdateto_iso = C4::Dates->new($billingdateto)->output('iso'); |
72 |
my @invoices = GetInvoices( |
72 |
@{$invoices} = GetInvoices( |
73 |
invoicenumber => $invoicenumber, |
73 |
invoicenumber => $invoicenumber, |
74 |
supplierid => $supplierid, |
74 |
supplierid => $supplierid, |
75 |
shipmentdatefrom => $shipmentdatefrom_iso, |
75 |
shipmentdatefrom => $shipmentdatefrom_iso, |
Lines 83-125
if ( $op and $op eq "do_search" ) {
Link Here
|
83 |
publicationyear => $publicationyear, |
83 |
publicationyear => $publicationyear, |
84 |
branchcode => $branch |
84 |
branchcode => $branch |
85 |
); |
85 |
); |
86 |
foreach (@invoices) { |
|
|
87 |
my %row = ( |
88 |
invoiceid => $_->{invoiceid}, |
89 |
billingdate => $_->{billingdate}, |
90 |
invoicenumber => $_->{invoicenumber}, |
91 |
suppliername => $_->{suppliername}, |
92 |
booksellerid => $_->{booksellerid}, |
93 |
receivedbiblios => $_->{receivedbiblios}, |
94 |
receiveditems => $_->{receiveditems}, |
95 |
subscriptionid => $_->{subscriptionid}, |
96 |
closedate => $_->{closedate}, |
97 |
); |
98 |
push @results_loop, \%row; |
99 |
} |
100 |
} |
86 |
} |
101 |
|
87 |
|
102 |
# Build suppliers list |
88 |
# Build suppliers list |
103 |
my @suppliers = GetBookSeller(undef); |
89 |
my @suppliers = GetBookSeller(undef); |
104 |
my @suppliers_loop = (); |
90 |
my $suppliers_loop = []; |
105 |
my $suppliername; |
91 |
my $suppliername; |
106 |
foreach (@suppliers) { |
92 |
foreach (@suppliers) { |
107 |
my $selected = 0; |
93 |
my $selected = 0; |
108 |
if ( $supplierid && $supplierid == $_->{'id'} ) { |
94 |
if ($supplierid && $supplierid == $_->{id} ) { |
109 |
$selected = 1; |
95 |
$selected = 1; |
110 |
$suppliername = $_->{'name'}; |
96 |
$suppliername = $_->{name}; |
111 |
} |
97 |
} |
112 |
my %row = ( |
98 |
push @{$suppliers_loop}, |
113 |
suppliername => $_->{'name'}, |
99 |
{ |
114 |
booksellerid => $_->{'id'}, |
100 |
suppliername => $_->{name}, |
|
|
101 |
booksellerid => $_->{id}, |
115 |
selected => $selected, |
102 |
selected => $selected, |
116 |
); |
103 |
}; |
117 |
push @suppliers_loop, \%row; |
|
|
118 |
} |
104 |
} |
119 |
|
105 |
|
120 |
# Build branches list |
106 |
# Build branches list |
121 |
my $branches = GetBranches(); |
107 |
my $branches = GetBranches(); |
122 |
my @branches_loop = (); |
108 |
my $branches_loop = []; |
123 |
my $branchname; |
109 |
my $branchname; |
124 |
foreach ( sort keys %$branches ) { |
110 |
foreach ( sort keys %$branches ) { |
125 |
my $selected = 0; |
111 |
my $selected = 0; |
Lines 127-157
foreach ( sort keys %$branches ) {
Link Here
|
127 |
$selected = 1; |
113 |
$selected = 1; |
128 |
$branchname = $branches->{$_}->{'branchname'}; |
114 |
$branchname = $branches->{$_}->{'branchname'}; |
129 |
} |
115 |
} |
130 |
my %row = ( |
116 |
push @{$branches_loop}, |
|
|
117 |
{ |
131 |
branchcode => $_, |
118 |
branchcode => $_, |
132 |
branchname => $branches->{$_}->{'branchname'}, |
119 |
branchname => $branches->{$_}->{branchname}, |
133 |
selected => $selected, |
120 |
selected => $selected, |
134 |
); |
121 |
}; |
135 |
push @branches_loop, \%row; |
|
|
136 |
} |
122 |
} |
137 |
|
123 |
|
138 |
$template->param( |
124 |
$template->param( |
139 |
do_search => ( $op and $op eq "do_search" ) ? 1 : 0, |
125 |
do_search => ( $op and $op eq 'do_search' ) ? 1 : 0, |
140 |
results_loop => \@results_loop, |
126 |
invoices => $invoices, |
141 |
invoicenumber => $invoicenumber, |
127 |
invoicenumber => $invoicenumber, |
142 |
booksellerid => $supplierid, |
128 |
booksellerid => $supplierid, |
143 |
suppliername => $suppliername, |
129 |
suppliername => $suppliername, |
144 |
billingdatefrom => $billingdatefrom, |
130 |
billingdatefrom => $billingdatefrom, |
145 |
billingdateto => $billingdateto, |
131 |
billingdateto => $billingdateto, |
146 |
isbneanissn => $isbneanissn, |
132 |
isbneanissn => $isbneanissn, |
147 |
title => $title, |
133 |
title => $title, |
148 |
author => $author, |
134 |
author => $author, |
149 |
publisher => $publisher, |
135 |
publisher => $publisher, |
150 |
publicationyear => $publicationyear, |
136 |
publicationyear => $publicationyear, |
151 |
branch => $branch, |
137 |
branch => $branch, |
152 |
branchname => $branchname, |
138 |
branchname => $branchname, |
153 |
suppliers_loop => \@suppliers_loop, |
139 |
suppliers_loop => $suppliers_loop, |
154 |
branches_loop => \@branches_loop, |
140 |
branches_loop => $branches_loop, |
155 |
); |
141 |
); |
156 |
|
142 |
|
157 |
output_html_with_http_headers $input, $cookie, $template->output; |
143 |
output_html_with_http_headers $input, $cookie, $template->output; |