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']);
Comment | File | Size | Author |
---|---|---|---|
#5 | invoice-price_without_vat_calculation_not_correct-2839154-5.patch | 494 bytes | gisle |
#4 | invoice-price_without_vat_calculation_not_correct-2839154-4.patch | 734 bytes | gisle |
Comments
Comment #2
david.goovaerts@gmail.com CreditAttribution: david.goovaerts@gmail.com commentedComment #3
gisleThe 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).
Comment #4
gisleForgot to attach the patch. Here it is.
Comment #5
gisleSigh. 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.