Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema version 6.0.1 #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ spec/reports
test/tmp
test/version_tmp
tmp

*.swp
*.swo
.ruby-version
.ruby-gemset
2 changes: 2 additions & 0 deletions acts_as_isdoc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ Gem::Specification.new do |gem|
gem.add_dependency "htmlentities"
gem.add_dependency "activesupport"
gem.add_dependency "activerecord"
gem.add_dependency "minitest"
gem.add_dependency "sqlite3"
end
38 changes: 23 additions & 15 deletions lib/isdoc_output_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ def build
isdoc = Builder::XmlMarkup.new :indent => 4
isdoc.instruct! :xml

isdoc.encoded_tag!( :Invoice, :xmlns=>"http://isdoc.cz/namespace/invoice", :version=>"5.2") do |invoice|
isdoc.encoded_tag!( :Invoice, :xmlns=>"http://isdoc.cz/namespace/2013", :version=>"6.0") do |invoice|
invoice.encoded_tag! :DocumentType, document_type
invoice.encoded_tag! :ID, document_id
invoice.encoded_tag! :UUID, document_uuid

invoice.encoded_tag! :IssueDate, issue_date
invoice.encoded_tag! :TaxPointDate, tax_point_date if tax_point_date

invoice.encoded_tag! :Note, note if note
invoice.encoded_tag! :VATApplicable, vat_applicable
invoice.encoded_tag! :ElectronicPossibilityAgreementReference, ''

invoice.encoded_tag! :OrderReferences do |order_references|
order_references.encoded_tag! :OrderReference do |order_reference|
order_reference.encoded_tag! :SalesOrderID
order_reference.encoded_tag! :ExternalOrderID, external_order_id
order_reference.encoded_tag! :IssueDate, issue_date
end
end if external_order_id
invoice.encoded_tag! :Note, note

invoice.encoded_tag! :LocalCurrencyCode, local_currency_code
invoice.encoded_tag! :CurrRate, 1
if foreign_currency_code
invoice.encoded_tag! :ForeignCurrencyCode, foreign_currency_code
invoice.encoded_tag! :CurrRate, curr_rate
else
invoice.encoded_tag! :CurrRate, 1
end
invoice.encoded_tag! :RefCurrRate, 1

build_dispatches(invoice)
Expand All @@ -52,6 +52,14 @@ def build
build_party recipient, recipient_details
end if recipient_details

invoice.encoded_tag! :OrderReferences do |order_references|
order_references.encoded_tag! :OrderReference do |order_reference|
order_reference.encoded_tag! :SalesOrderID
order_reference.encoded_tag! :ExternalOrderID, external_order_id
order_reference.encoded_tag! :IssueDate, issue_date
end
end if external_order_id

invoice.encoded_tag! :InvoiceLines do |invoice_lines_tag|
build_invoice_lines invoice_lines_tag, invoice_lines
end
Expand Down Expand Up @@ -89,7 +97,7 @@ def build
end #if payment_means_detail[:payments_mean_code.to_i==42]
end
payment_means.encoded_tag! :AlternateBankAccounts do |alternate_bank_accounts|
for alternate_bank_account in payment_means_detail[:alternate_bank_accounts]
payment_means_detail[:alternate_bank_accounts].each do |alternate_bank_account|
alternate_bank_accounts.encoded_tag! :AlternateBankAccount do
build_bank_account(alternate_bank_accounts, alternate_bank_account)
end
Expand Down Expand Up @@ -158,11 +166,11 @@ def build_invoice_lines(invoice_lines, items)
end

def build_tax_sub_totals(tax_total, tax_sub_totals)
for tax_sub_total in tax_sub_totals
tax_sub_totals.each do |tax_sub_total|
tax_total.encoded_tag! :TaxSubTotal do |tax_sub_total_tag|
tax_sub_total_tag.encoded_tag! :TaxableAmount, tax_sub_total[:taxable_amount]
tax_sub_total_tag.encoded_tag! :TaxInclusiveAmount, tax_sub_total[:tax_inclusive_amount]
tax_sub_total_tag.encoded_tag! :TaxAmount, tax_sub_total[:tax_amount]
tax_sub_total_tag.encoded_tag! :TaxInclusiveAmount, tax_sub_total[:tax_inclusive_amount]
tax_sub_total_tag.encoded_tag! :AlreadyClaimedTaxableAmount, tax_sub_total[:already_claimed_taxable_amount]
tax_sub_total_tag.encoded_tag! :AlreadyClaimedTaxAmount, tax_sub_total[:already_claimed_tax_amount]
tax_sub_total_tag.encoded_tag! :AlreadyClaimedTaxInclusiveAmount, tax_sub_total[:already_claimed_tax_inclusive_amount]
Expand All @@ -187,7 +195,7 @@ def build_bank_account(xml, details, main_bank_account=false)
end

def build_non_taxed_deposits(xml, details)
for detail in details
details.each do |detail|
xml.encoded_tag! :NonTaxedDeposit do |non_taxed_deposit|
non_taxed_deposit.encoded_tag! :ID, detail[:id]
non_taxed_deposit.encoded_tag! :VariableSymbol, detail[:variable_symbol]
Expand All @@ -197,7 +205,7 @@ def build_non_taxed_deposits(xml, details)
end

def build_taxed_deposits(xml, details)
for detail in details
details.each do |detail|
xml.encoded_tag! :TaxedDeposit do |taxed_deposit|
taxed_deposit.encoded_tag! :ID, detail[:id]
taxed_deposit.encoded_tag! :VariableSymbol, detail[:variable_symbol]
Expand Down
34 changes: 0 additions & 34 deletions schema/czreg-all-1.0.xsd

This file was deleted.

41 changes: 0 additions & 41 deletions schema/czreg-dispatch-1.0.xsd

This file was deleted.

42 changes: 0 additions & 42 deletions schema/czreg-domain-1.0.xsd

This file was deleted.

Loading