invoicing 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/CHANGELOG +3 -0
  2. data/LICENSE +20 -0
  3. data/Manifest +60 -0
  4. data/README +48 -0
  5. data/Rakefile +75 -0
  6. data/invoicing.gemspec +41 -0
  7. data/lib/invoicing.rb +9 -0
  8. data/lib/invoicing/cached_record.rb +107 -0
  9. data/lib/invoicing/class_info.rb +187 -0
  10. data/lib/invoicing/connection_adapter_ext.rb +44 -0
  11. data/lib/invoicing/countries/uk.rb +24 -0
  12. data/lib/invoicing/currency_value.rb +212 -0
  13. data/lib/invoicing/find_subclasses.rb +193 -0
  14. data/lib/invoicing/ledger_item.rb +718 -0
  15. data/lib/invoicing/ledger_item/render_html.rb +515 -0
  16. data/lib/invoicing/ledger_item/render_ubl.rb +268 -0
  17. data/lib/invoicing/line_item.rb +246 -0
  18. data/lib/invoicing/price.rb +9 -0
  19. data/lib/invoicing/tax_rate.rb +9 -0
  20. data/lib/invoicing/taxable.rb +355 -0
  21. data/lib/invoicing/time_dependent.rb +388 -0
  22. data/lib/invoicing/version.rb +21 -0
  23. data/test/cached_record_test.rb +100 -0
  24. data/test/class_info_test.rb +253 -0
  25. data/test/connection_adapter_ext_test.rb +71 -0
  26. data/test/currency_value_test.rb +184 -0
  27. data/test/find_subclasses_test.rb +120 -0
  28. data/test/fixtures/README +7 -0
  29. data/test/fixtures/cached_record.sql +22 -0
  30. data/test/fixtures/class_info.sql +28 -0
  31. data/test/fixtures/currency_value.sql +29 -0
  32. data/test/fixtures/find_subclasses.sql +43 -0
  33. data/test/fixtures/ledger_item.sql +39 -0
  34. data/test/fixtures/line_item.sql +33 -0
  35. data/test/fixtures/price.sql +4 -0
  36. data/test/fixtures/tax_rate.sql +4 -0
  37. data/test/fixtures/taxable.sql +14 -0
  38. data/test/fixtures/time_dependent.sql +35 -0
  39. data/test/ledger_item_test.rb +352 -0
  40. data/test/line_item_test.rb +139 -0
  41. data/test/models/README +4 -0
  42. data/test/models/test_subclass_in_another_file.rb +3 -0
  43. data/test/models/test_subclass_not_in_database.rb +6 -0
  44. data/test/price_test.rb +9 -0
  45. data/test/ref-output/creditnote3.html +82 -0
  46. data/test/ref-output/creditnote3.xml +89 -0
  47. data/test/ref-output/invoice1.html +93 -0
  48. data/test/ref-output/invoice1.xml +111 -0
  49. data/test/ref-output/invoice2.html +86 -0
  50. data/test/ref-output/invoice2.xml +98 -0
  51. data/test/ref-output/invoice_null.html +36 -0
  52. data/test/render_html_test.rb +69 -0
  53. data/test/render_ubl_test.rb +32 -0
  54. data/test/setup.rb +37 -0
  55. data/test/tax_rate_test.rb +9 -0
  56. data/test/taxable_test.rb +180 -0
  57. data/test/test_helper.rb +48 -0
  58. data/test/time_dependent_test.rb +180 -0
  59. data/website/curvycorners.js +1 -0
  60. data/website/screen.css +149 -0
  61. data/website/template.html.erb +43 -0
  62. metadata +180 -0
