OSDN Git Service

Regular updates
[twpd/master.git] / ledger-format.md
1 ---
2 title: Ledger format
3 category: Ledger
4 ---
5
6 ```
7 2015/01/01 Pay rent
8   Assets:Savings     -$300
9   Expenses:Rent
10 ```
11
12 ### First line
13
14 ```
15 2015/01/01 *       Pay rent       ; tagname:
16 ^          ^       ^
17 Date       Flag    Description    ^ comment/tag
18 ```
19
20 ### Balance assertion
21
22 ```
23 2015/01/01 Pay rent
24   Assets:Savings     -$300 = $1200  ; assert there's $1200 left after
25   Expenses:Rent
26 ```
27 Flags:
28
29 ```
30 * cleared
31 ! pending
32 ```
33
34 ## Accounts
35 Only relevant with `--strict` or `--pedantic`
36
37 ```
38 account Expenses:Food
39     note This account is all about the chicken!
40     alias food
41     payee ^(KFC|Popeyes)$
42     check commodity == "$"
43     assert commodity == "$"
44     eval print("Hello!")
45     default
46 ```
47
48 ## Others
49
50 ```
51 D $1,000.00     ; set default commodity
52
53 alias Cash = Assets:Cash
54
55 Y2015           ; set default year (you can use 01/25 as date after)
56 ```
57
58 ### Prefix all transactions with an account
59
60 ```
61 account Home
62 include home.journal
63 end
64 ```