Class: Xrechnung::Document
- Inherits:
-
Object
- Object
- Xrechnung::Document
- Includes:
- MemberContainer
- Defined in:
- lib/xrechnung.rb
Constant Summary collapse
- DEFAULT_CUSTOMIZATION_ID =
Default customization specs
"urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0"- DEFAULT_PROFILE_ID =
"urn:fdc:peppol.eu:2017:poacc:billing:01:1.0"- COMMON_NAMESPACES =
{ "xmlns:ubl" => "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2", "xmlns:cac" => "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", "xmlns:cbc" => "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation" => "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd", }.freeze
Instance Attribute Summary collapse
- #accounting_customer_party ⇒ Xrechnung::Party
- #accounting_supplier_party ⇒ Xrechnung::Party
- #additional_document_references ⇒ Array
- #allowance_charges ⇒ Array
- #billing_reference ⇒ Xrechnung::InvoiceDocumentReference
- #buyer_reference ⇒ String
- #contract_document_reference_id ⇒ String
- #customization_id ⇒ String
- #document_currency_code ⇒ String
- #due_date ⇒ Date
- #id ⇒ String
- #invoice_lines ⇒ Array
- #invoice_period ⇒ Xrechnung::InvoicePeriod
- #invoice_type_code ⇒ Integer
- #issue_date ⇒ Date
- #legal_monetary_total ⇒ Xrechnung::LegalMonetaryTotal
- #notes ⇒ Array
- #payee_party ⇒ Xrechnung::PayeeParty
- #payment_means ⇒ Xrechnung::PaymentMeans
- #payment_terms_note ⇒ String
- #profile_id ⇒ String
- #project_reference_id ⇒ String
- #purchase_order_reference ⇒ String
- #sales_order_reference ⇒ String
- #tax_currency_code ⇒ String
- #tax_point_date ⇒ Date
- #tax_representative_party ⇒ Xrechnung::Party
- #tax_total ⇒ Xrechnung::TaxTotal
Instance Method Summary collapse
Methods included from MemberContainer
#[], #[]=, included, #initialize
Instance Attribute Details
#accounting_customer_party ⇒ Xrechnung::Party
151 |
# File 'lib/xrechnung.rb', line 151 member :accounting_customer_party, type: Xrechnung::Party |
#accounting_supplier_party ⇒ Xrechnung::Party
143 |
# File 'lib/xrechnung.rb', line 143 member :accounting_supplier_party, type: Xrechnung::Party |
#additional_document_references ⇒ Array
198 |
# File 'lib/xrechnung.rb', line 198 member :additional_document_references, type: Array, default: [] |
#allowance_charges ⇒ Array
294 |
# File 'lib/xrechnung.rb', line 294 member :allowance_charges, type: Array, default: [] |
#billing_reference ⇒ Xrechnung::InvoiceDocumentReference
193 |
# File 'lib/xrechnung.rb', line 193 member :billing_reference, type: Xrechnung::InvoiceDocumentReference, optional: true |
#buyer_reference ⇒ String
189 |
# File 'lib/xrechnung.rb', line 189 member :buyer_reference, type: String |
#contract_document_reference_id ⇒ String
210 |
# File 'lib/xrechnung.rb', line 210 member :contract_document_reference_id, type: String, optional: true |
#customization_id ⇒ String
48 |
# File 'lib/xrechnung.rb', line 48 member :customization_id, type: String, default: DEFAULT_CUSTOMIZATION_ID |
#document_currency_code ⇒ String
110 |
# File 'lib/xrechnung.rb', line 110 member :document_currency_code, type: String, default: "EUR" |
#due_date ⇒ Date
79 |
# File 'lib/xrechnung.rb', line 79 member :due_date, type: Date |
#id ⇒ String
63 |
# File 'lib/xrechnung.rb', line 63 member :id, type: String |
#invoice_lines ⇒ Array
283 |
# File 'lib/xrechnung.rb', line 283 member :invoice_lines, type: Array, default: [] |
#invoice_period ⇒ Xrechnung::InvoicePeriod
202 |
# File 'lib/xrechnung.rb', line 202 member :invoice_period, type: Xrechnung::InvoicePeriod, optional: true |
#invoice_type_code ⇒ Integer
97 |
# File 'lib/xrechnung.rb', line 97 member :invoice_type_code, type: Integer, default: 380 |
#issue_date ⇒ Date
71 |
# File 'lib/xrechnung.rb', line 71 member :issue_date, type: Date |
#legal_monetary_total ⇒ Xrechnung::LegalMonetaryTotal
274 |
# File 'lib/xrechnung.rb', line 274 member :legal_monetary_total, type: Xrechnung::LegalMonetaryTotal |
#notes ⇒ Array
119 |
# File 'lib/xrechnung.rb', line 119 member :notes, type: Array, default: [] |
#payee_party ⇒ Xrechnung::PayeeParty
245 |
# File 'lib/xrechnung.rb', line 245 member :payee_party, type: Xrechnung::PayeeParty, optional: true |
#payment_means ⇒ Xrechnung::PaymentMeans
236 |
# File 'lib/xrechnung.rb', line 236 member :payment_means, type: Xrechnung::PaymentMeans |
#payment_terms_note ⇒ String
256 |
# File 'lib/xrechnung.rb', line 256 member :payment_terms_note, type: String |
#profile_id ⇒ String
54 |
# File 'lib/xrechnung.rb', line 54 member :profile_id, type: String, default: DEFAULT_PROFILE_ID |
#project_reference_id ⇒ String
218 |
# File 'lib/xrechnung.rb', line 218 member :project_reference_id, type: String, optional: true |
#purchase_order_reference ⇒ String
127 |
# File 'lib/xrechnung.rb', line 127 member :purchase_order_reference, type: String |
#sales_order_reference ⇒ String
135 |
# File 'lib/xrechnung.rb', line 135 member :sales_order_reference, type: String, optional: true |
#tax_currency_code ⇒ String
173 |
# File 'lib/xrechnung.rb', line 173 member :tax_currency_code, type: String |
#tax_point_date ⇒ Date
160 |
# File 'lib/xrechnung.rb', line 160 member :tax_point_date, type: Date |
#tax_representative_party ⇒ Xrechnung::Party
227 |
# File 'lib/xrechnung.rb', line 227 member :tax_representative_party, type: Xrechnung::Party, optional: true |
#tax_total ⇒ Xrechnung::TaxTotal
265 |
# File 'lib/xrechnung.rb', line 265 member :tax_total, type: Xrechnung::TaxTotal |
Instance Method Details
#to_xml(indent: 2, target: "") ⇒ Object
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/xrechnung.rb', line 304 def to_xml(indent: 2, target: "") xml = Builder::XmlMarkup.new(indent: indent, target: target) xml.instruct! :xml, version: "1.0", encoding: "UTF-8" xml.ubl :Invoice, COMMON_NAMESPACES do xml.cbc :CustomizationID, customization_id xml.cbc :ProfileID, profile_id xml.cbc :ID, id xml.cbc :IssueDate, issue_date xml.cbc :DueDate, due_date xml.cbc :InvoiceTypeCode, invoice_type_code notes.each do |note| xml.cbc :Note, note end xml.cbc :TaxPointDate, tax_point_date unless tax_point_date.nil? xml.cbc :DocumentCurrencyCode, document_currency_code xml.cbc :TaxCurrencyCode, tax_currency_code unless tax_currency_code.nil? xml.cbc :BuyerReference, buyer_reference invoice_period&.to_xml(xml) unless self.class.members[:invoice_period].optional && invoice_period.nil? unless purchase_order_reference.nil? && self.class.members[:sales_order_reference].optional && sales_order_reference.nil? xml.cac :OrderReference do xml.cbc :ID, purchase_order_reference unless self.class.members[:sales_order_reference].optional && sales_order_reference.nil? xml.cbc :SalesOrderID, sales_order_reference end end end unless self.class.members[:billing_reference].optional && billing_reference.nil? xml.cac :BillingReference do billing_reference&.to_xml(xml) end end unless self.class.members[:contract_document_reference_id].optional && contract_document_reference_id.nil? xml.cac :ContractDocumentReference do xml.cbc :ID, contract_document_reference_id end end unless self.class.members[:project_reference_id].optional && project_reference_id.nil? xml.cac :ProjectReference do xml.cbc :ID, project_reference_id end end additional_document_references.each { _1.to_xml(xml) } xml.cac :AccountingSupplierParty do accounting_supplier_party&.to_xml(xml) end xml.cac :AccountingCustomerParty do accounting_customer_party&.to_xml(xml) end unless self.class.members[:tax_representative_party].optional && tax_representative_party.nil? xml.cac :TaxRepresentativeParty do tax_representative_party&.to_xml(xml) end end xml.cac :PaymentMeans do payment_means&.to_xml(xml) end payee_party&.to_xml(xml) unless self.class.members[:payee_party].optional && payee_party.nil? unless payment_terms_note.blank? xml.cac :PaymentTerms do xml.cbc :Note, payment_terms_note end end allowance_charges.each { _1.to_xml(xml) } xml.cac :TaxTotal do tax_total&.to_xml(xml) end xml.cac :LegalMonetaryTotal do legal_monetary_total&.to_xml(xml) end invoice_lines.each { _1.to_xml(xml) } end target end |