Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

3 decimals in product prices

Marti Artalejo   ( User )

Commented 2 years ago

Hi, I would need to place prices with 3 decimals in the items in my invoices, but they are always rounded at 2. Is there any way to place prices with 3? Thanks!

Ahmad   ( User )

Commented 2 years ago

I have the same question, can anyone help?

Ahmad   ( User )

Commented 2 years ago

I think I found I solution for this by editing the code:

We need to edit in two files:

1. Money.php
- Path: vendor\akaunting\laravel-money\src\Money.php
- Function: parseAmount
- Code:
Instead of:
if (is_float($amount)) {
return (float) $this->round($this->convertAmount($amount, $convert));
}
Replace it by this:
if (is_float($amount)) {
if (env('SETTING_ENABLE_MONEY_ROUNDING', true)) {
return (float) $this->round($this->convertAmount($amount, $convert));
}
return (float) $this->convertAmount($amount, $convert);
}


2. ".env" File
Add the line below at the end:
SETTING_ENABLE_MONEY_ROUNDING=false

Ahmad   ( User )

Commented 2 years ago

Note: It's not a good solution because we are editing in the vendor folder

Please login or register to leave a response.

Showing 1 to 4 of 4 discussions