A new release of the InvoicePlane application is available: v1.4.3
You can download the latest version from the InvoicePlane website.
Update Guide | Changelog
This version includes 2 fixes. One for invalid values when saving quotes or invoices and one that shows if a password is entered in the settings.
Thank you a lot!
There is the problem about the discount, it should be calculated before than tax… I tried to fix this, but I’m noob and my code is broken.
Do you think it’s possible to resolve this issue? Is it too hard to do it?
You can change the order of the calculations here: https://github.com/InvoicePlane/InvoicePlane/blob/master/application/modules/invoices/models/mdl_invoice_amounts.php#L58
$invoice_subtotal = $this->calculate_discount($invoice_id, $invoice_subtotal);
$invoice_total = $invoice_item_subtotal + $invoice_amounts->invoice_item_tax_total;
I tried in mdl_quote_amounts.php, but nothing. I tried to edit the public funcions of tax and discount and to change them order… is it the correct way?
No, just take a look at the linked file and take a look at the example. Two lines were swapped.
Great! I’ll try. Many many thanks!
I tried with your code and with this code (I had already made these changes, I thought I had made mistakes, but they were correct in “quote”):
$quote_item_subtotal = $quote_amounts->quote_item_subtotal - $quote_amounts->quote_item_discount;
$quote_subtotal = $this->calculate_discount($quote_id, $quote_item_subtotal);
$quote_total = $quote_subtotal + $quote_amounts->quote_item_tax_total;
I think that the issue is in
public function calculate_quote_taxes
because it calculate amount without the total discount and in
public function calculate_discount
because it is calculated after “taxes function” with the total item + taxes and not only with the total item.
It’s correct, ins’t it?
You would have to change the order in both functions.
I tried to do this, but I’m not an expert and it doesn’t work…
Confirm, I tried again and again and again, but I’m not able to fix this problem.
Sorry but I can’t continue.
Unfortunately the release does not include Pitma’s correction for invoice archive, discussed at:
Yes, sorry. That’s why I always create a bug report for issues instead of just fixing it…
Will be available in 1.4.4
2 posts were split to a new topic: Wrong calculation order