I love the invoice module, but when testing it before going live, I found a bug in the code.
When you add an item to the invoice, that has a VAT percentage that differs from the standerd VAT percentage, the Price without VAT is not correctly calculated.
(when you fill out the Price incl. VAT)

the code uses the standard VAT percentage, and not the percentage that is added to the item information.
to correct this you simply need to change the code in the invoice.ajax.inc file, line 178 as follows.

this uses the form VAT amount and not the standard VAT amount.

I hope this helps others. and improve this module in the future.

$unitcost = $fv['price_with_vat'] / _invoice_vat_percent_to_decimal($fv['vat']);
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

david.goovaerts@gmail.com’s picture

Issue summary: View changes
gisle’s picture

Assigned: david.goovaerts@gmail.com » Unassigned
Status: Active » Reviewed & tested by the community

The code suggested by david.goovaerts works.

Rolled it into a proper patch and changing status to RTBC.

Setting Asigned to "Unassigned" as david.goovaerts will not be only able to commit this (only the maintainer will).

gisle’s picture

Forgot to attach the patch. Here it is.

gisle’s picture

Sigh. Forgot to take into account that maintainer keeps his personal .gitignore in the repo (IMHO, not a good idea), resulting in my personal .gitignore being committed.

Latest patch is the same is the previous, but with the mess caused by this removed.