Class: Nfe::Reader::Header

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

Overview

Identificação da Nota Fiscal eletrônica

Instance Attribute Summary collapse

Instance Method Summary collapse

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

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

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

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

          1 - emiss

indFinal: 0 - Não,

1 - Consumidor final

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

    ou de ajuste);
1 - Opera


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
122
123
124
125
126
127
128
129
# 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 = []

  if attrs[:NFref].is_a? Array
    attrs[:NFref].each do |document|
      @documents << Document.new(document)
    end
  elsif attrs[:NFref].is_a? Hash
    @documents << Document.new(attrs[:NFref])
  end
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