Cheat Sheet速查表
跳转到主要内容

Ledger 格式 速查表

本文根据 Devhints / Ledger format 翻译。代码示例及版本范围沿用原文。

示例

2015/01/01 Pay rent
  Assets:Savings     -$300
  Expenses:Rent

第一行

2015/01/01 *       Pay rent       ; tagname:
^          ^       ^
Date       Flag    Description    ^ comment/tag

余额断言

2015/01/01 Pay rent
  Assets:Savings     -$300 = $1200  ; assert there's $1200 left after
  Expenses:Rent

标记 (Flags):

* cleared
! pending

账户

账户

仅在以下情况下有效: --strict 或 --pedantic

account Expenses:Food
    note This account is all about the chicken!
    alias food
    payee ^(KFC|Popeyes)$
    check commodity == "$"
    assert commodity == "$"
    eval print("Hello!")
    default

其他

其他

D $1,000.00     ; set default commodity

alias Cash = Assets:Cash

Y2015           ; set default year (you can use 01/25 as date after)

为所有交易添加账户前缀

account Home
include home.journal
end