X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FHelper%2FPriceTaxCalculator.pm;h=73613f89df80419197984dedcdc9cc909828895e;hb=937e37ad007405c6a3a389ee18006379ffecc073;hp=8bd03598dbe11251361340a38a72938436cfd55a;hpb=361d8846ed83e99bb34b13c46b4e6b5a7090c70f;p=kivitendo-erp.git diff --git a/SL/DB/Helper/PriceTaxCalculator.pm b/SL/DB/Helper/PriceTaxCalculator.pm index 8bd03598d..73613f89d 100644 --- a/SL/DB/Helper/PriceTaxCalculator.pm +++ b/SL/DB/Helper/PriceTaxCalculator.pm @@ -53,8 +53,9 @@ sub calculate_prices_and_taxes { sub _get_exchangerate { my ($self, $data, %params) = @_; - if (($self->curr || '') ne SL::DB::Default->get_default_currency) { - $data->{exchangerate} = $::form->check_exchangerate(\%::myconfig, $self->curr, $self->transdate, $data->{is_sales} ? 'buy' : 'sell'); + my $currency = $self->currency_id ? $self->currency->name || '' : ''; + if ($currency ne SL::DB::Default->get_default_currency) { + $data->{exchangerate} = $::form->check_exchangerate(\%::myconfig, $currency, $self->transdate, $data->{is_sales} ? 'buy' : 'sell'); $data->{exchangerate} ||= $params{exchangerate}; } $data->{exchangerate} ||= 1; @@ -119,7 +120,7 @@ sub _calculate_item { $self->netamount($self->netamount + $sellprice * $item->qty / $item->price_factor); my $chart = $item->part->get_chart(type => $data->{is_sales} ? 'income' : 'expense', taxzone => $self->taxzone_id); - $data->{amounts}->{ $chart->id } ||= { taxkey => $taxkey->taxkey_id, amount => 0 }; + $data->{amounts}->{ $chart->id } ||= { taxkey => $taxkey->taxkey_id, tax_id => $taxkey->tax_id, amount => 0 }; $data->{amounts}->{ $chart->id }->{amount} += $linetotal; push @{ $data->{assembly_items} }, [];