Closed benboehm closed 4 months ago
Problem here is that original line amount (39.90 in this case) is not saved in the database. Instead, it is stored as amount after deducting the inclusive tax amount and on transaction opening, it is recalculated again using tax percentage instead of taking the amount+tax from database and that is because sql-ledger cannot figure out which tax is for which amount if there are multiple lines. All is well in database if transaction is not edited. But if it needs to be edited, a corner case like this can cause rounding issue.
And reposting such a transaction multiple times will cause even more problem every time.
Here is how it is stored in the database:
And here is code in bin/mozilla/aa.pl which is causing problem. I have tried to arrange it and also tried to use Math::Float to avoid rounding error but could not be fixed.
The only solution seems possible is to store the actual line amount in a new column in acc_trans and use it when we open such a transaction instead of recalculating with above code.
There is nothing wrong or tricky with adding a new column and minor code changes it will require. I just wanted to confirm if we should proceed this way or we can live with this corner case?
Please confirm and I shall proceed accordingly.
Regards
Hey @ledger123 sorry about the delayed answer, but yes you can proceed with the proposal
thank you very much
Hi @benboehm
Good morning.
This issue is fixed as we had planned and commit is attached to this ticket.
You can test it now on our combined demo server or in your own environment.
Regards
Hey @ledger123
So testing this following issues occured
When creating an ap booking (only thing i tested, gl and ar could have similar issues) the values ended up being negativ
so if I create an ap booking with 39.90 as total, it will end up as -39.90
secondly, updating a gl booking doesnt work
Hi @benboehm,
I just tested on my server and all seems to be ok. Check the transaction 'Rounding Problem Test' in both AR and AP transactions. Please note that this issue is only in ar/ap transactions and gl is involved in this issue.
Please test by creating a new transaction in AR and AP and share invoice numbers with me and I can check immediately.
Server access is: https://app.ledger123.com/rma/ with user: demo and password: demo
Hey @ledger123 on your system I cannot reproduce the issues I have on our system
However there still seems to be something off
I created Test 1234
and Test 1234 2
both with amount 39.90 and taxamount 6.93
Difference is one is tax included, the other one not
But still both bookings look different from what I created
can you check and verify?
Thank you
Hi @benboehm ,
It will be great if you can also share what you created as you are saying these transactions are different from what you created so your original contents will help to trouble shoot. Or if you prefer you can make a little screen cast of how you add the transaction and how it gets changed.
Of if you prefer, I am available for an online session any time with few minutes advance notice.
In my testing all is ok as I store original amount in the database and retrieve that amount instead of any reverse calculations.
Regards
I created the same ones as the first one I created
So this:
one with tax included, one with tax excluded
Hi @benboehm ,
I am unable to reproduce the issue on our test server. I have created a screen cast with my testing. Can you please check and confirm what I am missing? Or if you can create a little screen recording reproducing the issue and attach to this ticket or email me to understand how it is not working.
Regards
https://github.com/ledger123/runmyaccounts/assets/13597/f8576dfe-a24a-4409-9f82-01fcc4ce4398
@ledger123 : Hey Armaghan :) Please find attached a video on how to reproduce the issue on your server.
https://github.com/ledger123/runmyaccounts/assets/117820271/d85787d1-8e53-478f-a76c-fa6c994e2b53
Issue still there. See video attached.
https://github.com/ledger123/runmyaccounts/assets/117820271/a8fadea1-d305-407b-bdbe-f983937d4df0
Hi, Lets have teams meeting/interactive session whenever you like. I am available today and tomorrow. You can send me meeting link.
Regards
Invite for meeting sent.
Tested again on this branch successfully:
There is a problem when creating bookings and rounding: Before Posting:
After Posting:
And in the journal: