lib/ruby_danfe/helper.rb in ruby_danfe-1.13.2 vs lib/ruby_danfe/helper.rb in ruby_danfe-1.15.0
- old
+ new
@@ -8,9 +8,19 @@
int + "," + frac
rescue
number
end
+ def self.numerify_default_zero(number, decimals = 2)
+ number = number.tr("\n","").delete(" ")
+ return "0,00" if !number || number == ""
+ int, frac = ("%.#{decimals}f" % number).split(".")
+ int.gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1\.")
+ int + "," + frac
+ rescue
+ number
+ end
+
def self.invert(y)
28.7.cm - y
end
def self.format_quantity(qty)