Revision 6c94b5a5
Von Sven Schöling vor fast 9 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
3673 | 3673 |
|
3674 | 3674 |
my ($self,$amount,$taxrate,$taxincluded,$roundplaces) = @_; |
3675 | 3675 |
|
3676 |
$roundplaces = 2 unless defined $roundplaces; |
|
3676 |
$roundplaces //= 2; |
|
3677 |
$taxincluded //= 0; |
|
3677 | 3678 |
|
3678 | 3679 |
my $tax; |
3679 | 3680 |
|
3680 |
if ($taxincluded *= 1) {
|
|
3681 |
if ($taxincluded) { |
|
3681 | 3682 |
# calculate tax (unrounded), subtract from amount, round amount and round tax |
3682 | 3683 |
$tax = $amount - ($amount / ($taxrate + 1)); # equivalent to: taxrate * amount / (taxrate + 1) |
3683 | 3684 |
$amount = $self->round_amount($amount - $tax, $roundplaces); |
Auch abrufbar als: Unified diff
warnings: besseres sanitizing in Form::calculate_tax