Sha256: 0aaf015cdb6c0f72106ea90d195a76eb2fa60d6422f5203bf041c64d2f2e3120
Contents?: true
Size: 748 Bytes
Versions: 2
Compression:
Stored size: 748 Bytes
Contents
module BrDanfe class Helper def self.homologation?(xml) xml.css('nfeProc/NFe/infNFe/ide/tpAmb').text == '2' end def self.numerify(number) return '' if !number || number == '' separated_number = number.to_s.split('.') integer_part = separated_number[0].reverse.gsub(/\d{3}(?=\d)/, '\&.').reverse decimal_part = separated_number[1] || '00' decimal_part += '0' if decimal_part.size < 2 integer_part + ',' + decimal_part end def self.format_datetime(xml_datetime) formated = '' unless xml_datetime.empty? date = DateTime.strptime(xml_datetime, '%Y-%m-%dT%H:%M:%S') formated = date.strftime('%d/%m/%Y %H:%M:%S') end formated end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
br_danfe-0.12.1 | lib/br_danfe/helper.rb |
br_danfe-0.12.0 | lib/br_danfe/helper.rb |