Class: Nfcom::Models::Total
- Inherits:
-
Object
- Object
- Nfcom::Models::Total
- Defined in:
- lib/nfcom/models/total.rb
Overview
Representa os valores totalizadores da NF-COM
Esta classe agrega todos os valores da nota fiscal, incluindo valores de serviços, descontos, impostos e o valor total da nota.
Responsabilidades:
-
Armazenar os valores totalizadores da nota
-
Calcular o valor total da NF-COM
-
Manter valores de impostos (preenchidos externamente ou derivados)
Observações importantes:
-
Esta classe NÃO calcula impostos por regra fiscal
-
ICMS, PIS e COFINS devem ser informados pela camada de tributação
-
O Total apenas consolida os valores
Instance Attribute Summary collapse
-
#cofins_retido ⇒ Object
Returns the value of attribute cofins_retido.
-
#cofins_valor ⇒ Object
Returns the value of attribute cofins_valor.
-
#csll_retido ⇒ Object
Returns the value of attribute csll_retido.
-
#fcp_valor ⇒ Object
Returns the value of attribute fcp_valor.
-
#funttel_valor ⇒ Object
Returns the value of attribute funttel_valor.
-
#fust_valor ⇒ Object
Returns the value of attribute fust_valor.
-
#icms_base_calculo ⇒ Object
Returns the value of attribute icms_base_calculo.
-
#icms_desonerado ⇒ Object
Returns the value of attribute icms_desonerado.
-
#icms_valor ⇒ Object
Returns the value of attribute icms_valor.
-
#irrf_retido ⇒ Object
Returns the value of attribute irrf_retido.
-
#pis_retido ⇒ Object
Returns the value of attribute pis_retido.
-
#pis_valor ⇒ Object
Returns the value of attribute pis_valor.
-
#valor_desconto ⇒ Object
Returns the value of attribute valor_desconto.
-
#valor_outras_despesas ⇒ Object
Returns the value of attribute valor_outras_despesas.
-
#valor_servicos ⇒ Object
Returns the value of attribute valor_servicos.
-
#valor_total ⇒ Object
Returns the value of attribute valor_total.
Instance Method Summary collapse
- #calcular_total ⇒ Object
-
#initialize(attributes = {}) ⇒ Total
constructor
A new instance of Total.
- #valor_liquido ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Total
Returns a new instance of Total.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nfcom/models/total.rb', line 28 def initialize(attributes = {}) @valor_desconto = 0.0 @valor_outras_despesas = 0.0 @icms_base_calculo = 0.0 @icms_valor = 0.0 @icms_desonerado = 0.0 @fcp_valor = 0.0 @pis_valor = 0.0 @cofins_valor = 0.0 @funttel_valor = 0.0 @fust_valor = 0.0 @pis_retido = 0.0 @cofins_retido = 0.0 @csll_retido = 0.0 @irrf_retido = 0.0 attributes.each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end |
Instance Attribute Details
#cofins_retido ⇒ Object
Returns the value of attribute cofins_retido.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def cofins_retido @cofins_retido end |
#cofins_valor ⇒ Object
Returns the value of attribute cofins_valor.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def cofins_valor @cofins_valor end |
#csll_retido ⇒ Object
Returns the value of attribute csll_retido.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def csll_retido @csll_retido end |
#fcp_valor ⇒ Object
Returns the value of attribute fcp_valor.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def fcp_valor @fcp_valor end |
#funttel_valor ⇒ Object
Returns the value of attribute funttel_valor.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def funttel_valor @funttel_valor end |
#fust_valor ⇒ Object
Returns the value of attribute fust_valor.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def fust_valor @fust_valor end |
#icms_base_calculo ⇒ Object
Returns the value of attribute icms_base_calculo.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def icms_base_calculo @icms_base_calculo end |
#icms_desonerado ⇒ Object
Returns the value of attribute icms_desonerado.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def icms_desonerado @icms_desonerado end |
#icms_valor ⇒ Object
Returns the value of attribute icms_valor.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def icms_valor @icms_valor end |
#irrf_retido ⇒ Object
Returns the value of attribute irrf_retido.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def irrf_retido @irrf_retido end |
#pis_retido ⇒ Object
Returns the value of attribute pis_retido.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def pis_retido @pis_retido end |
#pis_valor ⇒ Object
Returns the value of attribute pis_valor.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def pis_valor @pis_valor end |
#valor_desconto ⇒ Object
Returns the value of attribute valor_desconto.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def valor_desconto @valor_desconto end |
#valor_outras_despesas ⇒ Object
Returns the value of attribute valor_outras_despesas.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def valor_outras_despesas @valor_outras_despesas end |
#valor_servicos ⇒ Object
Returns the value of attribute valor_servicos.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def valor_servicos @valor_servicos end |
#valor_total ⇒ Object
Returns the value of attribute valor_total.
21 22 23 |
# File 'lib/nfcom/models/total.rb', line 21 def valor_total @valor_total end |
Instance Method Details
#calcular_total ⇒ Object
49 50 51 52 53 |
# File 'lib/nfcom/models/total.rb', line 49 def calcular_total @valor_total = valor_servicos.to_f - valor_desconto.to_f + valor_outras_despesas.to_f end |
#valor_liquido ⇒ Object
55 56 57 |
# File 'lib/nfcom/models/total.rb', line 55 def valor_liquido valor_total.to_f end |