Adição das casas decimais

This commit is contained in:
2026-06-22 19:24:30 -03:00
parent 56b3e146bf
commit 74391d5a0c
6 changed files with 23 additions and 9 deletions

View File

@@ -82,8 +82,11 @@ module Pdf
end
end
# Moeda BR com separador de milhar: R$ 1.234,56
def moeda(v)
"R$ #{format('%.2f', v.to_f)}".gsub('.', ',')
inteiro, decimais = format('%.2f', v.to_f).split('.')
inteiro = inteiro.reverse.gsub(/(\d{3})(?=\d)/, '\1.').reverse
"R$ #{inteiro},#{decimais}"
end
# Bloco de assinaturas lado a lado: motorista (esquerda) e administrador