Debian Codegraph @

tests/directives.beancount

raw
1 ;----------------------------------------------------------------------
2 ; ledger2beancount conversion notes:
3 ;
4 ; - Automated or periodic transaction skipped
5 ; - Unsupported directive `i` skipped
6 ; - Unsupported directive `o` skipped
7 ; - Unsupported directive `I` skipped
8 ; - Unsupported directive `O` skipped
9 ; - Unsupported directive `b` skipped
10 ; - Unsupported directive `h` skipped
11 ; - Unsupported directive `C` skipped
12 ; - Unsupported directive `D` skipped
13 ; - Unsupported directive `N` skipped
14 ; - Unsupported directive `eval` skipped
15 ; - Directive `define` with function is not supported: myfunc_seven(s, d, t)
16 ; - Unsupported directive `value` skipped
17 ; - Directive `define` not supported by beancount: replacing foo with 200 USD
18 ; - Directive `define` not supported by beancount: replacing my_var with $5
19 ; - Directive `define` not supported by beancount: replacing hundred with $100
20 ; - Directive `define` not supported by beancount: replacing twenty with $20
21 ; - Directive `define` not supported by beancount: replacing thousand with $1000
22 ; - Collision for commodity USD: $, USD
23 ;----------------------------------------------------------------------
24
25 ; Beancount: 2.1.0
26 ; SPDX-FileCopyrightText: © 2018 Martin Michlmayr <[email protected]>
27 ;
28 ; SPDX-License-Identifier: GPL-3.0-or-later
29
30
31 1970-01-01 open Assets:Another:Alias
32 1970-01-01 open Assets:Checking
33 1970-01-01 open Assets:GG
34 1970-01-01 open Assets:Savings
35 1970-01-01 open Assets:Test
36 1970-01-01 open Assets:Test1:Test2:AA
37 1970-01-01 open Assets:Test1:Test2:Another:Alias
38 1970-01-01 open Assets:Test1:Test2:BB
39 1970-01-01 open Assets:Test1:Test2:CC:DD
40 1970-01-01 open Assets:Test1:Test2:EE:FF
41 1970-01-01 open Assets:Test1:Test2:XXX:AA
42 1970-01-01 open Assets:What:A:Long:Name
43 1970-01-01 open Equity:Opening-Balance
44
45 1970-01-01 commodity EUR
46 1970-01-01 commodity USD
47
48 ; = expr true
49 ; Assets:Foo 50.00 USD
50 ; Assets:Bar -50.00 USD
51
52 ; = /^(?:Income:|Expenses:(?:Business|Rent$|Furnishings|Taxes|Insurance))/
53 ; (Liabilities:Huququ'llah) 0.19
54
55 ; ~ Yearly
56 ; Expenses:Auto:Repair $500.00
57 ; Assets
58
59 ; payee KFC
60 ; alias KENTUCKY FRIED CHICKEN
61 ; uuid 2a2e21d434356f886c84371eebac6e44f1337fda
62
63 ; payee McD
64
65 ; payee Burger King
66
67 ; setting year 2014
68 ; (no space)
69
70 2014-10-02 * "Transaction without year"
71 Assets:Test 10.00 EUR
72 Equity:Opening-Balance -10.00 EUR
73
74 2014-10-02 * "Transaction without year, with aux date"
75 aux-date: 2014-10-01
76 Assets:Test 10.00 EUR
77 Equity:Opening-Balance -10.00 EUR
78
79 ; setting year 2015
80
81 2015-10-02 * "Transaction without year"
82 Assets:Test 10.00 EUR
83 Equity:Opening-Balance -10.00 EUR
84
85 2015-10-02 * "Transaction without year, with aux date"
86 aux-date: 2015-10-01
87 Assets:Test 10.00 EUR
88 Equity:Opening-Balance -10.00 EUR
89
90 ; setting year 2016
91
92 2016-10-02 * "Transaction without year"
93 Assets:Test 10.00 EUR
94 Equity:Opening-Balance -10.00 EUR
95
96 2016-10-02 * "Transaction without year, with aux date"
97 aux-date: 2016-10-01
98 Assets:Test 10.00 EUR
99 Equity:Opening-Balance -10.00 EUR
100
101 2018-03-25 * "Transaction with year"
102 Assets:Test 10.00 EUR
103 Equity:Opening-Balance -10.00 EUR
104
105 ; setting year 2018
106
107
108 2018-10-02 * "Transaction without year"
109 Assets:Test 10.00 EUR
110 Equity:Opening-Balance -10.00 EUR
111
112 2018-10-02 * "Transaction without year, with aux date"
113 aux-date: 2018-10-01
114 Assets:Test 10.00 EUR
115 Equity:Opening-Balance -10.00 EUR
116
117 2015-03-25 * "Transaction with year"
118 Assets:Test 10.00 EUR
119 Equity:Opening-Balance -10.00 EUR
120
121
122 ; apply year can be nested
123
124
125 2013-04-13 txn "Test apply year - 2013"
126 Assets:Test 10.00 EUR
127 Equity:Opening-Balance -10.00 EUR
128
129
130
131 2015-04-13 txn "Test apply year - 2015"
132 Assets:Test 10.00 EUR
133 Equity:Opening-Balance -10.00 EUR
134
135
136 2014-04-13 txn "Test apply year - 2014"
137 Assets:Test 10.00 EUR
138 Equity:Opening-Balance -10.00 EUR
139
140
141 2013-04-13 txn "Test apply year - 2013"
142 Assets:Test 10.00 EUR
143 Equity:Opening-Balance -10.00 EUR
144
145
146 2016-04-13 txn "Test year after apply year - should be back to last year directive: 2016"
147 Assets:Test 10.00 EUR
148 Equity:Opening-Balance -10.00 EUR
149
150 include "include1.beancount"
151 include "include2.beancount"
152 include "include3.beancount"
153
154 ; Test apply account and apply tag
155
156 pushtag #foo
157 pushtag #bar
158
159 2018-03-29 * "Test apply"
160 test: "martin"
161 ^2018-02-02-brussels-fosdem
162 Assets:Test1:Test2:AA 10.00 EUR
163 Assets:Test1:Test2:BB
164
165 2018-03-29 * "Test apply"
166 test: "martin"
167 ^2018-02-02-brussels-fosdem
168 Assets:Test1:Test2:CC:DD 10.00 EUR
169 Assets:Test1:Test2:EE:FF
170
171 poptag #bar
172 poptag #foo
173
174 ; Test apply account and alias
175
176
177 2018-03-29 * "Test apply"
178 Assets:Test1:Test2:AA 10.00 EUR
179 Assets:What:A:Long:Name
180
181
182 2018-03-29 * "Test apply"
183 Assets:Test1:Test2:XXX:AA 10.00 EUR
184 Assets:Test1:Test2:Another:Alias
185
186
187 2018-03-29 * "Test apply"
188 Assets:GG 10.00 EUR
189 Assets:Test1:Test2:Another:Alias
190
191
192 2018-03-29 * "Test apply"
193 Assets:GG 10.00 EUR
194 Assets:Another:Alias
195
196
197 2018-03-29 * "Bucket"
198 Assets:Test 10.00 EUR
199 Assets:Checking
200
201
202 2018-03-29 * "Bucket"
203 Assets:Test 10.00 EUR
204 Assets:Savings
205
206
207
208 ; timeclock
209 ; i 2018-03-29 14:10:20 B
210 ; o 2018-03-29 14:50:00
211 ; I 2018-03-29 14:55:40 B
212 ; O 2018-03-29 15:10:10
213 ; b 2018-03-29 14:10:20
214 ; h 2018-03-29 14:10:20
215 ; commodity conversion
216 ; C 1.00 Mb = 1024 Kb
217 ; Default Commodity
218 ; D 1000.00 EUR
219 ; Ignore pricing information
220 ; N EUR
221
222 ; import os
223
224 ; python
225 ; def print_type(val):
226 ; print(type(val), val)
227 ;
228 ; eval print_type(true)
229
230 ; python
231 ; def option_pyfirst(context):
232 ; print("In --pyfirst (from %s)" % context)
233 ;
234 ; def option_pysecond(context, val):
235 ; print("In --pysecond=%s (from %s)" % (val, context))
236 2019-04-28 * "Transactions can follow python without empty line"
237 Assets:Test 10.00 EUR
238 Equity:Opening-Balance -10.00 EUR
239
240 ; define myfunc_seven(s, d, t) = 7 EUR
241
242 ;; The 'value' directive sets the valuation used for all commodities used in
243 ;; the rest of the daat stream. This is the fallback, if nothing more
244 ;; specific is found.
245
246 ; value myfunc_seven
247
248
249 2020-06-27 txn "Using define"
250 Assets:Test 200 USD
251 Equity:Opening-Balance
252
253 2020-06-27 txn "Using define"
254 Assets:Test 5*4 USD
255 Equity:Opening-Balance
256
257 2020-06-27 txn "Using define"
258 Assets:Test 100*4 USD
259 Equity:Opening-Balance
260
261 2020-06-27 txn "Using multiple define"
262 Assets:Test 100*4 +20 USD
263 Equity:Opening-Balance
264
265 2020-06-27 txn "Using multiple define"
266 Assets:Test 1000 +100*4 +20 USD
267 Equity:Opening-Balance
268