We are using the latetst version of InvoicePlane in the Netherlands, but we encounter an issue which hopefully can be solved easily.
The ‘item price’ automatically is set to 2 decimals behind the comma. As in Holland we have a 21% VAT tarif, 2 decimals is not enough to correctly calcute the total price.
Most effective would be to have 4 digitis in item price.
Fe.
€ 8,2644 will be € 10,00 including VAT (4 digits)
but
€ 8,26 will be € 9,99 (2 digitis)
Is there a way to change this in the code?
I see some threads where they have some issue with the decimals in the quantity field, but cannot find anything about the item price field.
Any help would be appreciated.
It depend where you want this conversion done.
For example, if you want an item to be stored on the db after conversion, then make this change to product model application/modules/products/models/Mdl_products.php
If you want the invoice to be changed, then change the appropriate invoice model (there are a few).
public function save($id = null, $db_array = null)
{
$db_array['field_name'] = some_calculation_to_round( ...);
parent::save($id, $db_array);
}
The decimal point is specified as 2 fractional numbers on the database. You will have to change the data type of the database to allow a 4 digit fractional part.
I checked the database but I see no value in ‘invoice_amounts’ that will change the decimals from 2 to 4.
There are 2 instances that have ‘decimal’ as value, but those two can be configured in the settings of InvoicePlane (and are not the item price excluding VAT).
Am I missing something?
I changed every value in ‘ip_invoice_amounts’ en ‘ip_invoice_item_amounts’ from (20,2) to (20,4).
Unfortunately this didn’t change anything. The software is holding on to the 2 decimals.
We need to know if it stores 4 decimals in the database and my eduncared guess tells me it’s going to handle 2 decimals despite the 4 decimals in the database
The database now holds 4 decimals. But when you add an item it only stores 2.
So there is room for 4 decimals in the database now, but the system only saves the first 2.
8.2644 input results now in 8.2600
I’m so glad it helped. With invoiceplane version2 we’re going to do this a little differently. If you want to help join us on the slack channel, so you can control the outcome