Bug 27801: Fix javascript price calculations

This patch ensures we're formatting the price values consistently for
the table total and the amount to pay input field.

Test plan
1) Add an item to charge at 0.10.
2) Add this same item 8 or 9 times (Do not use the 'quantity')
3) Note that the table total and the 'Amount paid' values do not match
4) Apply the patch and repeat the above steps.. the values should now
   match.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7e72a7dde5)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2021-12-03 15:29:00 +00:00 committed by Andrew Fuerste-Henry
parent 7850311332
commit 9e16f33b37
1 changed files with 2 additions and 1 deletions

View File

@ -342,7 +342,8 @@
{
iTotalPrice += aData[i][3]*1;
}
nFoot.getElementsByTagName('td')[1].innerHTML = iTotalPrice.format_price();
iTotalPrice = iTotalPrice.format_price();
nFoot.getElementsByTagName('td')[1].innerHTML = iTotalPrice;
$('#paid').val(iTotalPrice);
$('#paid').trigger('change');
},