X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/8c1d5d7530f3a1c923ee470b7ff31616800a8574..98c23539610c6d083265454858ef25e563f74b21:/SL/Form.pm diff --git a/SL/Form.pm b/SL/Form.pm index cc9881413..d2aa04927 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -951,6 +951,8 @@ sub round_amount { return 0 if !defined $amount; + $places //= 0; + if ($adjust) { my $precision = $::instance_conf->get_precision || 0.01; return $self->round_amount( $self->round_amount($amount / $precision, 0) * $precision, $places); @@ -3671,11 +3673,12 @@ sub calculate_tax { my ($self,$amount,$taxrate,$taxincluded,$roundplaces) = @_; - $roundplaces = 2 unless defined $roundplaces; + $roundplaces //= 2; + $taxincluded //= 0; my $tax; - if ($taxincluded *= 1) { + if ($taxincluded) { # calculate tax (unrounded), subtract from amount, round amount and round tax $tax = $amount - ($amount / ($taxrate + 1)); # equivalent to: taxrate * amount / (taxrate + 1) $amount = $self->round_amount($amount - $tax, $roundplaces);