Lines 187-229
foreach my $order (@$orders) {
Link Here
|
187 |
|
187 |
|
188 |
push @foot_loop, map {$_} values %foot; |
188 |
push @foot_loop, map {$_} values %foot; |
189 |
|
189 |
|
190 |
my $budgets = GetBudgets(); |
|
|
191 |
my @budgets_loop; |
192 |
my $shipmentcost_budgetid = $details->{shipmentcost_budgetid}; |
190 |
my $shipmentcost_budgetid = $details->{shipmentcost_budgetid}; |
193 |
foreach my $budget (@$budgets) { |
191 |
|
194 |
next unless CanUserUseBudget( $loggedinuser, $budget, $flags ); |
192 |
# build budget list |
195 |
my %line = %{$budget}; |
193 |
my $budget_loop = []; |
196 |
if ( $shipmentcost_budgetid |
194 |
my $budgets = GetBudgetHierarchy(); |
197 |
and $budget->{budget_id} == $shipmentcost_budgetid ) |
195 |
foreach my $r ( @{$budgets} ) { |
198 |
{ |
196 |
next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) ); |
199 |
$line{selected} = 1; |
197 |
|
|
|
198 |
if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { |
199 |
next; |
200 |
} |
200 |
} |
201 |
push @budgets_loop, \%line; |
201 |
|
|
|
202 |
my $selected = $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0; |
203 |
|
204 |
push @{$budget_loop}, |
205 |
{ |
206 |
b_id => $r->{budget_id}, |
207 |
b_txt => $r->{budget_name}, |
208 |
b_active => $r->{budget_period_active}, |
209 |
selected => $selected, |
210 |
}; |
202 |
} |
211 |
} |
203 |
|
212 |
|
|
|
213 |
@{$budget_loop} = |
214 |
sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop}; |
215 |
warn Data::Dumper::Dumper( $budget_loop ); |
216 |
|
204 |
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({ invoiceid => $details->{'invoiceid'} }); |
217 |
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({ invoiceid => $details->{'invoiceid'} }); |
205 |
if ( $adjustments ) { $template->param( adjustments => $adjustments ); } |
218 |
if ( $adjustments ) { $template->param( adjustments => $adjustments ); } |
206 |
|
219 |
|
207 |
$template->param( |
220 |
$template->param( |
208 |
invoiceid => $details->{'invoiceid'}, |
221 |
invoiceid => $details->{'invoiceid'}, |
209 |
invoicenumber => $details->{'invoicenumber'}, |
222 |
invoicenumber => $details->{'invoicenumber'}, |
210 |
suppliername => $details->{'suppliername'}, |
223 |
suppliername => $details->{'suppliername'}, |
211 |
booksellerid => $details->{'booksellerid'}, |
224 |
booksellerid => $details->{'booksellerid'}, |
212 |
shipmentdate => $details->{'shipmentdate'}, |
225 |
shipmentdate => $details->{'shipmentdate'}, |
213 |
billingdate => $details->{'billingdate'}, |
226 |
billingdate => $details->{'billingdate'}, |
214 |
invoiceclosedate => $details->{'closedate'}, |
227 |
invoiceclosedate => $details->{'closedate'}, |
215 |
shipmentcost => $shipmentcost, |
228 |
shipmentcost => $shipmentcost, |
216 |
orders_loop => \@orders_loop, |
229 |
orders_loop => \@orders_loop, |
217 |
foot_loop => \@foot_loop, |
230 |
foot_loop => \@foot_loop, |
218 |
total_quantity => $total_quantity, |
231 |
total_quantity => $total_quantity, |
219 |
total_tax_excluded => $total_tax_excluded, |
232 |
total_tax_excluded => $total_tax_excluded, |
220 |
total_tax_included => $total_tax_included, |
233 |
total_tax_included => $total_tax_included, |
221 |
total_tax_value => $total_tax_value, |
234 |
total_tax_value => $total_tax_value, |
222 |
total_tax_excluded_shipment => $total_tax_excluded + $shipmentcost, |
235 |
total_tax_excluded_shipment => $total_tax_excluded + $shipmentcost, |
223 |
total_tax_included_shipment => $total_tax_included + $shipmentcost, |
236 |
total_tax_included_shipment => $total_tax_included + $shipmentcost, |
224 |
invoiceincgst => $bookseller->invoiceincgst, |
237 |
invoiceincgst => $bookseller->invoiceincgst, |
225 |
currency => Koha::Acquisition::Currencies->get_active, |
238 |
currency => Koha::Acquisition::Currencies->get_active, |
226 |
budgets_loop => \@budgets_loop, |
239 |
budgets => $budget_loop, |
227 |
); |
240 |
); |
228 |
|
241 |
|
229 |
defined( $invoice_files ) && $template->param( files => $invoice_files->GetFilesInfo() ); |
242 |
defined( $invoice_files ) && $template->param( files => $invoice_files->GetFilesInfo() ); |