def fmt_num(value, places = 2)
      return nil if value.blank?

      value =
          if value.respond_to?(:to_f)
            value.to_f
          else
            nil
          end

      return nil unless value.is_a?(::Float)

      "%0.#{places}f" % value.round(places)
    end
def fmt_num(value, places = 2)
      return nil if value.blank?

      value =
          if value.respond_to?(:to_f)
            value.to_f
          else
            nil
          end

      return nil unless value.is_a?(::Float)

      "%0.#{places}f" % value.round(places)
    end
Formats a number with the specified number of decimal places.

 The +value+ can be any valid numeric expression that can be converted into a float.