OSDN Git Service

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