|
Lines 646-657
function updateCosts(){
Link Here
|
| 646 |
var listprice = new Number($("#listprice").val()); |
646 |
var listprice = new Number($("#listprice").val()); |
| 647 |
var currcode = new String($("#currency").val()); |
647 |
var currcode = new String($("#currency").val()); |
| 648 |
var exchangerate = new Number($("#currency_rate_"+currcode).val()); |
648 |
var exchangerate = new Number($("#currency_rate_"+currcode).val()); |
|
|
649 |
var miscellaneous = new Number($("#miscellaneous").val()); |
| 649 |
var gst_on=false; |
650 |
var gst_on=false; |
| 650 |
|
651 |
|
| 651 |
var rrp = new Number(listprice*exchangerate); |
652 |
var rrp = new Number(listprice*exchangerate); |
| 652 |
var ecost = rrp; |
653 |
var ecost = rrp + miscellaneous; |
| 653 |
if ( 100-discount != 100 ) { //Prevent rounding issues if no discount |
654 |
if ( 100-discount != 100 ) { //Prevent rounding issues if no discount |
| 654 |
ecost = new Number(Math.floor(rrp * (100 - discount )) / 100); |
655 |
ecost = new Number(Math.floor(rrp * (100 - discount )) / 100) + miscellaneous; |
| 655 |
} |
656 |
} |
| 656 |
var total = new Number( ecost * quantity); |
657 |
var total = new Number( ecost * quantity); |
| 657 |
$("#rrp").val(rrp.toFixed(2)); |
658 |
$("#rrp").val(rrp.toFixed(2)); |
|
Lines 659-664
function updateCosts(){
Link Here
|
| 659 |
$("#total").val(total.toFixed(2)); |
660 |
$("#total").val(total.toFixed(2)); |
| 660 |
$("listprice").val(listprice.toFixed(2)); |
661 |
$("listprice").val(listprice.toFixed(2)); |
| 661 |
|
662 |
|
|
|
663 |
// In case the discount changed, we should update the message |
| 664 |
var discount_2dp = discount.toFixed(2); |
| 665 |
$('#discount_value').html(discount_2dp); |
| 666 |
|
| 662 |
return true; |
667 |
return true; |
| 663 |
} |
668 |
} |
| 664 |
|
669 |
|