acts_as_isdoc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,42 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'active_record'
3
+ class BasicInvoice < ActiveRecord::Base
4
+ acts_as_isdoc :document_type=>"1",
5
+ :paid_deposits_amount => "300",
6
+ :local_currency_code=>"CZK",
7
+ :issue_date => "2009-07-01",
8
+ :tax_amount => "0",
9
+ :tax_exclusive_amount => "0",
10
+ :tax_inclusive_amount => "0",
11
+ :already_claimed_tax_exclusive_amount => "0",
12
+ :already_claimed_tax_inclusive_amount => "0",
13
+ :difference_tax_exclusive_amount => "0",
14
+ :difference_tax_inclusive_amount => "0",
15
+ :payable_amount => "0",
16
+ :document_id => "1234",
17
+ :document_uuid => "2D6D6400-D922-4DF5-8A76-EB68350B02AF"
18
+
19
+ def id
20
+ 1
21
+ end
22
+
23
+ def external_order_id
24
+ "ABC1234"
25
+ end
26
+
27
+ def seller_details
28
+ { :name => "Pepicek", :street=>"Ulicni", :building_number=>"230/9", :city => "Praha", :postal_code => "17000", :country_code=>"cz", :country=>"Czech Republic", :tax_number=>"CZ12345678" }
29
+ end
30
+
31
+ def customer_details
32
+ { :name => "Frantisek" }
33
+ end
34
+
35
+ def invoice_lines
36
+ [ {:line_extension_amount=>0, :line_extension_amount_tax_inclusive=>0, :line_extension_tax_amount=>0, :unit_price=>0, :unit_price_tax_inclusive=>0, :tax_percent=>0, :vat_calculation_method=>0} ]
37
+ end
38
+
39
+ def tax_sub_totals
40
+ [ {:taxable_amount=>0, :tax_inclusive_amount=>0, :tax_amount => 0, :already_claimed_taxable_amount => 0, :already_claimed_tax_amount => 0, :already_claimed_tax_inclusive_amount => 0, :difference_taxable_amount => 0, :difference_tax_amount => 0, :difference_tax_inclusive_amount => 0, :tax_percent => 0 } ]
41
+ end
42
+ end
@@ -0,0 +1,111 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Invoice xmlns="http://isdoc.cz/namespace/invoice" version="5.2">
3
+ <DocumentType>1</DocumentType>
4
+ <ID>1234</ID>
5
+ <UUID>2D6D6400-D922-4DF5-8A76-EB68350B02AF</UUID>
6
+ <IssueDate>2009-07-01</IssueDate>
7
+ <OrderReferences>
8
+ <OrderReference>
9
+ <SalesOrderID/>
10
+ <ExternalOrderID>ABC1234</ExternalOrderID>
11
+ <IssueDate>2009-07-01</IssueDate>
12
+ </OrderReference>
13
+ </OrderReferences>
14
+ <LocalCurrencyCode>CZK</LocalCurrencyCode>
15
+ <CurrRate>1</CurrRate>
16
+ <RefCurrRate>1</RefCurrRate>
17
+ <AccountingSupplierParty>
18
+ <Party>
19
+ <PartyIdentification>
20
+ <ID></ID>
21
+ </PartyIdentification>
22
+ <PartyName>
23
+ <Name>Pepicek</Name>
24
+ </PartyName>
25
+ <PostalAddress>
26
+ <StreetName>Ulicni</StreetName>
27
+ <BuildingNumber>230/9</BuildingNumber>
28
+ <CityName>Praha</CityName>
29
+ <PostalZone>17000</PostalZone>
30
+ <Country>
31
+ <IdentificationCode>cz</IdentificationCode>
32
+ <Name>Czech Republic</Name>
33
+ </Country>
34
+ </PostalAddress>
35
+ <PartyTaxScheme>
36
+ <CompanyID>CZ12345678</CompanyID>
37
+ <TaxScheme>VAT</TaxScheme>
38
+ </PartyTaxScheme>
39
+ </Party>
40
+ </AccountingSupplierParty>
41
+ <AccountingCustomerParty>
42
+ <Party>
43
+ <PartyIdentification>
44
+ <ID></ID>
45
+ </PartyIdentification>
46
+ <PartyName>
47
+ <Name>Frantisek</Name>
48
+ </PartyName>
49
+ <PostalAddress>
50
+ <StreetName></StreetName>
51
+ <BuildingNumber></BuildingNumber>
52
+ <CityName></CityName>
53
+ <PostalZone></PostalZone>
54
+ <Country>
55
+ <IdentificationCode></IdentificationCode>
56
+ <Name></Name>
57
+ </Country>
58
+ </PostalAddress>
59
+ </Party>
60
+ </AccountingCustomerParty>
61
+ <InvoiceLines>
62
+ <InvoiceLine>
63
+ <ID>1</ID>
64
+ <LineExtensionAmount>0</LineExtensionAmount>
65
+ <LineExtensionAmountTaxInclusive>0</LineExtensionAmountTaxInclusive>
66
+ <LineExtensionTaxAmount>0</LineExtensionTaxAmount>
67
+ <UnitPrice>0</UnitPrice>
68
+ <UnitPriceTaxInclusive>0</UnitPriceTaxInclusive>
69
+ <ClassifiedTaxCategory>
70
+ <Percent>0</Percent>
71
+ <VATCalculationMethod>0</VATCalculationMethod>
72
+ </ClassifiedTaxCategory>
73
+ <Item>
74
+ </Item>
75
+ <Extensions>
76
+ <Domains xmlns="http://www.xnet.cz/xml/isdoc/domain-1.0">
77
+ <Name>fqdn.cz</Name>
78
+ <Since>2009-01-01</Since>
79
+ <Till>2010-01-01</Till>
80
+ </Domains>
81
+ </Extensions>
82
+ </InvoiceLine>
83
+ </InvoiceLines>
84
+ <TaxTotal>
85
+ <TaxSubTotal>
86
+ <TaxableAmount>0</TaxableAmount>
87
+ <TaxInclusiveAmount>0</TaxInclusiveAmount>
88
+ <TaxAmount>0</TaxAmount>
89
+ <AlreadyClaimedTaxableAmount>0</AlreadyClaimedTaxableAmount>
90
+ <AlreadyClaimedTaxAmount>0</AlreadyClaimedTaxAmount>
91
+ <AlreadyClaimedTaxInclusiveAmount>0</AlreadyClaimedTaxInclusiveAmount>
92
+ <DifferenceTaxableAmount>0</DifferenceTaxableAmount>
93
+ <DifferenceTaxAmount>0</DifferenceTaxAmount>
94
+ <DifferenceTaxInclusiveAmount>0</DifferenceTaxInclusiveAmount>
95
+ <TaxCategory>
96
+ <Percent>0</Percent>
97
+ </TaxCategory>
98
+ </TaxSubTotal>
99
+ <TaxAmount>0</TaxAmount>
100
+ </TaxTotal>
101
+ <LegalMonetaryTotal>
102
+ <TaxExclusiveAmount>0</TaxExclusiveAmount>
103
+ <TaxInclusiveAmount>0</TaxInclusiveAmount>
104
+ <AlreadyClaimedTaxExclusiveAmount>0</AlreadyClaimedTaxExclusiveAmount>
105
+ <AlreadyClaimedTaxInclusiveAmount>0</AlreadyClaimedTaxInclusiveAmount>
106
+ <DifferenceTaxExclusiveAmount>0</DifferenceTaxExclusiveAmount>
107
+ <DifferenceTaxInclusiveAmount>0</DifferenceTaxInclusiveAmount>
108
+ <PaidDepositsAmount>300</PaidDepositsAmount>
109
+ <PayableAmount>0</PayableAmount>
110
+ </LegalMonetaryTotal>
111
+ </Invoice>
@@ -0,0 +1,12 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class ExtendedInvoice < BasicInvoice
3
+ def draw_invoice_line_extensions(invoice_line, item)
4
+ invoice_line.tag! :Extensions do |extensions|
5
+ extensions.tag! :Domains, :xmlns=>"http://www.xnet.cz/xml/isdoc/domain-1.0" do |domain|
6
+ domain.tag! :Name, "fqdn.cz"
7
+ domain.tag! :Since, "2009-01-01"
8
+ domain.tag! :Till, "2010-01-01"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,196 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Invoice xmlns="http://isdoc.cz/namespace/invoice" version="5.2">
3
+ <DocumentType>1</DocumentType>
4
+ <ID>123</ID>
5
+ <UUID>2D6D6400-D922-4DF5-8A76-EB68350B02AF</UUID>
6
+ <IssueDate>2000-01-01</IssueDate>
7
+ <TaxPointDate>1970-01-01</TaxPointDate>
8
+ <Note>Poznamka</Note>
9
+ <LocalCurrencyCode>CZK</LocalCurrencyCode>
10
+ <CurrRate>1</CurrRate>
11
+ <RefCurrRate>1</RefCurrRate>
12
+ <AccountingSupplierParty>
13
+ <Party>
14
+ <PartyIdentification>
15
+ <ID>12345678</ID>
16
+ </PartyIdentification>
17
+ <PartyName>
18
+ <Name>Pepicek</Name>
19
+ </PartyName>
20
+ <PostalAddress>
21
+ <StreetName>Ulicni</StreetName>
22
+ <BuildingNumber>230/9</BuildingNumber>
23
+ <CityName>Praha</CityName>
24
+ <PostalZone>17000</PostalZone>
25
+ <Country>
26
+ <IdentificationCode>cz</IdentificationCode>
27
+ <Name>Czech Republic</Name>
28
+ </Country>
29
+ </PostalAddress>
30
+ <PartyTaxScheme>
31
+ <CompanyID>CZ12345678</CompanyID>
32
+ <TaxScheme>VAT</TaxScheme>
33
+ </PartyTaxScheme>
34
+ <RegisterIdentification>
35
+ <RegisterKeptAt>Mestsky soud v Praze</RegisterKeptAt>
36
+ <RegisterFileRef>C123456</RegisterFileRef>
37
+ <RegisterDate>2001-01-01</RegisterDate>
38
+ </RegisterIdentification>
39
+ </Party>
40
+ </AccountingSupplierParty>
41
+ <SellerSupplierParty>
42
+ <Party>
43
+ <PartyIdentification>
44
+ <ID></ID>
45
+ </PartyIdentification>
46
+ <PartyName>
47
+ <Name>Pepicek</Name>
48
+ </PartyName>
49
+ <PostalAddress>
50
+ <StreetName>Ulicni</StreetName>
51
+ <BuildingNumber>230/9</BuildingNumber>
52
+ <CityName>Praha</CityName>
53
+ <PostalZone>17000</PostalZone>
54
+ <Country>
55
+ <IdentificationCode>cz</IdentificationCode>
56
+ <Name>Czech Republic</Name>
57
+ </Country>
58
+ </PostalAddress>
59
+ <PartyTaxScheme>
60
+ <CompanyID>CZ12345678</CompanyID>
61
+ <TaxScheme>VAT</TaxScheme>
62
+ </PartyTaxScheme>
63
+ </Party>
64
+ </SellerSupplierParty>
65
+ <AccountingCustomerParty>
66
+ <Party>
67
+ <PartyIdentification>
68
+ <UserID>54321</UserID>
69
+ <ID></ID>
70
+ </PartyIdentification>
71
+ <PartyName>
72
+ <Name>Frantisek</Name>
73
+ </PartyName>
74
+ <PostalAddress>
75
+ <StreetName></StreetName>
76
+ <BuildingNumber></BuildingNumber>
77
+ <CityName></CityName>
78
+ <PostalZone></PostalZone>
79
+ <Country>
80
+ <IdentificationCode></IdentificationCode>
81
+ <Name></Name>
82
+ </Country>
83
+ </PostalAddress>
84
+ </Party>
85
+ </AccountingCustomerParty>
86
+ <BuyerCustomerParty>
87
+ <Party>
88
+ <PartyIdentification>
89
+ <ID></ID>
90
+ </PartyIdentification>
91
+ <PartyName>
92
+ <Name>Frantisek</Name>
93
+ </PartyName>
94
+ <PostalAddress>
95
+ <StreetName></StreetName>
96
+ <BuildingNumber></BuildingNumber>
97
+ <CityName></CityName>
98
+ <PostalZone></PostalZone>
99
+ <Country>
100
+ <IdentificationCode></IdentificationCode>
101
+ <Name></Name>
102
+ </Country>
103
+ </PostalAddress>
104
+ </Party>
105
+ </BuyerCustomerParty>
106
+ <InvoiceLines>
107
+ <InvoiceLine>
108
+ <ID>1</ID>
109
+ <LineExtensionAmount>0</LineExtensionAmount>
110
+ <LineExtensionAmountTaxInclusive>0</LineExtensionAmountTaxInclusive>
111
+ <LineExtensionTaxAmount>0</LineExtensionTaxAmount>
112
+ <UnitPrice>0</UnitPrice>
113
+ <UnitPriceTaxInclusive>0</UnitPriceTaxInclusive>
114
+ <ClassifiedTaxCategory>
115
+ <Percent>19</Percent>
116
+ <VATCalculationMethod>0</VATCalculationMethod>
117
+ </ClassifiedTaxCategory>
118
+ <Item>
119
+ <Description>First item</Description>
120
+ <SellersItemIdentification>
121
+ <ID>ABC-123</ID>
122
+ </SellersItemIdentification>
123
+ </Item>
124
+ </InvoiceLine>
125
+ </InvoiceLines>
126
+ <NonTaxedDeposits>
127
+ <NonTaxedDeposit>
128
+ <ID>1234</ID>
129
+ <VariableSymbol>1234</VariableSymbol>
130
+ <DepositAmount>300</DepositAmount>
131
+ </NonTaxedDeposit>
132
+ </NonTaxedDeposits>
133
+ <TaxedDeposits>
134
+ <TaxedDeposit>
135
+ <ID>1234</ID>
136
+ <VariableSymbol>1234</VariableSymbol>
137
+ <TaxableDepositAmount>100</TaxableDepositAmount>
138
+ <TaxInclusiveDepositAmount>119</TaxInclusiveDepositAmount>
139
+ <ClassifiedTaxCategory>
140
+ <Percent>19</Percent>
141
+ <VATCalculationMethod>0</VATCalculationMethod>
142
+ </ClassifiedTaxCategory>
143
+ </TaxedDeposit>
144
+ </TaxedDeposits>
145
+ <TaxTotal>
146
+ <TaxSubTotal>
147
+ <TaxableAmount>0</TaxableAmount>
148
+ <TaxInclusiveAmount>0</TaxInclusiveAmount>
149
+ <TaxAmount>0</TaxAmount>
150
+ <AlreadyClaimedTaxableAmount>0</AlreadyClaimedTaxableAmount>
151
+ <AlreadyClaimedTaxAmount>0</AlreadyClaimedTaxAmount>
152
+ <AlreadyClaimedTaxInclusiveAmount>0</AlreadyClaimedTaxInclusiveAmount>
153
+ <DifferenceTaxableAmount>0</DifferenceTaxableAmount>
154
+ <DifferenceTaxAmount>0</DifferenceTaxAmount>
155
+ <DifferenceTaxInclusiveAmount>0</DifferenceTaxInclusiveAmount>
156
+ <TaxCategory>
157
+ <Percent>19</Percent>
158
+ </TaxCategory>
159
+ </TaxSubTotal>
160
+ <TaxAmount>0</TaxAmount>
161
+ </TaxTotal>
162
+ <LegalMonetaryTotal>
163
+ <TaxExclusiveAmount>0</TaxExclusiveAmount>
164
+ <TaxInclusiveAmount>0</TaxInclusiveAmount>
165
+ <AlreadyClaimedTaxExclusiveAmount>0</AlreadyClaimedTaxExclusiveAmount>
166
+ <AlreadyClaimedTaxInclusiveAmount>0</AlreadyClaimedTaxInclusiveAmount>
167
+ <DifferenceTaxExclusiveAmount>0</DifferenceTaxExclusiveAmount>
168
+ <DifferenceTaxInclusiveAmount>0</DifferenceTaxInclusiveAmount>
169
+ <PaidDepositsAmount>300</PaidDepositsAmount>
170
+ <PayableAmount>0</PayableAmount>
171
+ </LegalMonetaryTotal>
172
+ <PaymentMeans>
173
+ <Payment>
174
+ <PaidAmount>100</PaidAmount>
175
+ <PaymentMeansCode>42</PaymentMeansCode>
176
+ <Details>
177
+ <PaymentDueDate>2006-01-01</PaymentDueDate>
178
+ <ID></ID>
179
+ <BankCode>5500</BankCode>
180
+ <Name></Name>
181
+ <IBAN></IBAN>
182
+ <BIC></BIC>
183
+ <VariableSymbol>12345678</VariableSymbol>
184
+ </Details>
185
+ </Payment>
186
+ <AlternateBankAccounts>
187
+ <AlternateBankAccount>
188
+ <ID></ID>
189
+ <BankCode>192</BankCode>
190
+ <Name></Name>
191
+ <IBAN></IBAN>
192
+ <BIC></BIC>
193
+ </AlternateBankAccount>
194
+ </AlternateBankAccounts>
195
+ </PaymentMeans>
196
+ </Invoice>
@@ -0,0 +1,105 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'active_record'
3
+ require 'acts_as_isdoc'
4
+ class SampleInvoice < ActiveRecord::Base
5
+ acts_as_isdoc :document_type=>"1",
6
+ :paid_deposits_amount => :paid_deposits,
7
+ :local_currency_code=>"CZK",
8
+ :issue_date => :issued_on,
9
+ :document_id => :id,
10
+ :document_uuid => "2D6D6400-D922-4DF5-8A76-EB68350B02AF",
11
+ :tax_point_date => "1970-01-01",
12
+ :note => "Poznamka"
13
+
14
+ def id
15
+ 123
16
+ end
17
+
18
+ def issued_on
19
+ "2000-01-01"
20
+ end
21
+
22
+ def paid_deposits
23
+ 300
24
+ end
25
+
26
+ def seller_details
27
+ { :company_id=>"12345678", :name => "Pepicek", :street=>"Ulicni", :building_number=>"230/9", :city => "Praha", :postal_code => "17000", :country_code=>"cz", :country=>"Czech Republic", :tax_number=>"CZ12345678", :register_kept_at=>"Mestsky soud v Praze", :register_file_ref=>"C123456", :register_date=>"2001-01-01" }
28
+ end
29
+
30
+ def sender_details
31
+ { :name => "Pepicek", :street=>"Ulicni", :building_number=>"230/9", :city => "Praha", :postal_code => "17000", :country_code=>"cz", :country=>"Czech Republic", :tax_number=>"CZ12345678" }
32
+ end
33
+
34
+ def customer_details
35
+ { :name => "Frantisek", :user_id=>"54321" }
36
+ end
37
+
38
+ def recipient_details
39
+ { :name => "Frantisek" }
40
+ end
41
+
42
+ def invoice_lines
43
+ [
44
+ {:line_extension_amount=>0, :line_extension_amount_tax_inclusive=>0, :line_extension_tax_amount=>0, :unit_price=>0, :unit_price_tax_inclusive=>0, :tax_percent=>19, :vat_calculation_method=>0, :description=>"First item", :sellers_item_identification => "ABC-123", }
45
+ ]
46
+ end
47
+
48
+ def tax_exclusive_amount
49
+ 0
50
+ end
51
+
52
+ def tax_inclusive_amount
53
+ 0
54
+ end
55
+
56
+ def already_claimed_tax_exclusive_amount
57
+ 0
58
+ end
59
+
60
+ def already_claimed_tax_inclusive_amount
61
+ 0
62
+ end
63
+
64
+ def difference_tax_exclusive_amount
65
+ 0
66
+ end
67
+
68
+ def difference_tax_inclusive_amount
69
+ 0
70
+ end
71
+
72
+ def payable_amount
73
+ 0
74
+ end
75
+
76
+ def tax_amount
77
+ 0
78
+ end
79
+
80
+ def tax_sub_totals
81
+ [
82
+ {:taxable_amount=>0, :tax_inclusive_amount=>0, :tax_amount => 0, :already_claimed_taxable_amount => 0, :already_claimed_tax_amount => 0, :already_claimed_tax_inclusive_amount => 0, :difference_taxable_amount => 0, :difference_tax_amount => 0, :difference_tax_inclusive_amount => 0, :tax_percent => 19 }
83
+ ]
84
+ end
85
+
86
+ def payment_means_detail
87
+ {:paid_amount=>100, :payments_mean_code=>42, :bank_code=>5500, :payment_due_date=>"2006-01-01",
88
+ :variable_symbol=>"12345678",
89
+ :alternate_bank_accounts=>[{:bank_code=>0300}]
90
+ }
91
+ end
92
+
93
+ def non_taxed_deposits
94
+ [
95
+ {:id=>"1234", :variable_symbol=>"1234", :deposit_amount=>300}
96
+ ]
97
+ end
98
+
99
+ def taxed_deposits
100
+ [
101
+ {:id=>"1234", :variable_symbol=>"1234", :taxable_deposit_amount=>100, :tax_inclusive_deposit_amount=>119, :tax_percent=>19, :vat_calculation_method=>0 }
102
+ ]
103
+ end
104
+
105
+ end