Lines 657-686
function calcNeworderTotal(){
Link Here
|
657 |
var listprice = new Number(f.listprice.value); |
657 |
var listprice = new Number(f.listprice.value); |
658 |
var invoiceingst = new Number (f.invoiceincgst.value); |
658 |
var invoiceingst = new Number (f.invoiceincgst.value); |
659 |
// var exchangerate = new Number(f.elements[currency].value); //get exchange rate |
659 |
// var exchangerate = new Number(f.elements[currency].value); //get exchange rate |
660 |
var currcode = new String(document.getElementById('currency').value); |
660 |
var currcode = new String(document.getElementById('currency').value); |
661 |
var exchangerate = new Number(document.getElementById(currcode).value); |
661 |
var exchangerate = new Number(document.getElementById(currcode).value); |
662 |
|
662 |
var gstrate = new Number(f.gstrate.value); |
663 |
var gst_on=(!listinc && invoiceingst); |
|
|
664 |
|
663 |
|
665 |
//do real stuff |
664 |
//do real stuff |
|
|
665 |
// rrp (replacement cost) should be inclusive of gst and should not take a discount into account |
666 |
var rrp = new Number(listprice*exchangerate); |
666 |
var rrp = new Number(listprice*exchangerate); |
|
|
667 |
// ecost (budgeted cost) should be gst exclusive and should take a discount into account |
667 |
var ecost = new Number(Math.floor(rrp * (100 - discount ))/100); |
668 |
var ecost = new Number(Math.floor(rrp * (100 - discount ))/100); |
|
|
669 |
// the value of the gst, the rate is in f.gstrate.value |
668 |
var GST = new Number(0); |
670 |
var GST = new Number(0); |
669 |
if (gst_on) { |
671 |
|
670 |
rrp=rrp * (1+f.gstrate.value / 100); |
672 |
//rrp *= (100-discount) / 100; |
671 |
GST=ecost * f.gstrate.value / 100; |
673 |
if (listinc==0){ |
|
|
674 |
// list price is gst exclusive so can calc gst easily |
675 |
GST = rrp * gstrate; |
676 |
// list price is gst exclusive, rrp must include gst |
677 |
rrp *= 1 + gstrate; |
678 |
} else { |
679 |
// list price is gst inclusive |
680 |
GST = (rrp/1.15)*0.15; |
681 |
ecost /= 1 + gstrate; |
672 |
} |
682 |
} |
673 |
|
683 |
|
674 |
var total = new Number( (ecost + GST) * quantity); |
684 |
var total = new Number(ecost * quantity); |
675 |
|
685 |
|
676 |
f.rrp.value = rrp.toFixed(2); |
686 |
f.rrp.value = rrp.toFixed(2); |
677 |
|
|
|
678 |
// f.rrp.value = rrp |
679 |
// f.rrp.value = 'moo' |
680 |
|
681 |
f.ecost.value = ecost.toFixed(2); |
687 |
f.ecost.value = ecost.toFixed(2); |
682 |
f.total.value = total.toFixed(2); |
688 |
f.total.value = total.toFixed(2); |
683 |
f.listprice.value = listprice.toFixed(2); |
689 |
f.listprice.value = listprice.toFixed(2); |
|
|
690 |
f.unitprice.value = ecost.toFixed(2); |
684 |
|
691 |
|
685 |
// gst-stuff needs verifing, mason. |
692 |
// gst-stuff needs verifing, mason. |
686 |
if (f.GST) { |
693 |
if (f.GST) { |
687 |
- |
|
|