Closed Jace996 closed 5 months ago
@mildred
I already checked the total amount in database. Here is the steps to reproduce. 1) A invoice netTotal is 2964.542 2) B invoice netTotal is 3561.924 3) I made first payment for A invoice with amount 2526.92. Now, the A invoice unpaid amount is 437.622 4) Then, I made second payment for both A and B invoice which is 3561.924 + 437.622 = 3999.546 5) Because my decimal setting is set to 2. The system auto rounding 3999.546 to 3999.55 lead to total payment added extra 0.01 but my actual payment should be 3999.54
I'm not sure this is bug or not. I edited amount in database manually then solve my problem.
What you are seeing is unfortunately is a known behavior with the .toFixed()
method. (ref: toFixed() Reference Doc). Anything between x.xx0
to x.xx4
while be rounded down, whereas x.xx5
-x.xx9
while be rounded up.
Currently, I believe this behavior is implemented in the format
method below, but I don't think there is an easy fix for this right now. https://github.com/frappe/books/blob/ec5412b53bfe4a9d2d7cd6a75586174189131546/fyo/utils/format.ts#L27
For the most part, I think it is working as intended. The number precision wasn't really meant to have two decimal places while also having numbers in the thousandths places. Yet, I can see the need for this especially in the case of invoices and potentially even currency exchange/equivalency situations. It will probably need to be implemented in a future feature request.
Feature request was made for this here in this issue id -> https://github.com/frappe/books/issues/814
Let me know if that is what you are looking for :)
Expected Behavior
No response
Current Behavior
The total amount is wrong when I trying to make purchase payment for two purchase invoice. Please refer to the image below. 437.62 + 3561.92 = 3999.54 but payment amount show 3999.55 which is incorrect.
Steps to Reproduce
Go to payment page select two invoice would like to pay payment amount is incorrect
FrappeBooks Version
0.20.0
Path or Feature name
Purchase payment page
Country
MYR
Language
EN
OS
Macos (Intel)
Additional OS Info
No response