http://codereview.appspot.com/74052
It is a patch that adds rounding on amount of each tax lines of the invoice.
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: cedric...@b2ck.com
Jabber: cedric...@b2ck.com
Website: http://www.b2ck.com/
This is wrong because the tax amount will be write in an account so you must
have it at the currency precision.
> In general it is to early for me to write a patch. We need at first do
> more research and find a correct and reliable solution.
--
No, but it is logical because sum of debit/credit must be 0.
> Tryton seems to have some problems with the presentation of rounded
> taxes in invoices. Please check!
Maybe one should think about the calculation scheme for the tax amount.
Mostly goods or services are sold net. So adding up all items with 7% tax and
calculating the tax amount on the net sum (with rounding according to account
settings), then doing the same with the 19% items.
Anyway, as i'm not an accountant, I will check with my tax agent and post the
(authoritative ;-) answer-
Best,
Axel
--
Dr.-Ing. Axel K. Braun
Mobile: +49.173.7003.154
VoIP/Skype: axxite
PGP Fingerprint: CB03 964D 1CFA E87B AA63 53F3 1BD6 F53A EB48 EF22
Public Key available at http://www.axxite.com/axel....@gmx.de.asc
Written from my EeePC 901 GO running Linux
So you transfert amount tax from one tax to an other, I'm not sure it is legal
in any country. What about taxes paid to different autority? Who decides which
tax will receive the rouding error ?
And if you create an invoice with only the line with the 19% tax, you will
have a tax amount of 7,10.
This is how it is implemented except that it was missing a rounding at the
end.
> Anyway, as i'm not an accountant, I will check with my tax agent and post the
> (authoritative ;-) answer-
Ok:
7.0974 -> 7.09
7.0974 -> 7.09
7.0974 -> 7.09
--------------
21.2922 21.27
-> 21.29
Rounding is always a lost of precision, there will be always some cases that
works and some others not well.
What you propose is to use an other rounding rule instead of the round-to-even
method (aka "bankers' rounding") [1] because yours have better statistical result
in this specific case of tax sum.
For what I know in Belgium, you can choose your rounding method but you must
always use the same. So your method only works for the specific case of tax
sum. And I think we must use the common sense to round numbers like 7,0965 to
7,10 instead of 7.09 otherwise users will think that the system doesn't
compute correctly.
[1] http://en.wikipedia.org/wiki/Rounding#Round-to-even_method
And two others for sale and purchase:
http://codereview.appspot.com/75070
http://codereview.appspot.com/75071
I think it is the good way to fix the issue, if there is no problem I will
push it today on dev branch and in one week on others.
Applied in dev branch.
FYI I started a request on an experts list in germany. But no answers
yet. See:
http://www.carookee.com/forum/bilanzbuchhalter-fachthemen/Rundung_von_Steuern_in_Rechnungen_mit_Nettobetraegen.24814265.0.01103.html
And I requested Jiri Sima the Author of
http://www2.cs.cas.cz/~sima/trp.ps for a real world code example of his
solution, but he told me that he don't know any.
Am Dienstag 16 Juni 2009 schrieb Udono:
> Am Dienstag, den 16.06.2009, 22:51 +0200 schrieb Cédric Krier:
> > Applied in dev branch.
>
> Yes, the patch seems to work, but keep investigation for more
> informations abou this.
>
> FYI I started a request on an experts list in germany. But no answers
> yet. See:
I got the answer from my tax agent:
Lt. deutschem Gesetz ist es so, dass die Bemessungsgrundlage für die
Umsatzsteuer das vereinbarte Nettoentgelt ist und darauf die Umsatzsteuer
berechnet wird. Die Umsatzsteuer selbst wird kaufmännisch gerundet und dem
Nettoentgelt hinzugerechnet.
Die Summe der Rechnung müsste folglich 75,91€ lauten.
Selbst wenn Rabatte etc. gegeben werden, müsste der Bruttowert aufgeteilt
werden in einen Nettowert und Steuerbetrag. Da der Nettobetrag der
maßgebende Wert ist, orientiert sich die Steuer an ihm und das Problem
stellt sich nicht.
In der Praxis ist es aber häufig anders. Wenn also vom Bruttobetrag
heruntergerechnet werden muss, wird der Nettobetrag entsprechend angepasst,
hier also 29,39 x 7 % 2,06 = 31,45 + 44,45 = 75,90. Hintergedanke ist, dass
die Steuer nicht verkürzt werden darf.
Summary in English: Baseline is the net amount, to which the tax has to be
added. I think 'best practice' would be to have all net amounts for 7% and
all for 19% added up, before the tax is calculated on the total.
Best,
Axel
--
Dr.-Ing. Axel K. Braun
Mobile: +49.173.7003.154
VoIP/Skype: axxite
PGP Fingerprint: CB03 964D 1CFA E87B AA63 53F3 1BD6 F53A EB48 EF22
Public Key available at http://www.axxite.com/axel....@gmx.de.asc
This mail was *not scanned* before sending.
It was sended from a virus-free Linux desktop.
Am Mittwoch, den 17.06.2009, 08:44 +0200 schrieb Dr. Axel Braun:
> I got the answer from my tax agent:
> Summary in English: Baseline is the net amount, to which the tax has to be
> added. I think 'best practice' would be to have all net amounts for 7% and
> all for 19% added up, before the tax is calculated on the total.
This sounds reasonable. And since Trytons accounting is based on net
amounts, cedrics patch solved this topic in the right way.
Thank you for further investigations!
Regards
Udo Spallek
--
____________________________________
virtual things
Preisler & Spallek GbR
München - Aachen
Windeckstr. 77
81375 München
Tel: +49 (89) 710 481 55
Fax: +49 (89) 710 481 56
In the answer is exacly the same stated as Axels tax agent said. So it
seems we are very safe with the solution provided by cedric.
Cheers Udo
Some additional informations for the log:
The problem on rounding which not preserve the sum appears when
calculate, round and print taxes for each line of the invoice. If you
add the rounded linewise taxes, this sum may differ to the total taxes
calculated by the sumed up base amount of each tax. For this you need an
algorithm which is similar to curve-fitting in science.
--
____________________________________
virtual things
Preisler & Spallek GbR
Munich - Aix-la-Chapelle
Windeckstr. 77
81375 Munich - Germany