I have a method that works out invoice totals from a given number:
var itemTotal = dataset.getValue(1,1);
if (itemTotal == null) itemTotal = 0;
var netTotal = itemTotal.toFixed(2);
var vat = netTotal * 0.175;
var vatTotal = vat.toFixed(2);
var inv = netTotal * 1.175;
var invTotal = inv.toFixed(2);
globals.g_invoiceQtyTotal = itemTotal;
globals.g_invoiceNet = netTotal;
globals.g_invoiceVat = vatTotal;
globals.g_invoiceTotal = invTotal;
My problem is that when the itemTotal equals 1903, the inTotal (ie 1903 plus 17.5 percent) comes out as 2236.023 even though it is supposed to be fixed to 2 decimal places. If i change it to toFixed(1) it comes out as 2236.0.
Anyone have any insight into why this is happening?