Class: NfeReader::Transport

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

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 = {}) ⇒ Transport

Fields Values:

modFrete: 0- Por conta do emitente;

1- Por conta do destinatário/remetente;
2- Por conta de terceiros;
9- Sem frete.


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
78
79
80
81
82
83
84
85
86
# File 'lib/nfe_reader/transport.rb', line 19

def initialize(attrs = {})
  # Modalidade
  @kind = attrs[:modFrete]
  
  # == Grupo de Retenção do ICMS do transporte
  if attrs[:retTransp]
    # Valor do Servico
    @service_value = attrs[:retTransp][:vServ]
    # BC da Retenção do ICMS
    @base = attrs[:retTransp][:vBCRet]
    # Alíquota da Retenção
    @icms_aliquot = attrs[:retTransp][:pICMSRet]
    # Valor do ICMS Retido
    @icms_value = attrs[:retTransp][:vICMSRet]
    # CFOP
    @cfop = attrs[:retTransp][:CFOP]
    # Municipio gerador de ICMS
    @city = attrs[:retTransp][:cMunFG]
  end

  # == Veiculo
  if attrs[:veicTransp]
    # Placa
    @vehicle_plaque = attrs[:veicTransp][:placa]
    # Estado
    @vehicle_state = attrs[:veicTransp][:UF]
    # Registro Nacional de Transportador de Carga
    @vehicle_rntc = attrs[:veicTransp][:RNTC]
  end

  # == Reboque
  if attrs[:reboque]
    # Placa
    @hauling_palque = attrs[:reboque][:placa]
    # Estado
    @hauling_state = attrs[:reboque][:UF]
    # Registro Nacional de Transportador de Carga
    @hauling_rntc = attrs[:reboque][:RNTC]
  end

  # Vagao
  @wagon = attrs[:vagao]
  # Balsa
  @ferry = attrs[:balsa]
  
  # == Volume
  if attrs[:vol]
    # Quantidade de volumes
    @volume_amount = attrs[:vol][:qVol]
    # Espécie dos volumes
    @volume_kind = attrs[:vol][:esp]
    # Marca dos volumes
    @volume_brand = attrs[:vol][:marca]
    # Numeração dos volumes
    @volume_number = attrs[:vol][:nVol]
    # Peso Liquido
    @weight_net = attrs[:vol][:pesoL]
    # Peso Bruto
    @weight_gross = attrs[:vol][:pesoB]
    # Lacres
    @seals = to_array(attrs[:vol][:lacres]).join(', ')
  end

  # Transportadora
  if attrs[:transporta]
    @carrier = Carrier.new(attrs[:transporta])
  end
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



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

def base
  @base
end

#carrierObject (readonly)

Returns the value of attribute carrier.



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

def carrier
  @carrier
end

#cfopObject (readonly)

Returns the value of attribute cfop.



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

def cfop
  @cfop
end

#cityObject (readonly)

Returns the value of attribute city.



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

def city
  @city
end

#ferryObject (readonly)

Returns the value of attribute ferry.



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

def ferry
  @ferry
end

#hauling_palqueObject (readonly)

Returns the value of attribute hauling_palque.



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

def hauling_palque
  @hauling_palque
end

#hauling_rntcObject (readonly)

Returns the value of attribute hauling_rntc.



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

def hauling_rntc
  @hauling_rntc
end

#hauling_stateObject (readonly)

Returns the value of attribute hauling_state.



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

def hauling_state
  @hauling_state
end

#icms_aliquotObject (readonly)

Returns the value of attribute icms_aliquot.



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

def icms_aliquot
  @icms_aliquot
end

#icms_valueObject (readonly)

Returns the value of attribute icms_value.



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

def icms_value
  @icms_value
end

#kindObject (readonly)

Returns the value of attribute kind.



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

def kind
  @kind
end

#sealsObject (readonly)

Returns the value of attribute seals.



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

def seals
  @seals
end

#service_valueObject (readonly)

Returns the value of attribute service_value.



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

def service_value
  @service_value
end

#vehicle_plaqueObject (readonly)

Returns the value of attribute vehicle_plaque.



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

def vehicle_plaque
  @vehicle_plaque
end

#vehicle_rntcObject (readonly)

Returns the value of attribute vehicle_rntc.



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

def vehicle_rntc
  @vehicle_rntc
end

#vehicle_stateObject (readonly)

Returns the value of attribute vehicle_state.



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

def vehicle_state
  @vehicle_state
end

#volume_amountObject (readonly)

Returns the value of attribute volume_amount.



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

def volume_amount
  @volume_amount
end

#volume_brandObject (readonly)

Returns the value of attribute volume_brand.



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

def volume_brand
  @volume_brand
end

#volume_kindObject (readonly)

Returns the value of attribute volume_kind.



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

def volume_kind
  @volume_kind
end

#volume_numberObject (readonly)

Returns the value of attribute volume_number.



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

def volume_number
  @volume_number
end

#wagonObject (readonly)

Returns the value of attribute wagon.



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

def wagon
  @wagon
end

#weight_grossObject (readonly)

Returns the value of attribute weight_gross.



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

def weight_gross
  @weight_gross
end

#weight_netObject (readonly)

Returns the value of attribute weight_net.



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

def weight_net
  @weight_net
end