From a3263b669347ae6cb6555bc01023c1bff3a1b9d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 23 Mar 2022 13:33:00 +0100 Subject: [PATCH] Payment-Helper Anpassungen aus Testfall MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Keine Skonto Steuerkorrektur falls Steuer-Betrag < 0.01 - Zwei Teile von Netto und Steuer können an der dritten Nachkommastelle auf 5 (0.005) berechnet werden. Entsprechend Rundungskorrekturen genauer angepasst --- SL/DB/Helper/Payment.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index e2ea53c06..a748ae004 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -620,8 +620,8 @@ sub _skonto_charts_and_tax_correction { # add-on: correct tax with one linked gl booking - # no skonto tax correction for dual tax (reverse charge) or rate = 0 - next if ($tax->rate == 0 || $tax->reverse_charge_chart_id); + # no skonto tax correction for dual tax (reverse charge) or rate = 0 or taxamount below 0.01 + next if ($tax->rate == 0 || $tax->reverse_charge_chart_id || $skonto_taxamount_rounded < 0.01); my ($credit, $debit); $credit = SL::DB::Manager::Chart->find_by(id => $chart_id); @@ -686,11 +686,11 @@ sub _skonto_charts_and_tax_correction { # is fully assigned. # we simply alter one cent for the first skonto booking entry # should be correct for most of the cases (no invoices with mixed taxes) - if ($total_skonto_rounded - $amount > 0.01) { - # add one cent - $skonto_charts[0]->{skonto_amount} -= 0.01; - } elsif ($amount - $total_skonto_rounded > 0.01) { + if (_round($total_skonto_rounded - $amount) >= 0.01) { # subtract one cent + $skonto_charts[0]->{skonto_amount} -= 0.01; + } elsif (_round($amount - $total_skonto_rounded) >= 0.01) { + # add one cent $skonto_charts[0]->{skonto_amount} += 0.01; } -- 2.20.1