Class: Nfe::Reader::Product
- Inherits:
-
Object
- Object
- Nfe::Reader::Product
- Includes:
- AttributeHelper, CreatorHelper
- Defined in:
- lib/nfe_reader/product.rb
Overview
Detalhamento de Produtos e Serviços da NF-e
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#amount_sale ⇒ Object
readonly
Returns the value of attribute amount_sale.
-
#armament ⇒ Object
readonly
Returns the value of attribute armament.
-
#cfop ⇒ Object
readonly
Returns the value of attribute cfop.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#cofins ⇒ Object
readonly
Returns the value of attribute cofins.
-
#cofins_st ⇒ Object
readonly
Returns the value of attribute cofins_st.
-
#demand_item ⇒ Object
readonly
Returns the value of attribute demand_item.
-
#demand_number ⇒ Object
readonly
Returns the value of attribute demand_number.
-
#discount ⇒ Object
readonly
Returns the value of attribute discount.
-
#ean ⇒ Object
readonly
Returns the value of attribute ean.
-
#exportation ⇒ Object
readonly
Returns the value of attribute exportation.
-
#freight ⇒ Object
readonly
Returns the value of attribute freight.
-
#fuel ⇒ Object
readonly
Returns the value of attribute fuel.
-
#gtin ⇒ Object
readonly
Returns the value of attribute gtin.
-
#icms ⇒ Object
readonly
Returns the value of attribute icms.
-
#importation ⇒ Object
readonly
Returns the value of attribute importation.
-
#importation_tax ⇒ Object
readonly
Returns the value of attribute importation_tax.
-
#insurance ⇒ Object
readonly
Returns the value of attribute insurance.
-
#ipi ⇒ Object
readonly
Returns the value of attribute ipi.
-
#ipi_exception ⇒ Object
readonly
Returns the value of attribute ipi_exception.
-
#issqn ⇒ Object
readonly
Returns the value of attribute issqn.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#medicament ⇒ Object
readonly
Returns the value of attribute medicament.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ncm ⇒ Object
readonly
Returns the value of attribute ncm.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#other_value ⇒ Object
readonly
Returns the value of attribute other_value.
-
#pis ⇒ Object
readonly
Returns the value of attribute pis.
-
#pis_st ⇒ Object
readonly
Returns the value of attribute pis_st.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#unit_sale ⇒ Object
readonly
Returns the value of attribute unit_sale.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#value_sale ⇒ Object
readonly
Returns the value of attribute value_sale.
-
#vehicle ⇒ Object
readonly
Returns the value of attribute vehicle.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Product
constructor
Fields Values.
Methods included from CreatorHelper
#create_resource, #create_resources, #to_array
Methods included from AttributeHelper
#attributes, #attributes_to_hash
Constructor Details
#initialize(attrs = {}) ⇒ Product
Fields Values
indTot: 0 - o valor do item (vProd) compõe o valor total da NF-e (vProd)
1 - o valor do item (vProd) não compõe o valor total da NF-e (vProd) (v2.0)
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 |
# File 'lib/nfe_reader/product.rb', line 22 def initialize(attrs = {}) @number = attrs[:nItem] if attrs[:prod] @code = attrs[:prod][:cProd] @name = attrs[:prod][:xProd] @ean = attrs[:prod][:cEAN] @ncm = attrs[:prod][:NCM] # Sale @cfop = attrs[:prod][:CFOP] @unit_sale = attrs[:prod][:uCom] @amount_sale = attrs[:prod][:qCom] @value_sale = attrs[:prod][:vUnCom] @total = attrs[:prod][:vProd] # Numero do Pedido de Compra @demand_number = attrs[:prod][:xPed] # Item do Pedido de Compra @demand_item = attrs[:prod][:nItemPed] # GTIN (Global Trade ItemNumber) @gtin = attrs[:prod][:cEANTrib] @unit = attrs[:prod][:uTrib] @amount = attrs[:prod][:qTrib] @value = attrs[:prod][:vUnTrib] @kind = attrs[:prod][:indTot] @ipi_exception = attrs[:prod][:EXTIPI] @freight = attrs[:prod][:vFrete] @insurance = attrs[:prod][:vSeg] @discount = attrs[:prod][:vDesc] @other_value = attrs[:prod][:vOutro] @importation = create_resource(Importation, attrs[:prod][:DI]) end @fuel = Fuel.new(attrs[:comb]) if attrs[:comb] @vehicle = Vehicle.new(attrs[:veicProd]) if attrs[:veicProd] @armament = create_resources(Armament, attrs[:arma]) if attrs[:arma] @medicament = create_resources(Medicament, attrs[:med]) if attrs[:med] @exportation = create_resources(Exportation, attrs[:detExport]) if attrs[:imposto] @icms = create_resources(Icms, attrs[:imposto][:ICMS]) @cofins = create_resources(Cofins, attrs[:imposto][:COFINS]) @pis = create_resources(Pis, attrs[:imposto][:PIS]) @importation_tax = create_resource(ImportationTax, attrs[:imposto][:II]) @ipi = create_resource(Ipi, attrs[:imposto][:IPI]) @pis_st = create_resource(PisSt, attrs[:imposto][:PISST]) @cofins_st = create_resource(CofinsSt, attrs[:imposto][:COFINSST]) @issqn = create_resource(Issqn, attrs[:imposto][:ISSQN]) end end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def amount @amount end |
#amount_sale ⇒ Object (readonly)
Returns the value of attribute amount_sale.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def amount_sale @amount_sale end |
#armament ⇒ Object (readonly)
Returns the value of attribute armament.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def armament @armament end |
#cfop ⇒ Object (readonly)
Returns the value of attribute cfop.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def cfop @cfop end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def code @code end |
#cofins ⇒ Object (readonly)
Returns the value of attribute cofins.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def cofins @cofins end |
#cofins_st ⇒ Object (readonly)
Returns the value of attribute cofins_st.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def cofins_st @cofins_st end |
#demand_item ⇒ Object (readonly)
Returns the value of attribute demand_item.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def demand_item @demand_item end |
#demand_number ⇒ Object (readonly)
Returns the value of attribute demand_number.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def demand_number @demand_number end |
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def discount @discount end |
#ean ⇒ Object (readonly)
Returns the value of attribute ean.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def ean @ean end |
#exportation ⇒ Object (readonly)
Returns the value of attribute exportation.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def exportation @exportation end |
#freight ⇒ Object (readonly)
Returns the value of attribute freight.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def freight @freight end |
#fuel ⇒ Object (readonly)
Returns the value of attribute fuel.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def fuel @fuel end |
#gtin ⇒ Object (readonly)
Returns the value of attribute gtin.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def gtin @gtin end |
#icms ⇒ Object (readonly)
Returns the value of attribute icms.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def icms @icms end |
#importation ⇒ Object (readonly)
Returns the value of attribute importation.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def importation @importation end |
#importation_tax ⇒ Object (readonly)
Returns the value of attribute importation_tax.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def importation_tax @importation_tax end |
#insurance ⇒ Object (readonly)
Returns the value of attribute insurance.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def insurance @insurance end |
#ipi ⇒ Object (readonly)
Returns the value of attribute ipi.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def ipi @ipi end |
#ipi_exception ⇒ Object (readonly)
Returns the value of attribute ipi_exception.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def ipi_exception @ipi_exception end |
#issqn ⇒ Object (readonly)
Returns the value of attribute issqn.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def issqn @issqn end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def kind @kind end |
#medicament ⇒ Object (readonly)
Returns the value of attribute medicament.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def medicament @medicament end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def name @name end |
#ncm ⇒ Object (readonly)
Returns the value of attribute ncm.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def ncm @ncm end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def number @number end |
#other_value ⇒ Object (readonly)
Returns the value of attribute other_value.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def other_value @other_value end |
#pis ⇒ Object (readonly)
Returns the value of attribute pis.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def pis @pis end |
#pis_st ⇒ Object (readonly)
Returns the value of attribute pis_st.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def pis_st @pis_st end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def total @total end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def unit @unit end |
#unit_sale ⇒ Object (readonly)
Returns the value of attribute unit_sale.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def unit_sale @unit_sale end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def value @value end |
#value_sale ⇒ Object (readonly)
Returns the value of attribute value_sale.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def value_sale @value_sale end |
#vehicle ⇒ Object (readonly)
Returns the value of attribute vehicle.
9 10 11 |
# File 'lib/nfe_reader/product.rb', line 9 def vehicle @vehicle end |