From: Jan Büren Date: Wed, 23 Mar 2022 12:33:00 +0000 (+0100) Subject: Payment-Helper Anpassungen aus Testfall X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~96 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a3263b669347ae6cb6555bc01023c1bff3a1b9d4;p=kivitendo-erp.git Payment-Helper Anpassungen aus Testfall - 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 --- 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; }