关于「代购流水的科目设计:每个科目一套四柱,七条每日不变量」,《四柱复式守恒代数》给出的定量结论是什么?
结论:这张表把第一章的示意日按科目展开。每一行都是一套四柱:旧管、借方(新收)、贷方(开除)、实在。以现金为例,旧管 15,000.00 元,借方 2,850.00 元,贷方 3,116.00 元,实在 14,734.00 元,与第一章现金四柱的结果完全相同。存货旧管 4,200.00 元,采购借入 2,748.60 元,交付转出 1,700.00 元,实在 5,248.60 元。
数据口径:本书用可运行的程序说明,单式流水本身不含任何检验:在一个示意日上漏记一笔 1,500.00 元的尾款,表格依旧自洽,只有拿银行余额来比才出现差额。 书中参数为示意;全部计算由书中程序生成;本书属于非个人化的会计、税务或法律建议。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 与结论吻合的打印值: 14734.00, 15000.00, 1700.00, 2748.60, 2850.00, 3116.00
| account | old | debit(in) | credit(out) | now |
|---|---|---|---|---|
| CASH | 15,000.00 | 2,850.00 | 3,116.00 | 14,734.00 |
| STOCK | 4,200.00 | 2,748.60 | 1,700.00 | 5,248.60 |
| AR | 0.00 | 1,500.00 | 1,500.00 | 0.00 |
| DEP | -3,800.00 | 1,000.00 | 1,350.00 | -4,150.00 |
| REV | 0.00 | 0.00 | 2,300.00 | -2,300.00 |
| COGS | 0.00 | 1,700.00 | 0.00 | 1,700.00 |
| FX | 0.00 | 12.40 | 0.00 | 12.40 |
| SHIP | 0.00 | 155.00 | 0.00 | 155.00 |
| CAP | -15,400.00 | 0.00 | 0.00 | -15,400.00 |
| total | 0.00 | 9,966.00 | 9,966.00 | 0.00 |
| every row: old + in = out + now; debits = credits = 9,966.00 | ||||
| closing balances add to 0.00 (trial balance) |
查看完整验算程序
# Chapter 5. p51: double entry is four pillars kept for every account.
# Model: the buying agent's day of p12 (deposits, a delivery with its
# balance payment, purchases abroad with an exchange difference,
# freight and a refund). For each account the four pillars are
# opening (old), debits (new in), credits (out) and closing (now):
# old + debits = credits + now holds row by row. Summed over accounts,
# the closing column adds to zero: that is the trial balance. Amounts
# are illustrative integer fen, printed in yuan; arithmetic is exact.
ACCTS = ("CASH", "STOCK", "AR", "DEP", "REV", "COGS", "FX", "SHIP",
"CAP")
OPEN = {"CASH": 1500000, "STOCK": 420000, "AR": 0, "DEP": -380000,
"REV": 0, "COGS": 0, "FX": 0, "SHIP": 0, "CAP": -1540000}
DAY = (
(("CASH", 60000), ("DEP", -60000)),
(("CASH", 45000), ("DEP", -45000)),
(("STOCK", 178560), ("CASH", -178560)),
(("FX", 1240), ("CASH", -1240)),
(("SHIP", 12000), ("CASH", -12000)),
(("DEP", 80000), ("AR", 150000), ("REV", -230000)),
(("COGS", 170000), ("STOCK", -170000)),
(("CASH", 150000), ("AR", -150000)),
(("DEP", 20000), ("CASH", -20000)),
(("STOCK", 96300), ("CASH", -96300)),
(("SHIP", 3500), ("CASH", -3500)),
(("CASH", 30000), ("DEP", -30000)),
)
def yuan(fen):
sign = "-" if fen < 0 else ""
fen = abs(fen)
return "{}{:,}.{:02d}".format(sign, fen // 100, fen % 100)
def four_pillars():
dr = dict.fromkeys(ACCTS, 0)
cr = dict.fromkeys(ACCTS, 0)
for legs in DAY:
for a, m in legs:
if m > 0:
dr[a] += m
else:
cr[a] += -m
rows = []
for a in ACCTS:
now = OPEN[a] + dr[a] - cr[a]
rows.append((a, OPEN[a], dr[a], cr[a], now))
return rows
if __name__ == "__main__":
rows = four_pillars()
print("account old debit(in) credit(out) now")
tot = [0, 0, 0, 0]
for a, old, d, c, now in rows:
assert old + d == c + now
for k, v in enumerate((old, d, c, now)):
tot[k] += v
print("{:6s} {:>12s} {:>12s} {:>12s} {:>13s}".format(
a, yuan(old), yuan(d), yuan(c), yuan(now)))
print("{:6s} {:>12s} {:>12s} {:>12s} {:>13s}".format(
"total", yuan(tot[0]), yuan(tot[1]), yuan(tot[2]), yuan(tot[3])))
print("every row: old + in = out + now; debits = credits = {}".format(
yuan(tot[1])))
print("closing balances add to {} (trial balance)".format(yuan(tot[3])))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《四柱结算与复式记账的守恒代数、代购流水零差错对账不变量母典》第 5 章「代购流水的科目设计:每个科目一套四柱,七条每日不变量」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-318 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026318,
author = {Fan, Yafu},
title = {The Conservation Algebra of Four-Pillar Settlement and Double-Entry Bookkeeping: Invariants for Error-Free Reconciliation of Buying-Agent Ledgers},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}