Refresh invoice amounts during edition

Hi,

Up : topic 2727/2

It would be interesting to be able to refresh the subtotal, total, balance … of the invoice while we are editing it.

Last Update: 03.08.2017

You will still need to click the “save” button.
Also javascript is not very reliable/trustworthy when it comes to mathematics:
https://charlieharvey.org.uk/page/javascript_the_weird_parts

I understand it could be convenient to have a preview on-the-fly but it might also lead to unpleasant surprises if you trust the javascript output and don’t review the numbers after clicking “save”.

By having a centralized calculation method, we can imaginne :

  1. (Preview) The JS can call a page that applies the calculations and returns a JSON.
  2. (SAVE) When the invoice is saved, the same method of calculation is used.

That means you have to send a request everytime onkeypress. That would do the trick for sure but that is not very elegant.
I’d choose the pure javascript/client-side way if I had to make a decision among all the possibilities. I just wanted to highlight the fact that JS is “touchy” and having erratic outputs would kind of discredit the InvoicePlane app. in my opinion.
Don’t get me wrong, if someone can implement this in a reliable fashion, not just with some “lightweight javascript” like stated in the topic you are referring to, I’d sure love to see it.