function grdMain_AfterCellUpdateHandler(gridName, cellId) { var key = igtbl_getColumnById(cellId).Key; if (key == "Gains/LossOnPayoff") { var cell = igtbl_getColumnById(cellId); var gainLoss = parseFloat(document.getElementById('grdMainrc_0_12').innerHTML.replace("\$","").replace(",","").replace("(", "-").replace(")", "")); var collections = parseFloat(document.getElementById('grdMainrc_0_14').innerHTML.replace("\$","").replace(",","").replace("(", "-").replace(")", "")); var begCV = parseFloat(document.getElementById('grdMainrc_0_9').innerHTML.replace("\$", "").replace(",","").replace("(", "-").replace(")", "")); var interest = parseFloat(document.getElementById('grdMainrc_0_11').innerHTML.replace("\$","").replace(",","").replace("(", "-").replace(")", "")); var grossProfit = parseFloat(document.getElementById('grdMainrc_0_13').innerHTML.replace("\$","").replace(",","").replace("(", "-").replace(")", "")); var checkValue = (collections - begCV - grossProfit - interest); var calcValue; if (checkValue > begCV) { calcValue = checkValue; } else { calcValue = 0 } if (gainLoss != calcValue) { var msgCheck = confirm("Your manual Gain/Loss value " + gainLoss + " doesn't match the calculated Gain/Loss value " + calcValue + ", Click Ok to replace"); if (msgCheck) { cell.set(cellId, calcValue); //alert(calcValue); } else { cell.set(cellId, gainLoss); //alert(gainLoss); } } } }