crater icon indicating copy to clipboard operation
crater copied to clipboard

Important: Currencies with 3 digits of precision

Open Hujairi opened this issue 4 years ago • 4 comments

I have add a new currency (Bahraini Dinar - BHD) manually from the DB and it has 3 digits precision, formatting looks fine as it shows 3 decimal places but when adding a new invoice the system rounds the last digit. for Ex. if the invoice amount is 12.435 once submitted it becomes 12.430 and it's saved in the DB as 1243.

Hujairi avatar Dec 27 '20 19:12 Hujairi

@Hujairi Hey, It's currently not possible to create invoices with 3 digits of precision. Its DB Structure & everything is designed to work with only 2 digit precision.

I think it'll need a lot more work & testing in order to support more than 2 digits :)

I'll try to see if we can improve this. Meanwhile, if you have any suggestions regarding how to handle this, please feel free to comment.

mohitpanjwani avatar Dec 28 '20 13:12 mohitpanjwani

as far as i see that numbers are being multiplied and divided by 100 for 2 digit currencies, it might help if that number is dynamic as (10 to the power of currency precision) and by that you won't have to change any structure in the DB.

Hujairi avatar Dec 31 '20 12:12 Hujairi

as far as i see that numbers are being multiplied and divided by 100 for 2 digit currencies, it might help if that number is dynamic as (10 to the power of currency precision) and by that you won't have to change any structure in the DB.

Yes, you're right about this. I actually looked more into this after my comment.

We're already using integers for all the currency values. Except for percentages.

Also, we already have a precision column on the currencies table, so we can use that to allow 3 digits of precision but need to test further.

mohitpanjwani avatar Dec 31 '20 12:12 mohitpanjwani

any news on currency digits? something we can test?

zajerao avatar Sep 05 '22 19:09 zajerao