Casey
Casey

Reputation: 1

Podio app calculation - round off to two decimal places

I have a Podio app that multiplies a couple of numbers in two different number fields (see screenshots) and puts the result in the "Total to be Paid" field. The problem is that it doesn't round off to two decimal places. Some times it does, other times it does not. Sometimes it displays 3 decimal places, sometimes a lot more than that. How can I get it to round off to 2 decimal places?

The code I put in the calculation field is "$" + @Number of Hours Worked (from timedoctor.com) * @Hourly Rate

http://screencast.com/t/85cxDP2CUWJ

Upvotes: 0

Views: 234

Answers (1)

Pavlo - Podio
Pavlo - Podio

Reputation: 2013

Please try:

function numberWithoutCommas(x) {
   return parseFloat(x).toFixed(2).toString();
}

"$" + numberWithoutCommas(@Price * @Count)

@Price and @Count have to be replaced with your variables, and those are number in my example.

Upvotes: 2

Related Questions