Class: SunatInvoice::SummaryLine

Inherits:
Line
  • Object
show all
Defined in:
lib/sunat_invoice/summary_line.rb

Constant Summary collapse

CHARGES =
{
  discount: false,
  charge: true
}.freeze

Constants included from Utils

Utils::COMMON_NAMESPACES, Utils::CREDIT_NOTE_NAMESPACES, Utils::DAILY_SUMMARY_NAMESPACES, Utils::DEBIT_NOTE_NAMESPACES, Utils::INVOICE_NAMESPACES, Utils::SUMMARY_NAMESPACES, Utils::TRADE_NAMESPACES, Utils::VOIDED_NAMESPACES

Instance Attribute Summary collapse

Attributes inherited from Line

#taxes

Instance Method Summary collapse

Methods inherited from Line

#build_taxes_xml

Methods included from Utils

#amount_xml, #ubl_ext

Methods inherited from Model

#to_hash

Constructor Details

#initialize(*args) ⇒ SummaryLine

Returns a new instance of SummaryLine.



16
17
18
19
20
21
22
# File 'lib/sunat_invoice/summary_line.rb', line 16

def initialize(*args)
  super(*args)
  @taxable ||= 0.01
  @non_taxable ||= 0.01
  @exempt ||= 0.01
  @other_charge ||= 0.01
end

Instance Attribute Details

#charge_typeObject

Returns the value of attribute charge_type.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def charge_type
  @charge_type
end

#document_serialObject

Returns the value of attribute document_serial.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def document_serial
  @document_serial
end

#document_typeObject

Returns the value of attribute document_type.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def document_type
  @document_type
end

#end_document_numberObject

Returns the value of attribute end_document_number.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def end_document_number
  @end_document_number
end

#exemptObject

Returns the value of attribute exempt.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def exempt
  @exempt
end

#non_taxableObject

Returns the value of attribute non_taxable.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def non_taxable
  @non_taxable
end

#other_chargeObject

Returns the value of attribute other_charge.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def other_charge
  @other_charge
end

#start_document_numberObject

Returns the value of attribute start_document_number.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def start_document_number
  @start_document_number
end

#taxableObject

Returns the value of attribute taxable.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def taxable
  @taxable
end

#total_amountObject

Returns the value of attribute total_amount.



7
8
9
# File 'lib/sunat_invoice/summary_line.rb', line 7

def total_amount
  @total_amount
end

Instance Method Details

#xml(xml, index, currency) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/sunat_invoice/summary_line.rb', line 24

def xml(xml, index, currency)
  xml['sac'].SummaryDocumentsLine do
    xml['cbc'].LineID(index + 1)
    build_documents_info(xml)
    amount_xml(xml['sac'], 'TotalAmount', total_amount, currency)
    build_payments(xml, currency)
    build_other_charge(xml, currency)
    build_taxes_xml(xml, currency)
  end
end