Class: SunatInvoice::TradeDocument
- Inherits:
-
XmlDocument
- Object
- Model
- XmlDocument
- SunatInvoice::TradeDocument
- Includes:
- TradeCalculations
- Defined in:
- lib/sunat_invoice/trade_document.rb
Direct Known Subclasses
Constant Summary collapse
- INVOICE_TYPES =
%w[01 03].freeze
Constants inherited from XmlDocument
XmlDocument::CUSTOMIZATION, XmlDocument::UBL_VERSION
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
-
#customer ⇒ Object
Returns the value of attribute customer.
-
#discount ⇒ Object
Returns the value of attribute discount.
-
#document_number ⇒ Object
Returns the value of attribute document_number.
-
#document_type ⇒ Object
Returns the value of attribute document_type.
-
#sale_totals ⇒ Object
readonly
a hash with totals without taxes for any kind of sale.
-
#taxes_totals ⇒ Object
readonly
a hash with taxes totals by tax type.
-
#total ⇒ Object
readonly
total for document (sale totals + taxes - discounts).
Attributes inherited from XmlDocument
#currency, #date, #lines, #provider, #signature
Instance Method Summary collapse
- #document_name ⇒ Object
-
#initialize(*args) ⇒ TradeDocument
constructor
A new instance of TradeDocument.
- #operation ⇒ Object
Methods included from TradeCalculations
#calculate_sale_totals, #calculate_taxes_totals, #calculate_total, #get_total_code, #get_total_igv_code, #prepare_totals
Methods inherited from XmlDocument
#build_lines_xml, #build_number, #build_xml, #formatted_date
Methods included from Utils
Methods inherited from Model
Constructor Details
#initialize(*args) ⇒ TradeDocument
Returns a new instance of TradeDocument.
23 24 25 26 |
# File 'lib/sunat_invoice/trade_document.rb', line 23 def initialize(*args) super(*args) @signature ||= SunatInvoice::Signature.new(provider: @provider) end |
Instance Attribute Details
#customer ⇒ Object
Returns the value of attribute customer.
10 11 12 |
# File 'lib/sunat_invoice/trade_document.rb', line 10 def customer @customer end |
#discount ⇒ Object
Returns the value of attribute discount.
10 11 12 |
# File 'lib/sunat_invoice/trade_document.rb', line 10 def discount @discount end |
#document_number ⇒ Object
Returns the value of attribute document_number.
10 11 12 |
# File 'lib/sunat_invoice/trade_document.rb', line 10 def document_number @document_number end |
#document_type ⇒ Object
Returns the value of attribute document_type.
10 11 12 |
# File 'lib/sunat_invoice/trade_document.rb', line 10 def document_type @document_type end |
#sale_totals ⇒ Object (readonly)
a hash with totals without taxes for any kind of sale
19 20 21 |
# File 'lib/sunat_invoice/trade_document.rb', line 19 def sale_totals @sale_totals end |
#taxes_totals ⇒ Object (readonly)
a hash with taxes totals by tax type
16 17 18 |
# File 'lib/sunat_invoice/trade_document.rb', line 16 def taxes_totals @taxes_totals end |
#total ⇒ Object (readonly)
total for document (sale totals + taxes - discounts)
13 14 15 |
# File 'lib/sunat_invoice/trade_document.rb', line 13 def total @total end |
Instance Method Details
#document_name ⇒ Object
32 33 34 |
# File 'lib/sunat_invoice/trade_document.rb', line 32 def document_name "#{@provider.ruc}-#{document_type}-#{document_number}" end |
#operation ⇒ Object
28 29 30 |
# File 'lib/sunat_invoice/trade_document.rb', line 28 def operation :send_bill end |