Class: Nfe::Reader::Total

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributeHelper

#attributes, #attributes_to_hash

Constructor Details

#initialize(attrs = {}) ⇒ Total



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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/nfe_reader/total.rb', line 13

def initialize(attrs = {})
  # Impostos
  if attrs[:ICMSTot]
    # Base ICMS
    @icms_base = attrs[:ICMSTot][:vBC]
    # Valor ICMS
    @icms = attrs[:ICMSTot][:vICMS]
    # Base ICMS ST
    @st_base = attrs[:ICMSTot][:vBCST]
    # Valor ICMS ST
    @st = attrs[:ICMSTot][:vST]
    # Total de Produtos
    @product = attrs[:ICMSTot][:vProd]
    # Total de Frete
    @freight = attrs[:ICMSTot][:vFrete]
    # Total de Seguro
    @insurance = attrs[:ICMSTot][:vSeg]
    # Total de Desconto
    @descount = attrs[:ICMSTot][:vDesc]
    # Total de Imposto de Importacao
    @ii = attrs[:ICMSTot][:vII]
    # Total de IPI
    @ipi = attrs[:ICMSTot][:vIPI]
    # Total de PIS
    @pis = attrs[:ICMSTot][:vPIS]
    # Total de COFINS
    @cofins = attrs[:ICMSTot][:vCOFINS]
    # Total de Outros
    @another = attrs[:ICMSTot][:vOutro]
    # Total NFe
    @total = attrs[:ICMSTot][:vNF]
  end

  # Servicos
  if attrs[:ISSQNtot]
    # Valor do Servico
    @service_value = attrs[:ISSQNtot][:vServ]
    # Base de calculo do Servico
    @service_base = attrs[:ISSQNtot][:vBC]
    # ISS do Servico
    @service_iss = attrs[:ISSQNtot][:vISS]
    # Pis do Servico
    @service_pis = attrs[:ISSQNtot][:vPIS]
    # Cofins do Servico
    @service_cofins = attrs[:ISSQNtot][:vCOFINS]
  end

  # Retencoes
  if attrs[:retTrib]
    # Retencao de PIS
    @retention_pis = attrs[:retTrib][:vRetPIS]
    # Retencao de COFINS
    @retention_cofins = attrs[:retTrib][:vRetCOFINS]
    # Retencao de CSLL
    @retention_csll = attrs[:retTrib][:vRetCSLL]
    # Base de Retencao do IRRF 
    @retention_irrf_base = attrs[:retTrib][:vBCIRRF]
    # Valor de Retencao do IRRF
    @retention_irrf = attrs[:retTrib][:vIRRF]
    # Base de Retencao da Previdencia
    @retention_foresight_base = attrs[:retTrib][:vBCRetPrev]
    # Valor de Retencao da Previdencia
    @retention_foresight = attrs[:retTrib][:vRetPrev]
  end
end

Instance Attribute Details

#anotherObject (readonly)

Returns the value of attribute another.



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

def another
  @another
end

#cofinsObject (readonly)

Returns the value of attribute cofins.



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

def cofins
  @cofins
end

#descountObject (readonly)

Returns the value of attribute descount.



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

def descount
  @descount
end

#freightObject (readonly)

Returns the value of attribute freight.



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

def freight
  @freight
end

#icmsObject (readonly)

Returns the value of attribute icms.



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

def icms
  @icms
end

#icms_baseObject (readonly)

Returns the value of attribute icms_base.



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

def icms_base
  @icms_base
end

#iiObject (readonly)

Returns the value of attribute ii.



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

def ii
  @ii
end

#insuranceObject (readonly)

Returns the value of attribute insurance.



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

def insurance
  @insurance
end

#ipiObject (readonly)

Returns the value of attribute ipi.



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

def ipi
  @ipi
end

#pisObject (readonly)

Returns the value of attribute pis.



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

def pis
  @pis
end

#productObject (readonly)

Returns the value of attribute product.



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

def product
  @product
end

#retention_cofinsObject (readonly)

Returns the value of attribute retention_cofins.



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

def retention_cofins
  @retention_cofins
end

#retention_csllObject (readonly)

Returns the value of attribute retention_csll.



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

def retention_csll
  @retention_csll
end

#retention_foresightObject (readonly)

Returns the value of attribute retention_foresight.



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

def retention_foresight
  @retention_foresight
end

#retention_foresight_baseObject (readonly)

Returns the value of attribute retention_foresight_base.



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

def retention_foresight_base
  @retention_foresight_base
end

#retention_irrfObject (readonly)

Returns the value of attribute retention_irrf.



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

def retention_irrf
  @retention_irrf
end

#retention_irrf_baseObject (readonly)

Returns the value of attribute retention_irrf_base.



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

def retention_irrf_base
  @retention_irrf_base
end

#retention_pisObject (readonly)

Returns the value of attribute retention_pis.



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

def retention_pis
  @retention_pis
end

#service_baseObject (readonly)

Returns the value of attribute service_base.



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

def service_base
  @service_base
end

#service_cofinsObject (readonly)

Returns the value of attribute service_cofins.



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

def service_cofins
  @service_cofins
end

#service_issObject (readonly)

Returns the value of attribute service_iss.



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

def service_iss
  @service_iss
end

#service_pisObject (readonly)

Returns the value of attribute service_pis.



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

def service_pis
  @service_pis
end

#service_valueObject (readonly)

Returns the value of attribute service_value.



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

def service_value
  @service_value
end

#stObject (readonly)

Returns the value of attribute st.



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

def st
  @st
end

#st_baseObject (readonly)

Returns the value of attribute st_base.



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

def st_base
  @st_base
end

#totalObject (readonly)

Returns the value of attribute total.



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

def total
  @total
end