Saturday, July 27, 2013

When the decimal value round up

There is one client that having issue of round up amount. As an example, if the data has been passed as 87652.23 it will be stored as 87652.20. This will be a problem because the it will cause the amount not tally between source and target. You can format the source as double or float. But if this two methods fail, you should try below:

  • Format("%.2f",<column>)

Let say you have one column name total_amt. Try do like this:

  • <trans>
  • $amt=total_amt;
  • $amt=Format("%.2f",$amt)
  • <\trans>

No comments:

Post a Comment