From 58e48c011596e2c4b74632c7492184df3bd123ec Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Thu, 23 Jun 2016 16:41:50 +0200 Subject: [PATCH] =?utf8?q?PriceTaxCalculator=20-=20W=C3=A4hrungskurs=20abh?= =?utf8?q?=C3=A4ngig=20von=20Belegtyp?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bei OE-Belegen wird alles in der Belegwährung gespeichert, daher keine Wechselkursumrechnung (exchangerate = 1). Bei Rechnungsbelegen wird hingegen der Währungskurs berücksichtigt. --- SL/DB/Helper/PriceTaxCalculator.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SL/DB/Helper/PriceTaxCalculator.pm b/SL/DB/Helper/PriceTaxCalculator.pm index 6afb45a4f..c36633d64 100644 --- a/SL/DB/Helper/PriceTaxCalculator.pm +++ b/SL/DB/Helper/PriceTaxCalculator.pm @@ -40,7 +40,15 @@ sub calculate_prices_and_taxes { items => [ ], ); - _get_exchangerate($self, \%data, %params); + # set exchangerate in $data>{exchangerate} + if ( ref($self) eq 'SL::DB::Order' ) { + # orders store amount in the order currency + $data{exchangerate} = 1; + } else { + # invoices store amount in the default currency + _get_exchangerate($self, \%data, %params); + # $data{exchangerate} = $self->exchangerate; # untested alternative for setting exchangerate + }; $self->netamount( 0); $self->marge_total(0); -- 2.20.1