@@ -0,0 +1,139 @@
1
+ # encoding: utf-8
2
+
3
+ require File.join(File.dirname(__FILE__), 'test_helper.rb')
4
+
5
+ ####### Helper stuff
6
+
7
+ module LineItemMethods
8
+ RENAMED_METHODS = {
9
+ :id => :id2, :type => :type2, :ledger_item_id => :ledger_item_id2,
10
+ :net_amount => :net_amount2, :tax_amount => :tax_amount2,
11
+ :description => :description2, :uuid => :uuid2, :tax_point => :tax_point2,
12
+ :tax_rate_id => :tax_rate_id2, :price_id => :price_id2,
13
+ :quantity => :quantity2, :creator_id => :creator_id2, :ledger_item => :ledger_item2
14
+ }
15
+
16
+ def description2
17
+ "moo"
18
+ end
19
+ end
20
+
21
+
22
+ ####### Classes for use in the tests (also used by LedgerItemTest)
23
+
24
+ class SuperLineItem < ActiveRecord::Base
25
+ set_primary_key 'id2'
26
+ set_inheritance_column 'type2'
27
+ set_table_name 'line_item_records'
28
+ include LineItemMethods
29
+ acts_as_line_item RENAMED_METHODS
30
+ belongs_to :ledger_item2, :class_name => 'MyLedgerItem', :foreign_key => 'ledger_item_id2'
31
+ end
32
+
33
+ class SubLineItem < SuperLineItem
34
+ def description2
35
+ "this is the SubLineItem"
36
+ end
37
+ end
38
+
39
+ class OtherLineItem < SuperLineItem
40
+ end
41
+
42
+ class UntaxedLineItem < SuperLineItem
43
+ end
44
+
45
+ class UUIDNotPresentLineItem < ActiveRecord::Base
46
+ set_primary_key 'id2'
47
+ set_inheritance_column 'type2'
48
+ set_table_name 'line_item_records'
49
+ include LineItemMethods
50
+
51
+ def get_class_info
52
+ line_item_class_info
53
+ end
54
+ end
55
+
56
+ class OverwrittenMethodsNotPresentLineItem < ActiveRecord::Base
57
+ set_primary_key 'id2'
58
+ set_inheritance_column 'type2'
59
+ set_table_name 'line_item_records'
60
+ acts_as_line_item LineItemMethods::RENAMED_METHODS
61
+ end
62
+
63
+
64
+ ####### The actual tests
65
+
66
+ class LineItemTest < Test::Unit::TestCase
67
+
68
+ def test_net_amount_is_currency_value
69
+ assert_equal '$432.10', UntaxedLineItem.find(4).net_amount2_formatted
70
+ end
71
+
72
+ def test_tax_amount_is_currency_value
73
+ assert_equal '£15.00', SuperLineItem.find(1).tax_amount2_formatted
74
+ end
75
+
76
+ def test_gross_amount
77
+ assert_equal BigDecimal('115'), SuperLineItem.find(1).gross_amount
78
+ end
79
+
80
+ def test_gross_amount_formatted
81
+ assert_equal '£115.00', SuperLineItem.find(1).gross_amount_formatted
82
+ end
83
+
84
+ def test_assign_uuid_to_new_record
85
+ record = SuperLineItem.new
86
+ begin
87
+ UUID
88
+ uuid_gem_available = true
89
+ rescue NameError
90
+ uuid_gem_available = false
91
+ end
92
+ if uuid_gem_available
93
+ assert_match /^[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}$/, record.uuid2
94
+ else
95
+ assert record.uuid2.blank?
96
+ puts "Warning: uuid gem not installed -- not testing UUID generation"
97
+ end
98
+ end
99
+
100
+ def test_uuid_gem_not_present
101
+ begin
102
+ real_uuid = Object.send(:remove_const, :UUID)
103
+ UUIDNotPresentLineItem.acts_as_line_item(LineItemMethods::RENAMED_METHODS)
104
+ assert_nil UUIDNotPresentLineItem.new.get_class_info.uuid_generator
105
+ ensure
106
+ Object.send(:const_set, :UUID, real_uuid)
107
+ end
108
+ end
109
+
110
+ def test_must_provide_ledger_item_association
111
+ assert_raise RuntimeError do
112
+ OverwrittenMethodsNotPresentLineItem.new.ledger_item
113
+ end
114
+ end
115
+
116
+ def test_ledger_item_error
117
+ assert_raise RuntimeError do
118
+ SuperLineItem.find(1).ledger_item # not ledger_item2
119
+ end
120
+ end
121
+
122
+ def test_currency
123
+ assert_equal 'GBP', SubLineItem.find(2).currency
124
+ end
125
+
126
+ def test_in_effect_scope
127
+ assert_equal [1,2,3,4,5,6,7,8], SuperLineItem.all.map{|i| i.id}.sort
128
+ assert_equal [1,2,3,4,5,6], SuperLineItem.in_effect.map{|i| i.id}.sort
129
+ end
130
+
131
+ def test_sorted_scope
132
+ assert_equal [4,2,1,5,3,6,7,8], SuperLineItem.sorted(:tax_point).map{|i| i.id}
133
+ end
134
+
135
+ def test_sorted_scope_with_non_existent_column
136
+ assert_equal [1,2,3,4,5,6,7,8], SuperLineItem.sorted(:this_column_does_not_exist).map{|i| i.id}
137
+ end
138
+
139
+ end
@@ -0,0 +1,4 @@
1
+ This folder contains model object definitions used by the tests in the 'test' folder;
2
+ it is included in ActiveSupport::Dependencies.load_paths but not 'require'd directly,
3
+ so that we can test the effect which the ActiveSupport dependency resolution has on
4
+ our code.
@@ -0,0 +1,3 @@
1
+ # Used by find_subclasses_test.rb
2
+ class TestSubclassInAnotherFile < TestBaseclass
3
+ end
@@ -0,0 +1,6 @@
1
+ # Please do not require this file or the class name TestSubclassNotInDatabase
2
+ # anywhere. The whole point of it is that it is a subclass of TestBaseclass
3
+ # which exists, but is never loaded, because it isn't mentioned anywhere.
4
+ # FindSubclassesTest#test_known_subclasses tests this.
5
+ class TestSubclassNotInDatabase < TestBaseclass
6
+ end
@@ -0,0 +1,9 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper.rb')
2
+
3
+ class PriceTest < Test::Unit::TestCase
4
+
5
+ def test_should_be_true
6
+ assert_equal(1,1)
7
+ end
8
+
9
+ end
@@ -0,0 +1,82 @@
1
+ <h1 class="invoice">Credit Note</h1>
2
+ <table class="invoice addresses">
3
+ <tr>
4
+ <th class="recipient">Recipient</th>
5
+ <th class="sender">Sender</th>
6
+ </tr>
7
+ <tr>
8
+ <td class="recipient vcard">
9
+ <div class="fn org">Lovely Customer Inc.</div>
10
+ <div class="contact">Fred</div>
11
+ <div class="adr">
12
+ <span class="street-address">The pasture</span><br />
13
+ <span class="locality">Mootown</span><br />
14
+ <span class="region">Cow Kingdom</span><br />
15
+ <span class="postal-code">MOOO</span><br />
16
+ <span class="country-name">Scotland</span>
17
+ </div>
18
+ </td>
19
+ <td class="sender vcard">
20
+ <div class="fn org">Unlimited Limited</div>
21
+ <div class="contact">Mr B. Badger</div>
22
+ <div class="adr">
23
+ <span class="street-address">The Sett<br />5 Badger Lane</span><br />
24
+ <span class="locality">Badgertown</span><br />
25
+ <span class="postal-code">Badger999</span><br />
26
+ <span class="country-name">England</span>
27
+ </div>
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <td class="recipient">
32
+ VAT number:<br /><span class="tax-number">987654321</span>
33
+ </td>
34
+ <td class="sender">
35
+ VAT number:<br /><span class="tax-number">123456789</span>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ <table class="invoice metadata">
40
+ <tr class="identifier">
41
+ <th>Invoice no.:</th>
42
+ <td>putain!</td>
43
+ </tr>
44
+ <tr class="issue-date">
45
+ <th>Issue date:</th>
46
+ <td>2008-07-13</td>
47
+ </tr>
48
+ <tr class="period-start">
49
+ <th>Period from:</th>
50
+ <td>2008-06-01</td>
51
+ </tr>
52
+ <tr class="period-end">
53
+ <th>Period until:</th>
54
+ <td>2008-07-01</td>
55
+ </tr>
56
+ </table>
57
+ <p class="invoice description">MyCreditNote 3</p>
58
+ <table class="invoice line-items">
59
+ <tr>
60
+ <th class="tax-point">Tax point</th>
61
+ <th class="quantity">Quantity</th>
62
+ <th class="description">Description</th>
63
+ <th class="net-amount">Net price</th>
64
+ <th class="tax-amount">VAT</th>
65
+ </tr>
66
+ <tr>
67
+ <td class="tax-point">2008-07-13</td>
68
+ <td class="quantity">0.5</td>
69
+ <td class="description">moo</td>
70
+ <td class="net-amount">£50.00</td>
71
+ <td class="tax-amount">£7.50</td>
72
+ </tr>
73
+ <tr class="subtotal">
74
+ <th colspan="3">Subtotal</th>
75
+ <td class="net-amount">Net: £50.00</td>
76
+ <td class="tax-amount">VAT: £7.50</td>
77
+ </tr>
78
+ <tr class="total">
79
+ <th colspan="4">Total</th>
80
+ <td class="total-amount">£57.50</td>
81
+ </tr>
82
+ </table>
@@ -0,0 +1,89 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ubl:CreditNote xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
3
+ <cbc:ID>putain!</cbc:ID>
4
+ <cbc:UUID>671a05d0-d1ba-012b-48a5-0017f22d32c0</cbc:UUID>
5
+ <cbc:IssueDate>2008-07-13</cbc:IssueDate>
6
+ <cbc:IssueTime>00:00:00+00:00</cbc:IssueTime>
7
+ <cbc:TaxPointDate>2008-07-13</cbc:TaxPointDate>
8
+ <cbc:Note>MyCreditNote 3</cbc:Note>
9
+ <cac:InvoicePeriod>
10
+ <cbc:StartDate>2008-06-01</cbc:StartDate>
11
+ <cbc:StartTime>00:00:00+00:00</cbc:StartTime>
12
+ <cbc:EndDate>2008-07-01</cbc:EndDate>
13
+ <cbc:EndTime>00:00:00+00:00</cbc:EndTime>
14
+ </cac:InvoicePeriod>
15
+ <cac:AccountingSupplierParty>
16
+ <cac:Party>
17
+ <cac:PartyName>
18
+ <cbc:Name>Unlimited Limited</cbc:Name>
19
+ </cac:PartyName>
20
+ <cac:PostalAddress>
21
+ <cbc:StreetName>The Sett</cbc:StreetName>
22
+ <cbc:AdditionalStreetName>5 Badger Lane</cbc:AdditionalStreetName>
23
+ <cbc:CityName>Badgertown</cbc:CityName>
24
+ <cbc:PostalZone>Badger999</cbc:PostalZone>
25
+ <cbc:CountrySubentity></cbc:CountrySubentity>
26
+ <cac:Country>
27
+ <cbc:IdentificationCode>GB</cbc:IdentificationCode>
28
+ <cbc:Name>England</cbc:Name>
29
+ </cac:Country>
30
+ </cac:PostalAddress>
31
+ <cac:PartyTaxScheme>
32
+ <cbc:CompanyID>123456789</cbc:CompanyID>
33
+ <cac:TaxScheme>
34
+ <cbc:ID>VAT</cbc:ID>
35
+ </cac:TaxScheme>
36
+ </cac:PartyTaxScheme>
37
+ <cac:Contact>
38
+ <cbc:Name>Mr B. Badger</cbc:Name>
39
+ </cac:Contact>
40
+ </cac:Party>
41
+ </cac:AccountingSupplierParty>
42
+ <cac:AccountingCustomerParty>
43
+ <cbc:SupplierAssignedAccountID>2</cbc:SupplierAssignedAccountID>
44
+ <cac:Party>
45
+ <cac:PartyName>
46
+ <cbc:Name>Lovely Customer Inc.</cbc:Name>
47
+ </cac:PartyName>
48
+ <cac:PostalAddress>
49
+ <cbc:StreetName>The pasture</cbc:StreetName>
50
+ <cbc:CityName>Mootown</cbc:CityName>
51
+ <cbc:PostalZone>MOOO</cbc:PostalZone>
52
+ <cbc:CountrySubentity>Cow Kingdom</cbc:CountrySubentity>
53
+ <cac:Country>
54
+ <cbc:IdentificationCode>GB</cbc:IdentificationCode>
55
+ <cbc:Name>Scotland</cbc:Name>
56
+ </cac:Country>
57
+ </cac:PostalAddress>
58
+ <cac:PartyTaxScheme>
59
+ <cbc:CompanyID>987654321</cbc:CompanyID>
60
+ <cac:TaxScheme>
61
+ <cbc:ID>VAT</cbc:ID>
62
+ </cac:TaxScheme>
63
+ </cac:PartyTaxScheme>
64
+ <cac:Contact>
65
+ <cbc:Name>Fred</cbc:Name>
66
+ </cac:Contact>
67
+ </cac:Party>
68
+ </cac:AccountingCustomerParty>
69
+ <cac:TaxTotal>
70
+ <cbc:TaxAmount currencyID="GBP">7.5</cbc:TaxAmount>
71
+ </cac:TaxTotal>
72
+ <cac:LegalMonetaryTotal>
73
+ <cbc:TaxExclusiveAmount currencyID="GBP">50.0</cbc:TaxExclusiveAmount>
74
+ <cbc:PayableAmount currencyID="GBP">57.5</cbc:PayableAmount>
75
+ </cac:LegalMonetaryTotal>
76
+ <cac:CreditNoteLine>
77
+ <cbc:ID>5</cbc:ID>
78
+ <cbc:UUID>eab28cf0-d1b4-012b-48a5-0017f22d32c0</cbc:UUID>
79
+ <cbc:CreditedQuantity>0.5</cbc:CreditedQuantity>
80
+ <cbc:LineExtensionAmount currencyID="GBP">50.0</cbc:LineExtensionAmount>
81
+ <cbc:TaxPointDate>2008-07-13</cbc:TaxPointDate>
82
+ <cac:TaxTotal>
83
+ <cbc:TaxAmount currencyID="GBP">7.5</cbc:TaxAmount>
84
+ </cac:TaxTotal>
85
+ <cac:Item>
86
+ <cbc:Description>moo</cbc:Description>
87
+ </cac:Item>
88
+ </cac:CreditNoteLine>
89
+ </ubl:CreditNote>
@@ -0,0 +1,93 @@
1
+ <h1 class="invoice">Invoice</h1>
2
+ <table class="invoice addresses">
3
+ <tr>
4
+ <th class="recipient">Recipient</th>
5
+ <th class="sender">Sender</th>
6
+ </tr>
7
+ <tr>
8
+ <td class="recipient vcard">
9
+ <div class="fn org">Lovely Customer Inc.</div>
10
+ <div class="contact">Fred</div>
11
+ <div class="adr">
12
+ <span class="street-address">The pasture</span><br />
13
+ <span class="locality">Mootown</span><br />
14
+ <span class="region">Cow Kingdom</span><br />
15
+ <span class="postal-code">MOOO</span><br />
16
+ <span class="country-name">Scotland</span>
17
+ </div>
18
+ </td>
19
+ <td class="sender vcard">
20
+ <div class="fn org">Unlimited Limited</div>
21
+ <div class="contact">Mr B. Badger</div>
22
+ <div class="adr">
23
+ <span class="street-address">The Sett<br />5 Badger Lane</span><br />
24
+ <span class="locality">Badgertown</span><br />
25
+ <span class="postal-code">Badger999</span><br />
26
+ <span class="country-name">England</span>
27
+ </div>
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <td class="recipient">
32
+ VAT number:<br /><span class="tax-number">987654321</span>
33
+ </td>
34
+ <td class="sender">
35
+ VAT number:<br /><span class="tax-number">123456789</span>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ <table class="invoice metadata">
40
+ <tr class="identifier">
41
+ <th>Invoice no.:</th>
42
+ <td>1</td>
43
+ </tr>
44
+ <tr class="issue-date">
45
+ <th>Issue date:</th>
46
+ <td>2008-06-30</td>
47
+ </tr>
48
+ <tr class="period-start">
49
+ <th>Period from:</th>
50
+ <td>2008-06-01</td>
51
+ </tr>
52
+ <tr class="period-end">
53
+ <th>Period until:</th>
54
+ <td>2008-07-01</td>
55
+ </tr>
56
+ <tr class="due-date">
57
+ <th>Payment due:</th>
58
+ <td>2008-07-30</td>
59
+ </tr>
60
+ </table>
61
+ <p class="invoice description">MyInvoice 1</p>
62
+ <table class="invoice line-items">
63
+ <tr>
64
+ <th class="tax-point">Tax point</th>
65
+ <th class="quantity">Quantity</th>
66
+ <th class="description">Description</th>
67
+ <th class="net-amount">Net price</th>
68
+ <th class="tax-amount">VAT</th>
69
+ </tr>
70
+ <tr>
71
+ <td class="tax-point">2008-06-25</td>
72
+ <td class="quantity">4.0</td>
73
+ <td class="description">this is the SubLineItem</td>
74
+ <td class="net-amount">£200.00</td>
75
+ <td class="tax-amount">£0.00</td>
76
+ </tr>
77
+ <tr>
78
+ <td class="tax-point">2008-06-30</td>
79
+ <td class="quantity">1.0</td>
80
+ <td class="description">moo</td>
81
+ <td class="net-amount">£100.00</td>
82
+ <td class="tax-amount">£15.00</td>
83
+ </tr>
84
+ <tr class="subtotal">
85
+ <th colspan="3">Subtotal</th>
86
+ <td class="net-amount">Net: £300.00</td>
87
+ <td class="tax-amount">VAT: £15.00</td>
88
+ </tr>
89
+ <tr class="total">
90
+ <th colspan="4">Total</th>
91
+ <td class="total-amount">£315.00</td>
92
+ </tr>
93
+ </table>
@@ -0,0 +1,111 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ubl:Invoice xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
3
+ <cbc:ID>1</cbc:ID>
4
+ <cbc:UUID>30f4f680-d1b9-012b-48a5-0017f22d32c0</cbc:UUID>
5
+ <cbc:IssueDate>2008-06-30</cbc:IssueDate>
6
+ <cbc:IssueTime>00:00:00+00:00</cbc:IssueTime>
7
+ <cbc:InvoiceTypeCode>MyInvoice</cbc:InvoiceTypeCode>
8
+ <cbc:Note>MyInvoice 1</cbc:Note>
9
+ <cbc:TaxPointDate>2008-06-30</cbc:TaxPointDate>
10
+ <cac:InvoicePeriod>
11
+ <cbc:StartDate>2008-06-01</cbc:StartDate>
12
+ <cbc:StartTime>00:00:00+00:00</cbc:StartTime>
13
+ <cbc:EndDate>2008-07-01</cbc:EndDate>
14
+ <cbc:EndTime>00:00:00+00:00</cbc:EndTime>
15
+ </cac:InvoicePeriod>
16
+ <cac:AccountingSupplierParty>
17
+ <cac:Party>
18
+ <cac:PartyName>
19
+ <cbc:Name>Unlimited Limited</cbc:Name>
20
+ </cac:PartyName>
21
+ <cac:PostalAddress>
22
+ <cbc:StreetName>The Sett</cbc:StreetName>
23
+ <cbc:AdditionalStreetName>5 Badger Lane</cbc:AdditionalStreetName>
24
+ <cbc:CityName>Badgertown</cbc:CityName>
25
+ <cbc:PostalZone>Badger999</cbc:PostalZone>
26
+ <cbc:CountrySubentity></cbc:CountrySubentity>
27
+ <cac:Country>
28
+ <cbc:IdentificationCode>GB</cbc:IdentificationCode>
29
+ <cbc:Name>England</cbc:Name>
30
+ </cac:Country>
31
+ </cac:PostalAddress>
32
+ <cac:PartyTaxScheme>
33
+ <cbc:CompanyID>123456789</cbc:CompanyID>
34
+ <cac:TaxScheme>
35
+ <cbc:ID>VAT</cbc:ID>
36
+ </cac:TaxScheme>
37
+ </cac:PartyTaxScheme>
38
+ <cac:Contact>
39
+ <cbc:Name>Mr B. Badger</cbc:Name>
40
+ </cac:Contact>
41
+ </cac:Party>
42
+ </cac:AccountingSupplierParty>
43
+ <cac:AccountingCustomerParty>
44
+ <cbc:SupplierAssignedAccountID>2</cbc:SupplierAssignedAccountID>
45
+ <cac:Party>
46
+ <cac:PartyName>
47
+ <cbc:Name>Lovely Customer Inc.</cbc:Name>
48
+ </cac:PartyName>
49
+ <cac:PostalAddress>
50
+ <cbc:StreetName>The pasture</cbc:StreetName>
51
+ <cbc:CityName>Mootown</cbc:CityName>
52
+ <cbc:PostalZone>MOOO</cbc:PostalZone>
53
+ <cbc:CountrySubentity>Cow Kingdom</cbc:CountrySubentity>
54
+ <cac:Country>
55
+ <cbc:IdentificationCode>GB</cbc:IdentificationCode>
56
+ <cbc:Name>Scotland</cbc:Name>
57
+ </cac:Country>
58
+ </cac:PostalAddress>
59
+ <cac:PartyTaxScheme>
60
+ <cbc:CompanyID>987654321</cbc:CompanyID>
61
+ <cac:TaxScheme>
62
+ <cbc:ID>VAT</cbc:ID>
63
+ </cac:TaxScheme>
64
+ </cac:PartyTaxScheme>
65
+ <cac:Contact>
66
+ <cbc:Name>Fred</cbc:Name>
67
+ </cac:Contact>
68
+ </cac:Party>
69
+ </cac:AccountingCustomerParty>
70
+ <cac:PaymentTerms>
71
+ <cac:SettlementPeriod>
72
+ <cbc:StartDate>2008-06-30</cbc:StartDate>
73
+ <cbc:StartTime>00:00:00+00:00</cbc:StartTime>
74
+ <cbc:EndDate>2008-07-30</cbc:EndDate>
75
+ <cbc:EndTime>00:00:00+00:00</cbc:EndTime>
76
+ </cac:SettlementPeriod>
77
+ </cac:PaymentTerms>
78
+ <cac:TaxTotal>
79
+ <cbc:TaxAmount currencyID="GBP">15.0</cbc:TaxAmount>
80
+ </cac:TaxTotal>
81
+ <cac:LegalMonetaryTotal>
82
+ <cbc:TaxExclusiveAmount currencyID="GBP">300.0</cbc:TaxExclusiveAmount>
83
+ <cbc:PayableAmount currencyID="GBP">315.0</cbc:PayableAmount>
84
+ </cac:LegalMonetaryTotal>
85
+ <cac:InvoiceLine>
86
+ <cbc:ID>2</cbc:ID>
87
+ <cbc:UUID>0cc65e20-cfac-012b-481d-0017f22d32c0</cbc:UUID>
88
+ <cbc:InvoicedQuantity>4.0</cbc:InvoicedQuantity>
89
+ <cbc:LineExtensionAmount currencyID="GBP">200.0</cbc:LineExtensionAmount>
90
+ <cbc:TaxPointDate>2008-06-25</cbc:TaxPointDate>
91
+ <cac:TaxTotal>
92
+ <cbc:TaxAmount currencyID="GBP">0.0</cbc:TaxAmount>
93
+ </cac:TaxTotal>
94
+ <cac:Item>
95
+ <cbc:Description>this is the SubLineItem</cbc:Description>
96
+ </cac:Item>
97
+ </cac:InvoiceLine>
98
+ <cac:InvoiceLine>
99
+ <cbc:ID>1</cbc:ID>
100
+ <cbc:UUID>0cc659f0-cfac-012b-481d-0017f22d32c0</cbc:UUID>
101
+ <cbc:InvoicedQuantity>1.0</cbc:InvoicedQuantity>
102
+ <cbc:LineExtensionAmount currencyID="GBP">100.0</cbc:LineExtensionAmount>
103
+ <cbc:TaxPointDate>2008-06-30</cbc:TaxPointDate>
104
+ <cac:TaxTotal>
105
+ <cbc:TaxAmount currencyID="GBP">15.0</cbc:TaxAmount>
106
+ </cac:TaxTotal>
107
+ <cac:Item>
108
+ <cbc:Description>moo</cbc:Description>
109
+ </cac:Item>
110
+ </cac:InvoiceLine>
111
+ </ubl:Invoice>