bigcapital
bigcapital copied to clipboard
Decimal precision issue
Thanks for this app.
I've noticed that decimal fractional values get rounded into integers and this makes some reports inaccurate.
Here's the steps to recreate.
- Create an item with price 100.50
- Create an invoice with the item
- Go to Journal sheet. Debit is 100.50 but Credit is 101.00 with .50 cents difference
@abouolia
This is odd. Did you fix this issue ? I am unable to replicate it.
I'm having the same issue. I created an invoice which has an item with a rate of 13 EUR and a quantity of 159,58 which should total 2.074,54 but instead it rounds it up to 2.080,00
My issue was caused by the quantity
field in entries
being an int
instead of a decimal
.
I'll send a PR up tomorrow for changing it to a decimal
@xprnio You're absolutely right, when I wrote the database migration never thought it could be 1.123457
I thought would be integer all the time, I'd be grateful if you created a PR to fix it, btw here's some things in my mind to do to fix it.
- Create a new database migration on tenants DBs and there're some especial commands for Bigcapital, you can create a new one by
node packages/server/build/commands.js tenants:migrate:make convert_items_entries_quantity_to_decimal
if thecommands.js
file wasn't exist runpnpm run build:server
to build it. - Change the controllers validation schema of of the quantity of all services that have
quantity
, I remember the services have quantity invoices, receipts, estimates, credit notes, bills and vendor credits. - preferable to make the decimal columns accepts 7 digits maximum e.g.
1.1234567
If you have any more questions please let me know.
@abouolia I just created the PR, however I didn't run the e2e tests locally (running Arch with Brave and I couldn't figure out how to configure Playwright to use that), but I saw the GH Actions also run those. So now I'm just waiting for authorization for it to run I guess.
You can find the PR here: https://github.com/bigcapitalhq/bigcapital/pull/316