var decimalCommaBootgridConverter = {
    from: function (value) { return Number(value.replace(",", ".")); },
    to: function (value) {
        var stringValue = (roundToTwo(value) + "").replace(".", ",");
        var decimalPieces = stringValue.split(',');

        if (decimalPieces.length < 2) {
            stringValue += ",00";
        }
        else {
            for (var i = decimalPieces[1].length; i < 2; i++) {
                stringValue += "0";
            }
        }

        return stringValue
    }
}

function roundToTwo(num) {
    return +(Math.round(num + "e+2") + "e-2");
}

var decimalCommaBootgridConverterPrecisionThree = {
    from: function (value) { return Number(value.replace(",", ".")); },
    to: function (value) {
        var stringValue = (roundToThree(value) + "").replace(".", ",");
        var decimalPieces = stringValue.split(',');

        if (decimalPieces.length < 2) {
            stringValue += ",000";
        }
        else {
            for (var i = decimalPieces[1].length; i < 3; i++) {
                stringValue += "0";
            }
        }

        return stringValue
    }
}

function roundToThree(num) {
    return num.toFixed(3);
}