Revision 309d139a
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
30 | 30 |
|
31 | 31 |
use SL::Controller::Helper::GetModels; |
32 | 32 |
|
33 |
use List::Util qw(first); |
|
33 |
use List::Util qw(first sum0);
|
|
34 | 34 |
use List::UtilsBy qw(sort_by uniq_by); |
35 | 35 |
use List::MoreUtils qw(any none pairwise first_index); |
36 | 36 |
use English qw(-no_match_vars); |
... | ... | |
1512 | 1512 |
$self->order->currency_id($::instance_conf->get_currency_id()); |
1513 | 1513 |
|
1514 | 1514 |
my %pat = $self->order->calculate_prices_and_taxes(); |
1515 |
|
|
1515 | 1516 |
$self->{taxes} = []; |
1516 |
foreach my $tax_chart_id (keys %{ $pat{taxes} }) {
|
|
1517 |
my $tax = SL::DB::Manager::Tax->find_by(chart_id => $tax_chart_id);
|
|
1517 |
foreach my $tax_id (keys %{ $pat{taxes_by_tax_id} }) {
|
|
1518 |
my $netamount = sum0 map { $pat{amounts}->{$_}->{amount} } grep { $pat{amounts}->{$_}->{tax_id} == $tax_id } keys %{ $pat{amounts} };
|
|
1518 | 1519 |
|
1519 |
my @amount_keys = grep { $pat{amounts}->{$_}->{tax_id} == $tax->id } keys %{ $pat{amounts} }; |
|
1520 |
push(@{ $self->{taxes} }, { amount => $pat{taxes}->{$tax_chart_id}, |
|
1521 |
netamount => $pat{amounts}->{$amount_keys[0]}->{amount}, |
|
1522 |
tax => $tax }); |
|
1520 |
push(@{ $self->{taxes} }, { amount => $pat{taxes_by_tax_id}->{$tax_id}, |
|
1521 |
netamount => $netamount, |
|
1522 |
tax => SL::DB::Tax->new(id => $tax_id)->load }); |
|
1523 | 1523 |
} |
1524 |
|
|
1525 | 1524 |
pairwise { $a->{linetotal} = $b->{linetotal} } @{$self->order->items_sorted}, @{$pat{items}}; |
1526 | 1525 |
} |
1527 | 1526 |
|
Auch abrufbar als: Unified diff
Auftrags-Controller: Steuerwerte pro Steuer, nicht pro Steuerkonto ausweisen