=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-02-12 12:39:34 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-02-12 13:09:58 +0000 @@ -423,6 +423,18 @@ } }; + util.number = { + getNumberOfDecimals: function(x) { + var tmp = new String(x); + return (tmp.indexOf(".") > -1) ? (tmp.length - tmp.indexOf(".") - 1) : 0; + }, + + roundIf: function(x, fix) { + var dec = pt.util.number.getNumberOfDecimals(x); + return parseFloat(dec > fix ? x.toFixed(fix) : x); + } + }; + util.pivot = { getTable: function(settings, pt, container) { var getParamStringFromDimensions, @@ -1006,7 +1018,8 @@ // Total row html items for (var i = 0, rowSum; i < totalRowItems.length; i++) { - rowSum = totalRowItems[i]; + rowSum = totalRowItems[i]; + rowSum = pt.util.number.roundIf(rowSum, 1); a.push(['