nfe_reader 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +38 -0
  6. data/Rakefile +13 -0
  7. data/lib/nfe_reader/authorization.rb +12 -0
  8. data/lib/nfe_reader/carrier.rb +16 -0
  9. data/lib/nfe_reader/collection/duplicate.rb +12 -0
  10. data/lib/nfe_reader/collection.rb +34 -0
  11. data/lib/nfe_reader/customer.rb +62 -0
  12. data/lib/nfe_reader/delivery.rb +20 -0
  13. data/lib/nfe_reader/document.rb +73 -0
  14. data/lib/nfe_reader/export.rb +12 -0
  15. data/lib/nfe_reader/fiscal.rb +33 -0
  16. data/lib/nfe_reader/header.rb +129 -0
  17. data/lib/nfe_reader/information.rb +38 -0
  18. data/lib/nfe_reader/product/armament.rb +22 -0
  19. data/lib/nfe_reader/product/cane.rb +42 -0
  20. data/lib/nfe_reader/product/exportation.rb +20 -0
  21. data/lib/nfe_reader/product/fuel.rb +18 -0
  22. data/lib/nfe_reader/product/importation.rb +49 -0
  23. data/lib/nfe_reader/product/medicament.rb +19 -0
  24. data/lib/nfe_reader/product/vehicle.rb +117 -0
  25. data/lib/nfe_reader/product.rb +90 -0
  26. data/lib/nfe_reader/provider.rb +43 -0
  27. data/lib/nfe_reader/purchase.rb +14 -0
  28. data/lib/nfe_reader/removal.rb +20 -0
  29. data/lib/nfe_reader/taxation/cofins.rb +43 -0
  30. data/lib/nfe_reader/taxation/cofins_st.rb +19 -0
  31. data/lib/nfe_reader/taxation/icms.rb +86 -0
  32. data/lib/nfe_reader/taxation/importation_tax.rb +17 -0
  33. data/lib/nfe_reader/taxation/ipi.rb +41 -0
  34. data/lib/nfe_reader/taxation/issqn.rb +22 -0
  35. data/lib/nfe_reader/taxation/pis.rb +42 -0
  36. data/lib/nfe_reader/taxation/pis_st.rb +19 -0
  37. data/lib/nfe_reader/total.rb +76 -0
  38. data/lib/nfe_reader/transport.rb +97 -0
  39. data/lib/nfe_reader/version.rb +5 -0
  40. data/lib/nfe_reader.rb +129 -0
  41. data/lib/nokogiri_hash.rb +60 -0
  42. data/nfe-reader.gemspec +24 -0
  43. data/test/files/sample-nfe.xml +234 -0
  44. data/test/files/sample2-nfe.xml +192 -0
  45. data/test/nfe_reader/authorization_test.rb +22 -0
  46. data/test/nfe_reader/cane_test.rb +71 -0
  47. data/test/nfe_reader/carrier_test.rb +46 -0
  48. data/test/nfe_reader/collection/duplicate_test.rb +27 -0
  49. data/test/nfe_reader/collection_test.rb +78 -0
  50. data/test/nfe_reader/customer_test.rb +133 -0
  51. data/test/nfe_reader/delivery_test.rb +57 -0
  52. data/test/nfe_reader/document_test.rb +113 -0
  53. data/test/nfe_reader/export_test.rb +22 -0
  54. data/test/nfe_reader/fiscal_test.rb +67 -0
  55. data/test/nfe_reader/header_test.rb +135 -0
  56. data/test/nfe_reader/information_test.rb +37 -0
  57. data/test/nfe_reader/product/armament_test.rb +32 -0
  58. data/test/nfe_reader/product/exportation_test.rb +34 -0
  59. data/test/nfe_reader/product/fuel_test.rb +44 -0
  60. data/test/nfe_reader/product/importation_test.rb +64 -0
  61. data/test/nfe_reader/product/medicament_test.rb +37 -0
  62. data/test/nfe_reader/product/vehicle_test.rb +133 -0
  63. data/test/nfe_reader/product_test.rb +125 -0
  64. data/test/nfe_reader/provider_test.rb +155 -0
  65. data/test/nfe_reader/purchase_test.rb +27 -0
  66. data/test/nfe_reader/removal_test.rb +57 -0
  67. data/test/nfe_reader/taxation/cofins_st_test.rb +37 -0
  68. data/test/nfe_reader/taxation/cofins_test.rb +42 -0
  69. data/test/nfe_reader/taxation/icms_test.rb +122 -0
  70. data/test/nfe_reader/taxation/importation_tax_test.rb +32 -0
  71. data/test/nfe_reader/taxation/ipi_test.rb +78 -0
  72. data/test/nfe_reader/taxation/issqn_test.rb +42 -0
  73. data/test/nfe_reader/taxation/pis_st_test.rb +37 -0
  74. data/test/nfe_reader/taxation/pis_test.rb +42 -0
  75. data/test/nfe_reader/total_test.rb +148 -0
  76. data/test/nfe_reader/transport_test.rb +172 -0
  77. data/test/nfe_reader_test.rb +125 -0
  78. data/test/nokogiri_test.rb +27 -0
  79. data/test/test_helper.rb +13 -0
  80. metadata +201 -0
