Skip to content

Instantly share code, notes, and snippets.

@e7h4n
Created November 3, 2023 02:49
Show Gist options
  • Save e7h4n/23638cb9ac061964d26e82a461a15c31 to your computer and use it in GitHub Desktop.
Save e7h4n/23638cb9ac061964d26e82a461a15c31 to your computer and use it in GitHub Desktop.
管理 Beancount 的 Receivables 账户

基本规则

  • Receivable 账户意味着别人应该给你钱,比如购物退货之后等待退款、借给别人钱等等。例如
2023-10-31 * "淘宝" “[退货] 表带"
    Liabilities:CreditCard:CMB                                 -83.00 CNY
    Assets:Receivables
  • 当钱款收到时,再记录一笔交易扣掉 Receivables 中的余额
2023-11-01 * "淘宝" “[退款] 表带"
    Liabilities:CreditCard:CMB                                  83.00 CNY
    Assets:Receivables
  • 完整的一进一出交易类似于
2023-10-31 * "淘宝" “[退货] 表带"
    Liabilities:CreditCard:CMB                                 -83.00 CNY
    Assets:Receivables

2023-11-01 * "淘宝" “[退款] 表带"
    Liabilities:CreditCard:CMB                                  83.00 CNY
    Assets:Receivables
  • 如果还没收到退款,那么我会用 #UNRESOLVED tag 来标记这笔交易
2023-10-31 * “张三” “借钱” #UNRESOLVED
    Liabilities:CreditCard:CMB                                 -100.00 CNY
    Assets:Receivables
  • 我只要关注 #UNRESOLVED 交易,就可以知道别人欠了我哪些钱
  • 任何时候,账本中 Assets:Receivables 账户下,不带 #UNRESOLVED 标签的所有交易之和,应该归零。例如这样是一个合法的账单
2023-10-31 * "淘宝" “[退货] 表带"
    Liabilities:CreditCard:CMB                                 -83.00 CNY
    Assets:Receivables

2023-11-01 * "淘宝" “[退款] 表带"
    Liabilities:CreditCard:CMB                                  83.00 CNY
    Assets:Receivables

2023-10-31 * “张三” “借钱” #UNRESOLVED
    Liabilities:CreditCard:CMB                                 -100.00 CNY
    Assets:Receivables

下面这个不合法

2023-10-31 * "淘宝" “[退货] 表带"
    Liabilities:CreditCard:CMB                                 -83.00 CNY
    Assets:Receivables

2023-11-01 * "淘宝" “[退款] 表带"
    Liabilities:CreditCard:CMB                                  83.00 CNY
    Assets:Receivables

2023-10-31 * “张三” “借钱”
    Liabilities:CreditCard:CMB                                 -100.00 CNY ; 这比交易导致 Receivables 账户没有归零,要给这比交易加上 #UNRESOLVED  标签
    Assets:Receivables

可以实现一个插件来自动化地检查出这种问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment