Class: NfeReader::Header

Inherits:
Object
  • Object
show all
Includes:
AttributeHelper, CreatorHelper
Defined in:
lib/nfe_reader/header.rb

Overview

Identificação da Nota Fiscal eletrônica

Constant Summary

Constants included from AttributeHelper

AttributeHelper::WITHELIST

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CreatorHelper

#create_resource, #create_resources, #to_array

Methods included from AttributeHelper

#attributes, #attributes_to_hash

Constructor Details

#initialize(attrs = {}) ⇒ Header

Fields Values

cUF: 11-Rondônia, 12-Acre, 13-Amazonas, 14-Roraima, 15-Pará, 16-Amapá, 17-Tocantins,

21-Maranhão, 22-Piauí, 23-Ceará, 24-Rio Grande do Norte, 25-Paraíba, 26-Pernambuco,
27-Alagoas, 28-Sergipe, 29-Bahia, 31-Minas Gerais, 32-Espírito Santo, 33-Rio de Janeiro,
35-São Paulo, 41-Paraná, 42-Santa Catarina, 3-Rio Grande do Sul, 50-Mato Grosso do Sul,
51-Mato Grosso, 52-Goiás, 53-DistritoFederal

mod: 55 - NF-e, 65 - NFC-e

indPag: 0 - Vista, 1 - Prazo, 2 - Outros

tpNF: 0 - Entrada, 1 - Saida

tpAmb: 1 - Producao, 2 - Homologacao

finNFe: 1 - Normal,

2 - Complementar, 
3 - Ajuste,
4 - Devolução/Retorno.

tpEmis: 1 - Normal, 2 - Contingência FS, 3 - Contingência SCAN, 4 - Contingência FS-DA

tpImp: 1 - Retrato,

2 - Paisagem,
3 - DANFE Simplificado,
4 - DANFE NFC-e,
5 - DANFE NFC-e em mensagem eletrônica (o envio de
    mensagem eletrônica pode ser feita de forma simultânea
    com a impressão do DANFE; usar o tpImp=5 quando
    esta for a única forma de disponibilização do DANFE).

procEmit: 0 - emissão de NF-e com aplicativo do contribuinte,

          1 - emissão de NF-e avulsa pelo Fisco,
          2 - emissão de NF-e avulsa, pelo site,
          3 - emissão NF-e pelo contribuinte com aplicativo fornecido pelo Fisco,

idDest: 1 - Operação interna,
        2 - Operação interestadual,
        3 - Operação com exterior

indFinal: 0 - Não,

1 - Consumidor final

indPres: 0 - Não se aplica (por exemplo, Nota Fiscal complementar

    ou de ajuste);
1 - Operação presencial;
2 - Operação não presencial, pela Internet;
3 - Operação não presencial, Teleatendimento;
4 - NFC-e em operação com entrega a domicílio;
9 - Operação não presencial, outros.


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/nfe_reader/header.rb', line 67

def initialize(attrs = {})
  # Estado
  @state = attrs[:cUF]
  # Cidade
  @city = attrs[:cMunFG]
  # Numero Aleatorio
  @sample_number = attrs[:cNF]
  # Natureza Operacao
  @operation = attrs[:natOp]
  # Numero da Nota
  @number = attrs[:nNF]
  # Modelo
  @model = attrs[:mod]
  # Data Emissao
  @emission = attrs[:dEmi]
  # Tipo de Emissao
  @emission_kind = attrs[:tpEmis]
  # Data de Saida
  @out = attrs[:dSaiEnt]
  # Hora de Saida
  @out_time = attrs[:hSaiEnt]
  # Data de Emissao
  @emission_date = attrs[:dhEmi]
  # Serie
  @serie = attrs[:serie]
  # Tipo da Nota
  @kind = attrs[:tpNF]
  # Ambiente
  @environment = attrs[:tpAmb]
  # Finalidade
  @finality = attrs[:finNFe]
  # Versao aplicativo do emissor
  @version = attrs[:verProc]
  # Pagamento
  @payment = attrs[:indPag]
  # Processo de Emissao
  @process = attrs[:procEmi]
  # Digito Verificador
  @digit = attrs[:cDV]
  # Orientação da Pagina
  @orientation = attrs[:tpImp]
  # Codigo do Destino
  @destiny_code = attrs[:idDest]
  # Consumidor final
  @final_consumer = attrs[:indFinal]
  # Indicador de presença do comprador
  @consumer_presence = attrs[:indPres]

  # Contigencia
  @contingency_date = attrs[:dhCont]
  @contingency_justification = attrs[:xJust]

  # Documento Fiscal Referenciado
  @documents = create_resources(Document, attrs[:NFref])
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def city
  @city
end

#consumer_presenceObject (readonly)

Returns the value of attribute consumer_presence.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def consumer_presence
  @consumer_presence
end

#contingency_dateObject (readonly)

Returns the value of attribute contingency_date.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def contingency_date
  @contingency_date
end

#contingency_justificationObject (readonly)

Returns the value of attribute contingency_justification.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def contingency_justification
  @contingency_justification
end

#destiny_codeObject (readonly)

Returns the value of attribute destiny_code.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def destiny_code
  @destiny_code
end

#digitObject (readonly)

Returns the value of attribute digit.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def digit
  @digit
end

#documentsObject (readonly)

Returns the value of attribute documents.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def documents
  @documents
end

#emissionObject (readonly)

Returns the value of attribute emission.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def emission
  @emission
end

#emission_dateObject (readonly)

Returns the value of attribute emission_date.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def emission_date
  @emission_date
end

#emission_kindObject (readonly)

Returns the value of attribute emission_kind.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def emission_kind
  @emission_kind
end

#environmentObject (readonly)

Returns the value of attribute environment.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def environment
  @environment
end

#final_consumerObject (readonly)

Returns the value of attribute final_consumer.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def final_consumer
  @final_consumer
end

#finalityObject (readonly)

Returns the value of attribute finality.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def finality
  @finality
end

#kindObject (readonly)

Returns the value of attribute kind.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def kind
  @kind
end

#modelObject (readonly)

Returns the value of attribute model.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def model
  @model
end

#numberObject (readonly)

Returns the value of attribute number.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def number
  @number
end

#operationObject (readonly)

Returns the value of attribute operation.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def operation
  @operation
end

#orientationObject (readonly)

Returns the value of attribute orientation.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def orientation
  @orientation
end

#outObject (readonly)

Returns the value of attribute out.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def out
  @out
end

#out_timeObject (readonly)

Returns the value of attribute out_time.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def out_time
  @out_time
end

#paymentObject (readonly)

Returns the value of attribute payment.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def payment
  @payment
end

#processObject (readonly)

Returns the value of attribute process.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def process
  @process
end

#sample_numberObject (readonly)

Returns the value of attribute sample_number.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def sample_number
  @sample_number
end

#serieObject (readonly)

Returns the value of attribute serie.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def serie
  @serie
end

#stateObject (readonly)

Returns the value of attribute state.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def state
  @state
end

#versionObject (readonly)

Returns the value of attribute version.



8
9
10
# File 'lib/nfe_reader/header.rb', line 8

def version
  @version
end