Class: Nfe::Reader::Ipi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributeHelper

#attributes, #attributes_to_hash

Constructor Details

#initialize(attrs = {}) ⇒ Ipi

Returns a new instance of Ipi.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/nfe_reader/taxation/ipi.rb', line 10

def initialize(attrs = {})
  # Classe de enquadramento do IPI para Cigarros e Bebidas
  @frame_class = attrs[:clEnq]
  # Codigo enquadramento
  @frame_code = attrs[:cEnq]
  # CNPJ do produtor
  @cnpj = attrs[:CNPJProd]
  # Código do selo de controle
  @seal = attrs[:cSelo]
  # Quantidade do selo de controle
  @seal_amount = attrs[:qSelo]
  
  # == Tributação
  if attrs[:IPITrib]
    # Código da situação tributária do IPI
    @cst = attrs[:IPITrib][:CST]
    # Valor da BC do IPI
    @ipi_base = attrs[:IPITrib][:vBC]
    # Quantidade total na unidade padrão para tributação
    @amount = attrs[:IPITrib][:qUnid]
    # Valor por Unidade Tributável
    @value_unit = attrs[:IPITrib][:vUnid]
    # % do IPI
    @percentage = attrs[:IPITrib][:pIPI]
    # Valor do IPI
    @value = attrs[:IPITrib][:vIPI]
  end

  if attrs[:IPINT]
    # Grupo do CST 01, 02, 03, 04, 51, 52, 53, 54 e 55
    @cst_group = attrs[:IPINT][:CST]
  end
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def amount
  @amount
end

#cnpjObject (readonly)

Returns the value of attribute cnpj.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def cnpj
  @cnpj
end

#cstObject (readonly)

Returns the value of attribute cst.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def cst
  @cst
end

#cst_groupObject (readonly)

Returns the value of attribute cst_group.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def cst_group
  @cst_group
end

#frame_classObject (readonly)

Returns the value of attribute frame_class.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def frame_class
  @frame_class
end

#frame_codeObject (readonly)

Returns the value of attribute frame_code.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def frame_code
  @frame_code
end

#ipi_baseObject (readonly)

Returns the value of attribute ipi_base.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def ipi_base
  @ipi_base
end

#percentageObject (readonly)

Returns the value of attribute percentage.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def percentage
  @percentage
end

#sealObject (readonly)

Returns the value of attribute seal.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def seal
  @seal
end

#seal_amountObject (readonly)

Returns the value of attribute seal_amount.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def seal_amount
  @seal_amount
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def value
  @value
end

#value_unitObject (readonly)

Returns the value of attribute value_unit.



7
8
9
# File 'lib/nfe_reader/taxation/ipi.rb', line 7

def value_unit
  @value_unit
end