@@ -0,0 +1,76 @@
1
+ # encoding: UTF-8
2
+ module Nfe
3
+ class Total
4
+ attr_reader :icms_base, :icms, :st_base, :st, :product, :freight,
5
+ :insurance, :descount, :ii, :ipi, :pis, :cofins, :another, :total,
6
+ :service_value, :service_base, :service_iss, :service_pis, :service_cofins,
7
+ :retention_pis, :retention_csll, :retention_irrf_base, :retention_cofins,
8
+ :retention_irrf, :retention_foresight_base, :retention_foresight
9
+
10
+ def initialize(attrs = {})
11
+ # Impostos
12
+ if attrs[:ICMSTot]
13
+ # Base ICMS
14
+ @icms_base = attrs[:ICMSTot][:vBC]
15
+ # Valor ICMS
16
+ @icms = attrs[:ICMSTot][:vICMS]
17
+ # Base ICMS ST
18
+ @st_base = attrs[:ICMSTot][:vBCST]
19
+ # Valor ICMS ST
20
+ @st = attrs[:ICMSTot][:vST]
21
+ # Total de Produtos
22
+ @product = attrs[:ICMSTot][:vProd]
23
+ # Total de Frete
24
+ @freight = attrs[:ICMSTot][:vFrete]
25
+ # Total de Seguro
26
+ @insurance = attrs[:ICMSTot][:vSeg]
27
+ # Total de Desconto
28
+ @descount = attrs[:ICMSTot][:vDesc]
29
+ # Total de Imposto de Importacao
30
+ @ii = attrs[:ICMSTot][:vII]
31
+ # Total de IPI
32
+ @ipi = attrs[:ICMSTot][:vIPI]
33
+ # Total de PIS
34
+ @pis = attrs[:ICMSTot][:vPIS]
35
+ # Total de COFINS
36
+ @cofins = attrs[:ICMSTot][:vCOFINS]
37
+ # Total de Outros
38
+ @another = attrs[:ICMSTot][:vOutro]
39
+ # Total NFe
40
+ @total = attrs[:ICMSTot][:vNF]
41
+ end
42
+
43
+ # Servicos
44
+ if attrs[:ISSQNtot]
45
+ # Valor do Servico
46
+ @service_value = attrs[:ISSQNtot][:vServ]
47
+ # Base de calculo do Servico
48
+ @service_base = attrs[:ISSQNtot][:vBC]
49
+ # ISS do Servico
50
+ @service_iss = attrs[:ISSQNtot][:vISS]
51
+ # Pis do Servico
52
+ @service_pis = attrs[:ISSQNtot][:vPIS]
53
+ # Cofins do Servico
54
+ @service_cofins = attrs[:ISSQNtot][:vCOFINS]
55
+ end
56
+
57
+ # Retencoes
58
+ if attrs[:retTrib]
59
+ # Retencao de PIS
60
+ @retention_pis = attrs[:retTrib][:vRetPIS]
61
+ # Retencao de COFINS
62
+ @retention_cofins = attrs[:retTrib][:vRetCOFINS]
63
+ # Retencao de CSLL
64
+ @retention_csll = attrs[:retTrib][:vRetCSLL]
65
+ # Base de Retencao do IRRF
66
+ @retention_irrf_base = attrs[:retTrib][:vBCIRRF]
67
+ # Valor de Retencao do IRRF
68
+ @retention_irrf = attrs[:retTrib][:vIRRF]
69
+ # Base de Retencao da Previdencia
70
+ @retention_foresight_base = attrs[:retTrib][:vBCRetPrev]
71
+ # Valor de Retencao da Previdencia
72
+ @retention_foresight = attrs[:retTrib][:vRetPrev]
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,97 @@
1
+ # encoding: UTF-8
2
+ module Nfe
3
+ class Transport
4
+ attr_reader :kind, :service_value, :base, :icms_aliquot, :icms_value,
5
+ :cfop, :city, :vehicle_plaque, :vehicle_state, :vehicle_rntc, :hauling_palque,
6
+ :hauling_state, :hauling_rntc, :wagon, :ferry, :volume_amount, :volume_kind,
7
+ :volume_brand, :volume_number, :weight_net, :weight_gross, :seals, :carrier
8
+
9
+ # Fields Values:
10
+ #
11
+ # modFrete: 0- Por conta do emitente;
12
+ # 1- Por conta do destinatário/remetente;
13
+ # 2- Por conta de terceiros;
14
+ # 9- Sem frete.
15
+ #
16
+ def initialize(attrs = {})
17
+ # Modalidade
18
+ @kind = attrs[:modFrete]
19
+
20
+ # == Grupo de Retenção do ICMS do transporte
21
+ if attrs[:retTransp]
22
+ # Valor do Servico
23
+ @service_value = attrs[:retTransp][:vServ]
24
+ # BC da Retenção do ICMS
25
+ @base = attrs[:retTransp][:vBCRet]
26
+ # Alíquota da Retenção
27
+ @icms_aliquot = attrs[:retTransp][:pICMSRet]
28
+ # Valor do ICMS Retido
29
+ @icms_value = attrs[:retTransp][:vICMSRet]
30
+ # CFOP
31
+ @cfop = attrs[:retTransp][:CFOP]
32
+ # Municipio gerador de ICMS
33
+ @city = attrs[:retTransp][:cMunFG]
34
+ end
35
+
36
+ # == Veiculo
37
+ if attrs[:veicTransp]
38
+ # Placa
39
+ @vehicle_plaque = attrs[:veicTransp][:placa]
40
+ # Estado
41
+ @vehicle_state = attrs[:veicTransp][:UF]
42
+ # Registro Nacional de Transportador de Carga
43
+ @vehicle_rntc = attrs[:veicTransp][:RNTC]
44
+ end
45
+
46
+ # == Reboque
47
+ if attrs[:reboque]
48
+ # Placa
49
+ @hauling_palque = attrs[:reboque][:placa]
50
+ # Estado
51
+ @hauling_state = attrs[:reboque][:UF]
52
+ # Registro Nacional de Transportador de Carga
53
+ @hauling_rntc = attrs[:reboque][:RNTC]
54
+ end
55
+
56
+ # Vagao
57
+ @wagon = attrs[:vagao]
58
+ # Balsa
59
+ @ferry = attrs[:balsa]
60
+
61
+ # == Volume
62
+ if attrs[:vol]
63
+ # Quantidade de volumes
64
+ @volume_amount = attrs[:vol][:qVol]
65
+ # Espécie dos volumes
66
+ @volume_kind = attrs[:vol][:esp]
67
+ # Marca dos volumes
68
+ @volume_brand = attrs[:vol][:marca]
69
+ # Numeração dos volumes
70
+ @volume_number = attrs[:vol][:nVol]
71
+ # Peso Liquido
72
+ @weight_net = attrs[:vol][:pesoL]
73
+ # Peso Bruto
74
+ @weight_gross = attrs[:vol][:pesoB]
75
+ # Lacres
76
+ @seals = set_seals(attrs[:vol][:lacres])
77
+ end
78
+
79
+ # Transportadora
80
+ if attrs[:transporta]
81
+ @carrier = Nfe::Carrier.new(attrs[:transporta])
82
+ end
83
+ end
84
+
85
+ def set_seals(attrs = {})
86
+ return unless attrs
87
+
88
+ if attrs.is_a? Array
89
+ seals = attrs.map { |l| l[:nLacre] }.join(', ')
90
+ else
91
+ seals = attrs[:nLacre]
92
+ end
93
+
94
+ seals
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,5 @@
1
+ module Nfe
2
+ module Reader
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
data/lib/nfe_reader.rb ADDED
@@ -0,0 +1,129 @@
1
+ # encoding: UTF-8
2
+ require "nfe_reader/version"
3
+ require "nokogiri"
4
+ require "nokogiri_hash"
5
+
6
+ %w(nfe_reader/product nfe_reader/collection nfe_reader/taxation nfe_reader).each do |namespace|
7
+ Dir[File.dirname(__FILE__) + "/../lib/#{namespace}/*.rb"].each { |file| require file }
8
+ end
9
+
10
+ module Nfe
11
+ module Reader
12
+ class Base
13
+ attr_reader :version, :number, :signature, :client, :information,
14
+ :header, :provider, :customer, :products, :collection, :transport,
15
+ :purchase, :cane, :export, :delivery, :removal,:enviroment,
16
+ :version_app, :key, :date, :protocol, :digest, :status, :description,
17
+ :total, :authorizations
18
+
19
+ def initialize(file)
20
+ xml = Nokogiri::XML(file)
21
+
22
+ xml = xml.to_hash
23
+
24
+ # Versao da NFe
25
+ @version = xml[:nfeProc][:versao]
26
+ # Assinatura
27
+ @signature = xml[:nfeProc][:NFe][:Signature]
28
+
29
+ # Protocolo
30
+ if xml[:nfeProc][:protNFe]
31
+ protocol = xml[:nfeProc][:protNFe][:infProt]
32
+
33
+ @enviroment = protocol[:tpAmb]
34
+ @version_app = protocol[:verAplic]
35
+ @key = protocol[:chNFe]
36
+ @date = protocol[:dhRecbto]
37
+ @protocol = protocol[:nProt]
38
+ @digest = protocol[:digVal]
39
+ @status = protocol[:cStat]
40
+ @description = protocol[:xMotivo]
41
+ end
42
+
43
+ xml = xml[:nfeProc][:NFe][:infNFe]
44
+
45
+ # Numero da Nfe
46
+ @number = xml[:Id]
47
+
48
+ # Identificação da Nota Fiscal eletrônica
49
+ @header = Nfe::Header.new(xml[:ide])
50
+
51
+ # Identificação do Emitente da Nota Fiscal eletrônica
52
+ @provider = Nfe::Provider.new(xml[:emit])
53
+
54
+ # Identificação do Fisco Emitente da NF-e
55
+ if xml[:avulsa]
56
+ @fiscal = Nfe::Fiscal.new(xml[:avulsa])
57
+ end
58
+
59
+ # Identificação do Destinatário da Nota Fiscal eletrônica
60
+ @customer = Nfe::Customer.new(xml[:dest])
61
+
62
+ # Informacoes Adicional
63
+ if xml[:infAdic]
64
+ @information = Nfe::Information.new(xml[:infAdic])
65
+ end
66
+
67
+ # Detalhamento de Produtos e Serviços da NF-e
68
+ @products = []
69
+ if xml[:det].is_a? Array
70
+ xml[:det].each do |product|
71
+ @products << Nfe::Product.new(product)
72
+ end
73
+ else
74
+ @products << Nfe::Product.new(xml[:det])
75
+ end
76
+
77
+ # Totalizadores
78
+ @total = Nfe::Total.new(xml[:total])
79
+
80
+ # Informacao de Pagamento
81
+ if xml[:cobr]
82
+ @collection = Nfe::Collection.new(xml[:cobr])
83
+ end
84
+
85
+ # Transporte
86
+ if xml[:transp]
87
+ @transport = Nfe::Transport.new(xml[:transp])
88
+ end
89
+
90
+ # Identificação do Local de Entrega
91
+ if xml[:retirada]
92
+ @removal = Nfe::Removal.new(xml[:retirada])
93
+ end
94
+
95
+ # Identificação do Local de Retirada
96
+ if xml[:entrega]
97
+ @delivery = Nfe::Delivery.new(xml[:entrega])
98
+ end
99
+
100
+ # Autorização para obter XML
101
+ @authorizations = []
102
+ if xml[:autXML].is_a? Array
103
+ xml[:autXML].each do |product|
104
+ @authorizations << Nfe::Authorization.new(product)
105
+ end
106
+ elsif xml[:autXML].is_a? Hash
107
+ @authorizations << Nfe::Authorization.new(xml[:autXML])
108
+ end
109
+
110
+ # Informacoes de Comercio Exterior
111
+ if xml[:exporta]
112
+ @export = Nfe::Export.new(xml[:exporta])
113
+ end
114
+
115
+ # Informacoes de Compra
116
+ if xml[:compra]
117
+ @purchase = Nfe::Purchase.new(xml[:compra])
118
+ end
119
+
120
+ # Cana de Acucar
121
+ if xml[:cana]
122
+ @cane = Nfe::Cane.new(xml[:cana])
123
+ end
124
+ ensure
125
+ file.close
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,60 @@
1
+ class Nokogiri::XML::Node
2
+ def to_hash
3
+ return { root.name.to_sym => root.collect_nodes }
4
+ rescue Exception => e
5
+ { :error => e.to_s }
6
+ end
7
+
8
+ def collect_nodes(result_hash = {})
9
+ if element?
10
+ hash_attributes = attributes_in_hash
11
+ hash_children = children_in_hash
12
+
13
+ if hash_attributes != {}
14
+ result_hash = hash_attributes.merge(hash_children)
15
+ else
16
+ result_hash = hash_children
17
+ end
18
+
19
+ result_hash
20
+ else
21
+ content.to_s
22
+ end
23
+ end
24
+
25
+ def attributes_in_hash(node_attributes = {})
26
+ attributes.keys.each do |key|
27
+ name = attributes[key].name.to_sym
28
+ node_attributes[name] = attributes[key].value
29
+ end
30
+
31
+ node_attributes
32
+ end
33
+
34
+ def children_in_hash(result_hash = {})
35
+ children.each do |child|
36
+ result = child.collect_nodes
37
+ name = child.name.to_sym
38
+
39
+ if child.name == "text"
40
+ unless child.next_sibling || child.previous_sibling
41
+ return result
42
+ end
43
+ elsif result_hash[name]
44
+ if result_hash[name].is_a?(Object::Array)
45
+ result_hash[name] << result
46
+ else
47
+ result_hash[name] = [result_hash[name]] << result
48
+ end
49
+ else
50
+ if result.class == Hash && result.empty?
51
+ result_hash[name] = nil
52
+ else
53
+ result_hash[name] = result
54
+ end
55
+ end
56
+ end
57
+
58
+ result_hash
59
+ end
60
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nfe_reader/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nfe_reader"
8
+ spec.version = Nfe::Reader::VERSION
9
+ spec.authors = ["Eduardo Becker"]
10
+ spec.email = ["edu.bkr@gmail.com"]
11
+ spec.summary = %q{NFe XML Extractor}
12
+ spec.description = %q{NFe XML Extractor}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "nokogiri"
24
+ end
@@ -0,0 +1,234 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
3
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
4
+ <infNFe versao="2.00" Id="NFe12300384950081649000148500001000001310002342">
5
+ <ide>
6
+ <cUF>42</cUF>
7
+ <cNF>00000000</cNF>
8
+ <natOp>Venda de Merc. Recebida ou Adq. De Terc.</natOp>
9
+ <indPag>1</indPag>
10
+ <mod>55</mod>
11
+ <serie>1</serie>
12
+ <nNF>1000</nNF>
13
+ <dEmi>2000-01-01</dEmi>
14
+ <dSaiEnt>2000-01-01</dSaiEnt>
15
+ <hSaiEnt>12:00:00</hSaiEnt>
16
+ <tpNF>1</tpNF>
17
+ <cMunFG>4218202</cMunFG>
18
+ <tpImp>1</tpImp>
19
+ <tpEmis>1</tpEmis>
20
+ <cDV>2</cDV>
21
+ <tpAmb>1</tpAmb>
22
+ <finNFe>1</finNFe>
23
+ <procEmi>0</procEmi>
24
+ <verProc>Software 1.0</verProc>
25
+ </ide>
26
+ <emit>
27
+ <CNPJ>10302227000145</CNPJ>
28
+ <xNome>FORNECEDOR</xNome>
29
+ <enderEmit>
30
+ <xLgr>RUA, 51</xLgr>
31
+ <nro>0</nro>
32
+ <xBairro>BAIRRO</xBairro>
33
+ <cMun>4218202</cMun>
34
+ <xMun>TIMBÓ</xMun>
35
+ <UF>SC</UF>
36
+ <CEP>89120000</CEP>
37
+ <cPais>1058</cPais>
38
+ <fone>4755555555</fone>
39
+ </enderEmit>
40
+ <IE>111111111</IE>
41
+ <CRT>1</CRT>
42
+ </emit>
43
+ <dest>
44
+ <CNPJ>35718645000149</CNPJ>
45
+ <xNome>CLIENTE</xNome>
46
+ <enderDest>
47
+ <xLgr>RUA</xLgr>
48
+ <nro>0</nro>
49
+ <xBairro>BAIRRO</xBairro>
50
+ <cMun>4214805</cMun>
51
+ <xMun>RIO DO SUL</xMun>
52
+ <UF>SC</UF>
53
+ <CEP>89160000</CEP>
54
+ <cPais>1058</cPais>
55
+ <xPais>BRASIL</xPais>
56
+ <fone>4700000000</fone>
57
+ </enderDest>
58
+ <IE>252322746</IE>
59
+ <email>email@cliente.com.br</email>
60
+ </dest>
61
+ <det nItem="1">
62
+ <prod>
63
+ <cProd>000001</cProd>
64
+ <cEAN />
65
+ <xProd>Produto 1</xProd>
66
+ <NCM>00000000</NCM>
67
+ <CFOP>5102</CFOP>
68
+ <uCom>Pr</uCom>
69
+ <qCom>2.0000</qCom>
70
+ <vUnCom>34.7000000000</vUnCom>
71
+ <vProd>69.40</vProd>
72
+ <cEANTrib />
73
+ <uTrib>Pr</uTrib>
74
+ <qTrib>2.0000</qTrib>
75
+ <vUnTrib>34.7000000000</vUnTrib>
76
+ <indTot>1</indTot>
77
+ </prod>
78
+ <imposto>
79
+ <ICMS>
80
+ <ICMSSN102>
81
+ <orig>0</orig>
82
+ <CSOSN>102</CSOSN>
83
+ </ICMSSN102>
84
+ </ICMS>
85
+ <PIS>
86
+ <PISOutr>
87
+ <CST>99</CST>
88
+ <vBC>0.00</vBC>
89
+ <pPIS>0.00</pPIS>
90
+ <vPIS>0.00</vPIS>
91
+ </PISOutr>
92
+ </PIS>
93
+ <COFINS>
94
+ <COFINSOutr>
95
+ <CST>99</CST>
96
+ <vBC>0.00</vBC>
97
+ <pCOFINS>0.00</pCOFINS>
98
+ <vCOFINS>0.00</vCOFINS>
99
+ </COFINSOutr>
100
+ </COFINS>
101
+ </imposto>
102
+ </det>
103
+ <det nItem="2">
104
+ <prod>
105
+ <cProd>000002</cProd>
106
+ <cEAN />
107
+ <xProd>Produto 2</xProd>
108
+ <NCM>00000000</NCM>
109
+ <CFOP>5102</CFOP>
110
+ <uCom>Pr</uCom>
111
+ <qCom>2.0000</qCom>
112
+ <vUnCom>34.7000000000</vUnCom>
113
+ <vProd>c</vProd>
114
+ <cEANTrib />
115
+ <uTrib>Pr</uTrib>
116
+ <qTrib>2.0000</qTrib>
117
+ <vUnTrib>34.7000000000</vUnTrib>
118
+ <indTot>1</indTot>
119
+ </prod>
120
+ <imposto>
121
+ <ICMS>
122
+ <ICMSSN102>
123
+ <orig>0</orig>
124
+ <CSOSN>102</CSOSN>
125
+ </ICMSSN102>
126
+ </ICMS>
127
+ <PIS>
128
+ <PISOutr>
129
+ <CST>99</CST>
130
+ <vBC>0.00</vBC>
131
+ <pPIS>0.00</pPIS>
132
+ <vPIS>0.00</vPIS>
133
+ </PISOutr>
134
+ </PIS>
135
+ <COFINS>
136
+ <COFINSOutr>
137
+ <CST>99</CST>
138
+ <vBC>0.00</vBC>
139
+ <pCOFINS>0.00</pCOFINS>
140
+ <vCOFINS>0.00</vCOFINS>
141
+ </COFINSOutr>
142
+ </COFINS>
143
+ </imposto>
144
+ </det>
145
+ <total>
146
+ <ICMSTot>
147
+ <vBC>0.00</vBC>
148
+ <vICMS>0.00</vICMS>
149
+ <vBCST>0.00</vBCST>
150
+ <vST>0.00</vST>
151
+ <vProd>138.80</vProd>
152
+ <vFrete>0.00</vFrete>
153
+ <vSeg>0.00</vSeg>
154
+ <vDesc>0.00</vDesc>
155
+ <vII>0.00</vII>
156
+ <vIPI>0.00</vIPI>
157
+ <vPIS>0.00</vPIS>
158
+ <vCOFINS>0.00</vCOFINS>
159
+ <vOutro>0.00</vOutro>
160
+ <vNF>138.80</vNF>
161
+ </ICMSTot>
162
+ <retTrib />
163
+ </total>
164
+ <transp>
165
+ <modFrete>0</modFrete>
166
+ <transporta>
167
+ <CNPJ>74793624000140</CNPJ>
168
+ <xNome>TRANSPORTADORA</xNome>
169
+ <IE>111111111</IE>
170
+ <xEnder>RUA</xEnder>
171
+ <xMun>TIMBÓ</xMun>
172
+ <UF>SC</UF>
173
+ </transporta>
174
+ <veicTransp>
175
+ <placa>AAA0000</placa>
176
+ <UF>SC</UF>
177
+ </veicTransp>
178
+ </transp>
179
+ <cobr>
180
+ <fat>
181
+ <nFat>0001</nFat>
182
+ <vOrig>138.80</vOrig>
183
+ <vLiq>138.80.17</vLiq>
184
+ </fat>
185
+ <dup>
186
+ <nDup>001</nDup>
187
+ <dVenc>2000-02-01</dVenc>
188
+ <vDup>138.80</vDup>
189
+ </dup>
190
+ </cobr>
191
+ <infAdic>
192
+ <infAdFisco>
193
+ INFORMACAO ADICIONAL
194
+ </infAdFisco>
195
+ </infAdic>
196
+ </infNFe>
197
+ <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
198
+ <SignedInfo>
199
+ <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
200
+ <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
201
+ <Reference URI="#NFe12300384950081649000148500001000001310002342">
202
+ <Transforms>
203
+ <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
204
+ <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
205
+ </Transforms>
206
+ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
207
+ <DigestValue>ait7e07Xf0nkqcQTCIcOIVVZCrw=</DigestValue>
208
+ </Reference>
209
+ </SignedInfo>
210
+ <SignatureValue>
211
+ rDoxl0n4MhfLwAJq4pmfnb4Il+USPndfz0v+6vxyQhZEORlXoBgst7GneJ550M9gBDHuKlitn8TE28wE7bPS3ttAvcEtqHfN6iIiBYVXR3RqoRVF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222
+ <protNFe versao="2.00">
223
+ <infProt Id="ID100000481241129" xmlns="http://www.portalfiscal.inf.br/nfe">
224
+ <tpAmb>1</tpAmb>
225
+ <verAplic>SVRS2000101120000</verAplic>
226
+ <chNFe>12300384950081649000148500001000001310002342</chNFe>
227
+ <dhRecbto>2000-01-01T12:00:00</dhRecbto>
228
+ <nProt>100000481241129</nProt>
229
+ <digVal>aklOQ0184NjoeaqCIRT01927Crf=</digVal>
230
+ <cStat>100</cStat>
231
+ <xMotivo>Autorizado o uso da NF-e</xMotivo>
232
+ </infProt>
233
+ </protNFe>
234
+ </nfeProc>