{"id":141,"date":"2021-06-06T19:24:00","date_gmt":"2021-06-06T11:24:00","guid":{"rendered":"http:\/\/47.107.115.238\/?p=141"},"modified":"2024-09-25T15:39:27","modified_gmt":"2024-09-25T07:39:27","slug":"hledger%e5%a4%8d%e5%bc%8f%e8%ae%b0%e8%b4%a6","status":"publish","type":"post","link":"https:\/\/lxylp.com\/?p=141","title":{"rendered":"hledger\u590d\u5f0f\u8bb0\u8d26"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_69_1 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/lxylp.com\/?p=141\/#%E7%94%A8_hledger_%E6%9D%A5%E8%AE%B0%E8%B4%A6\" title=\"\u7528 hledger \u6765\u8bb0\u8d26\">\u7528 hledger \u6765\u8bb0\u8d26<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/lxylp.com\/?p=141\/#%E5%88%9D%E5%A7%8B%E5%8C%96\" title=\"\u521d\u59cb\u5316\">\u521d\u59cb\u5316<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/lxylp.com\/?p=141\/#%E5%BC%80%E5%A7%8B%E8%AE%B0%E8%B4%A6\" title=\"\u5f00\u59cb\u8bb0\u8d26\">\u5f00\u59cb\u8bb0\u8d26<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/lxylp.com\/?p=141\/#%E6%9F%A5%E7%9C%8B_balance\" title=\"\u67e5\u770b balance\">\u67e5\u770b balance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/lxylp.com\/?p=141\/#%E6%9F%A5%E7%9C%8B%E4%B8%80%E5%85%B1%E8%8A%B1%E8%B4%B9%E5%A4%9A%E5%B0%91%E9%92%B1\" title=\"\u67e5\u770b\u4e00\u5171\u82b1\u8d39\u591a\u5c11\u94b1\">\u67e5\u770b\u4e00\u5171\u82b1\u8d39\u591a\u5c11\u94b1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/lxylp.com\/?p=141\/#%E6%9F%A5%E7%9C%8B%E6%94%AF%E5%87%BA%E7%9A%84%E8%AF%A6%E7%BB%86%E4%BF%A1%E6%81%AF\" title=\"\u67e5\u770b\u652f\u51fa\u7684\u8be6\u7ec6\u4fe1\u606f\">\u67e5\u770b\u652f\u51fa\u7684\u8be6\u7ec6\u4fe1\u606f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/lxylp.com\/?p=141\/#%E6%9F%A5%E7%9C%8B_2020-07-01_%E8%87%B3%E4%BB%8A_%E6%89%80%E6%9C%89%E8%AF%A6%E6%83%85\" title=\"\u67e5\u770b 2020-07-01 \u81f3\u4eca \u6240\u6709\u8be6\u60c5\">\u67e5\u770b 2020-07-01 \u81f3\u4eca \u6240\u6709\u8be6\u60c5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/lxylp.com\/?p=141\/#%E4%BB%A5%E6%AF%8F%E6%9C%88%E4%B8%BA%E5%91%A8%E6%9C%9F%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E6%89%80%E6%9C%89%E6%94%AF%E6%94%B6%E6%83%85%E5%86%B5\" title=\"\u4ee5\u6bcf\u6708\u4e3a\u5468\u671f\u67e5\u770b\u8d26\u6237\u6240\u6709\u652f\u6536\u60c5\u51b5\">\u4ee5\u6bcf\u6708\u4e3a\u5468\u671f\u67e5\u770b\u8d26\u6237\u6240\u6709\u652f\u6536\u60c5\u51b5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/lxylp.com\/?p=141\/#%E4%BB%A5%E6%AF%8F%E6%9C%88%E4%B8%BA%E5%91%A8%E6%9C%9F%E6%9F%A5%E7%9C%8B_expenses_%E8%8A%B1%E8%B4%B9%E6%83%85%E5%86%B5\" title=\"\u4ee5\u6bcf\u6708\u4e3a\u5468\u671f\u67e5\u770b expenses \u82b1\u8d39\u60c5\u51b5\">\u4ee5\u6bcf\u6708\u4e3a\u5468\u671f\u67e5\u770b expenses \u82b1\u8d39\u60c5\u51b5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/lxylp.com\/?p=141\/#%E6%9F%A5%E7%9C%8B%E6%80%BB%E6%94%B6%E5%85%A5\" title=\"\u67e5\u770b\u603b\u6536\u5165\">\u67e5\u770b\u603b\u6536\u5165<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/lxylp.com\/?p=141\/#%E6%9F%A5%E7%9C%8B%E6%94%B6%E5%85%A5%E8%AF%A6%E6%83%85\" title=\"\u67e5\u770b\u6536\u5165\u8be6\u60c5\">\u67e5\u770b\u6536\u5165\u8be6\u60c5<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<p>\u5728\u4f1a\u8ba1\u5b66\u4e2d\uff0c\u590d\u5f0f\u8bb0\u8d26\u6cd5 \u662f\u5546\u4e1a\u53ca\u5176\u4ed6\u7ec4\u7ec7\u4e0a\u8bb0\u5f55\u91d1\u878d\u4ea4\u6613\u7684\u6807\u51c6\u7cfb\u7edf\u3002<\/p>\n\n\n\n<p>\u4f1a\u8ba1\u6052\u7b49\u5f0f\u4e4b\u9759\u6001\u516c\u5f0f\uff1a<strong>\u8d44\u4ea7=\u8d1f\u503a+\u6240\u6709\u8005\u6743\u76ca<\/strong>\uff08\u8fd9\u4e00\u7b49\u5f0f\u53cd\u6620\u4e86\u8d44\u4ea7\u3001\u8d1f\u503a\u548c\u6240\u6709\u8005\u6743\u76ca\u4e4b\u95f4\u7684\u5173\u7cfb\uff0c\u4e5f\u662f\u590d\u5f0f\u8bb0\u8d26\u7684\u7406\u8bba\u57fa\u7840\uff09<\/p>\n\n\n\n<p>\u4f1a\u8ba1\u6052\u7b49\u5f0f\u4e4b\u52a8\u6001\u516c\u5f0f\uff1a<strong>\u5229\u6da6=\u6536\u5165+\u82b1\u9500<\/strong> \uff08\u8fd9\u4e00\u7b49\u5f0f\u53cd\u6620\u4e86 \u671f\u95f4\u7684\u6536\u5165\u3001\u82b1\u9500\u548c\u5229\u6da6\u4e4b\u95f4\u7684\u5173\u7cfb\uff0c\u4e5f\u662f\u7edf\u8ba1\u5229\u6da6\u7684\u57fa\u7840\u4f9d\u636e\uff09<\/p>\n\n\n\n<p>\u6700\u7ec8\u7684\u5229\u6da6\u8fd8\u662f\u8981\u5f52\u5c5e\u5230\u6240\u6709\u8005\u6743\u76ca\uff0c\u56e0\u6b64\u7ed3\u5408\u4e0a\u9762\u4e24\u4e2a\u516c\u5f0f\uff0c\u53ef\u4ee5\u5f97\u51fa\uff1a<\/p>\n\n\n\n<p><strong><em>\u8d44\u4ea7 = \u8d1f\u503a + \u6240\u6709\u8005\u6743\u76ca + \uff08\u6536\u5165+\u82b1\u9500\uff09<\/em><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8d44\u4ea7 Assets\uff0c\u8bb0\u5f55\u73b0\u91d1current\u3001\u94f6\u884c\u5b58\u6b3e\u3001\u6295\u8d44investment\uff1b<\/li>\n\n\n\n<li>\u8d1f\u503a Liabilities\uff0c\u8bb0\u5f55\u4fe1\u7528\u5361credit_card\u3001\u623f\u8d37\u3001\u8f66\u8d37\u7b49\uff1b<\/li>\n\n\n\n<li>\u6743\u76ca Equity\uff0c\u51c0\u8d44\u4ea7\uff0c\u5b58\u653e\u5728\u8bb0\u8d26\u5f00\u59cb\u524d\u5df2\u7ecf\u6709\u7684\u6743\u76ca\u3002<\/li>\n\n\n\n<li>\u82b1\u9500 Expenses\uff0c\u8bb0\u5f55\u5404\u79cd\u6d88\u8d39\uff08\u8863\u98df\u4f4f\u884c\u533b\u901a\u5b66\u5a31\uff09\u7b49\uff1b<\/li>\n\n\n\n<li>\u6536\u5165 Income\uff0c\u8bb0\u5f55\u5de5\u8d44salary\u3001\u5956\u91d1fee\u7b49\uff1b<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>2022-02-05  *  opening balances\n  assets:current:cash:bank:CMB          0\n  assets:current:cash:bank:CCB          0\n  assets:current:cash:bank:ICBC                 100\n  assets:current:investment:fund:\u5929\u5929\u57fa\u91d1               100\n  assets:current:investment:fund:alipay:yu'ebao                 100\n  assets:current:investment:stock:\u534e\u6cf0\u8bc1\u5238              100\n  assets:current:debit          0\n  assets:fixed:housing          100\n  expenses              0\n  liabilities:credicard:CMB             -100\n  liabilities:credicard:CCB             -100\n  equity:opening\/closing balances<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E7%94%A8_hledger_%E6%9D%A5%E8%AE%B0%E8%B4%A6\"><\/span>\u7528 hledger \u6765\u8bb0\u8d26<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%9D%E5%A7%8B%E5%8C%96\"><\/span>\u521d\u59cb\u5316<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>hledger \u9ed8\u8ba4\u6587\u4ef6\u662f \u5bb6\u76ee\u5f55\u4e0b\u7684 .hledger.journal<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>liupei@t470:~$ ls .hledger.journal\n.hledger.journal<\/code><\/pre>\n\n\n\n<p>\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u66f4\u6539 hledger \u7684\u73af\u5883\u53d8\u91cf\uff0c\u6765\u91cd\u65b0\u6307\u5b9a\u9ed8\u8ba4\u6587\u4ef6\uff0c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export LEDGER_FILE=oneT470\/.hledger.journal\n# or\nln -s oneT470\/.hledger.journal .hledger.journal<\/code><\/pre>\n\n\n\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u6765\u5bf9\u73b0\u6709\u7684 \u8d44\u4ea7 \u548c \u8d1f\u503a \u505a\u4e2a\u521d\u59cb\u8f93\u5165:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2022-02-05  *  opening balances\n  assets:current:cash:bank:CMB          0\n  assets:current:cash:bank:CCB          0\n  assets:current:cash:bank:ICBC                 100\n  assets:current:investment:fund:\u5929\u5929\u57fa\u91d1               100\n  assets:current:investment:fund:alipay:yuebao                 100\n  assets:current:investment:stock:\u534e\u6cf0\u8bc1\u5238              100\n  assets:current:debit          0\n  assets:fixed:housing          100\n  expenses              0\n  liabilities:credicard:CMB             -100\n  liabilities:credicard:CCB             -100\n  equity:opening\/closing balances<\/code><\/pre>\n\n\n\n<p>\u4ece\u56fe\u4e2d\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u6211\u5c06\u6240\u6709\u7684 \u8d44\u4ea7 \u90fd\u5f52\u5230\u4e86 assets \u76ee\u5f55\u4e0b\uff0c\u7136\u540e\u4e0b\u9762\u53c8\u5206\u51fa current assets\uff08\u6d41\u52a8\u8d44\u4ea7\uff09 \u548c fixed assets\uff08\u56fa\u5b9a\u8d44\u4ea7\uff09\uff0c\u800c current assets \u4e0b\u53c8\u5206\u51fa\u4e86 cash\uff08\u73b0\u91d1\uff09\u548cinvestment\uff08\u6295\u8d44\uff09\uff0c\u5177\u4f53\u5212\u5206\u5982\u4e0b\uff08\u53ef\u4f9b\u53c2\u8003\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ hledger accounts\nassets:current:cash:bank:CCB\nassets:current:cash:bank:CMB\nassets:current:cash:bank:ICBC\nassets:current:debit\nassets:current:investment:fund:alipay:yuebao\nassets:current:investment:fund:\u5929\u5929\u57fa\u91d1\nassets:current:investment:stock:\u534e\u6cf0\u8bc1\u5238\nassets:fixed:housing\nequity:opening\/closing balances\nexpenses\nliabilities:credicard:CCB\nliabilities:credicard:CMB<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>assets<\/li>\n\n\n\n<li>current assets\n<ul class=\"wp-block-list\">\n<li>cash<\/li>\n\n\n\n<li>bank\n<ul class=\"wp-block-list\">\n<li>CMB<\/li>\n\n\n\n<li>CCB<\/li>\n\n\n\n<li>ICBC<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>investment<\/li>\n\n\n\n<li>fund\n<ul class=\"wp-block-list\">\n<li>\u5929\u5929\u57fa\u91d1<\/li>\n\n\n\n<li>alipay<\/li>\n\n\n\n<li>yu&#8217;e bao<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>stock\n<ul class=\"wp-block-list\">\n<li>\u534e\u6cf0\u8bc1\u5238<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>fixed assets\n<ul class=\"wp-block-list\">\n<li>housing<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>expenses<\/li>\n\n\n\n<li>liabilities<\/li>\n\n\n\n<li>credit_card\n<ul class=\"wp-block-list\">\n<li>CMB<\/li>\n\n\n\n<li>CCB<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u6ce8\u610f\uff0c<code>equity:opening\/closing balances<\/code> \u8fd9\u53e5\u662f\u8868\u793a \u5f00\u542f\u52a8\u6001\u5e73\u8861\u3002<\/p>\n\n\n\n<p>\u4e3a\u4ec0\u4e48\u521d\u59cb\u5316\u7684\u65f6\u5019\u7528\u52a8\u6001\u5e73\u8861\uff0c\u8fd9\u4e2a\u548c\u590d\u5f0f\u8bb0\u8d26\u6709\u5173\uff0c\u590d\u5f0f\u8bb0\u8d26\u8bb2\u7a76\u6709\u8f93\u5165\u5fc5\u6709\u8f93\u51fa\uff0c\u6240\u4ee5\u590d\u5f0f\u8bb0\u8d26\u7684\u539f\u7406\u548c\u8bb0\u8d26\u65b9\u5f0f\u51b3\u5b9a\u4e86\uff0c<strong>\u8bb0\u8d26\u8fc7\u7a0b\u4e2d\u6240\u6709\u7684\u6570\u5b57 \u76f8\u52a0\u4e4b\u548c \u4e00\u5b9a \u4e3a 0<\/strong>\u3002<\/p>\n\n\n\n<p>\u6bd4\u5982\u4e0a\u9762\u7684\u521d\u59cb\u5316\u8d44\u4ea7\u548c\u8d1f\u503a\u52a0\u8d77\u6765\u7b49\u4e8e 300\uff0c\u6211\u4eec\u5f00\u542f\u52a8\u6001\u5e73\u8861\u540e\uff0c\u6211\u4eec\u770b\u4e00\u4e0b \u5e73\u8861\u60c5\u51b5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ hledger b\n                 500  assets\n                 400    current\n                 100      cash:bank:ICBC\n                 300      investment\n                 200        fund\n                 100          alipay:yu'ebao\n                 100          \u5929\u5929\u57fa\u91d1\n                 100        stock:\u534e\u6cf0\u8bc1\u5238\n                 100    fixed:housing\n                -300  equity:opening\/closing balances\n                -200  liabilities:creditcard\n                -100    CCB\n                -100    CMB\n--------------------\n                   0<\/code><\/pre>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u81ea\u52a8\u5c06equity\u8ba1\u7b97\u51fa\u6765\uff0c\u503c\u4e3a300\uff0c\u8fd9\u610f\u5473\u7740\u6211\u4eec\u7684 assets \u91cc\u9762\u6709300 \u662f\u4ece equity \u7ed9\u5230 assets \u7684\u3002<\/p>\n\n\n\n<p>\u6240\u6709\u7684\u6570\u5b57\u4e4b\u548c\u4e3a0\uff0c\u8fd9\u4e2a\u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u4f60\u8bb0\u8d26\u540e\u6709\u6ca1\u6709\u51fa\u9519\u7684\u5224\u65ad\u4f9d\u636e\u4e4b\u4e00\u3002\u5047\u5982 balance \u4e0d\u662f\u4e3a0\uff0c\u90a3\u4e48\u8bc1\u660e\u4f60\u7684\u8bb0\u8d26\u80af\u5b9a\u51fa\u73b0\u51fa\u9519\u4e86\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%BC%80%E5%A7%8B%E8%AE%B0%E8%B4%A6\"><\/span>\u5f00\u59cb\u8bb0\u8d26<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><code>hledger add<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ hledger add\nAdding transactions to journal file .hledger.test\nAny command line arguments will be used as defaults.\nUse tab key to complete, readline keys to edit, enter to accept defaults.\nAn optional (CODE) may follow transaction dates.\nAn optional ; COMMENT may follow descriptions or amounts.\nIf you make a mistake, enter &lt; at any prompt to restart the transaction.\nTo end a transaction, enter . when prompted.\nTo quit, enter . at a date prompt or press control-d or control-c.\nDate &#91;2022\/06\/06]:\nDescription: breakfast\nAccount 1: expenses:food\nAmount  1: 15\nAccount 2: liabilities:credicard:CMB\nAmount  2 &#91;-15]:\nAccount 3 (or . or enter to finish this transaction):\n2022\/06\/06 breakfast\n    expenses:food                          15\n    liabilities:credicard:CMB\n\nSave this transaction to the journal ? &#91;y]:\nSaved.\nStarting the next transaction (. or ctrl-D\/ctrl-C to quit)\nDate &#91;2022\/06\/06]:\nDescription:\nAccount 1: &lt;\nRestarting this transaction.\nDate &#91;2022\/06\/06]:\nDescription: clothing\nUsing this similar transaction for defaults:\n2022\/02\/05 * opening balances\n    assets:current:cash:bank:CMB                                0\n    assets:current:cash:bank:CCB                                0\n    assets:current:cash:bank:ICBC                             100\n    assets:current:investment:fund:\u5929\u5929\u57fa\u91d1                   100\n    assets:current:investment:fund:alipay:yu'ebao             100\n    assets:current:investment:stock:\u534e\u6cf0\u8bc1\u5238                  100\n    assets:current:debit                                        0\n    assets:fixed:housing                                      100\n    expenses                                                    0\n    liabilities:credicard:CMB                                -100\n    liabilities:credicard:CCB                                -100\n    equity:opening\/closing balances\n\nAccount 1 &#91;assets:current:cash:bank:CMB]: expenses:clothing\nAmount  1 &#91;0]: 600\nAccount 2 &#91;assets:current:cash:bank:CCB]: liabilities\nliabilities                liabilities:credicard      liabilities:credicard:CCB  liabilities:credicard:CMB\nAccount 2 &#91;assets:current:cash:bank:CCB]: liabilities:credicard:CMB\nAmount  2 &#91;-600]:\nAccount 3 (or . to finish this transaction) &#91;assets:current:cash:bank:ICBC]:<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B_balance\"><\/span>\u67e5\u770b balance<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger balance\/ b \/ bal\n~$ hledger b\n               480.5  assets\n               380.5    current\n                80.5      cash:bank:ICBC\n               300.0      investment\n               200.0        fund\n               100.0          alipay:yu'ebao\n               100.0          \u5929\u5929\u57fa\u91d1\n               100.0        stock:\u534e\u6cf0\u8bc1\u5238\n               100.0    fixed:housing\n              -300.0  equity:opening\/closing balances\n                34.5  expenses\n                15.0    food\n                19.5    taxi\n              -215.0  liabilities:credicard\n              -100.0    CCB\n              -115.0    CMB\n--------------------\n                   0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E4%B8%80%E5%85%B1%E8%8A%B1%E8%B4%B9%E5%A4%9A%E5%B0%91%E9%92%B1\"><\/span>\u67e5\u770b\u4e00\u5171\u82b1\u8d39\u591a\u5c11\u94b1<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger bal expenses\n$ hledger b expenses\n                34.5  expenses\n                15.0    food\n                19.5    taxi\n--------------------\n                34.5<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E6%94%AF%E5%87%BA%E7%9A%84%E8%AF%A6%E7%BB%86%E4%BF%A1%E6%81%AF\"><\/span>\u67e5\u770b\u652f\u51fa\u7684\u8be6\u7ec6\u4fe1\u606f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger reg expenses\n$ hledger reg expenses\n2022\/02\/05  opening balances   expenses         0             \n02022\/06\/06 breakfast          expenses:food    15.0         \n2022\/06\/06  taxi                 expenses:taxi    15.0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B_2020-07-01_%E8%87%B3%E4%BB%8A_%E6%89%80%E6%9C%89%E8%AF%A6%E6%83%85\"><\/span>\u67e5\u770b 2020-07-01 \u81f3\u4eca \u6240\u6709\u8be6\u60c5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger reg -b 2020\/7\/1<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b \u5de5\u5546\u94f6\u884c\u5361\u7684\u8d44\u4ea7\u53d8\u52a8\u8be6\u60c5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger register assets:current:cash:bank:ICBC\n$ hledger register assets:current:cash:bank:ICBC\n2022\/02\/05 opening balances                                           assets:current:cash:bank:ICBC                                      100.0         100.0\n2022\/06\/06 taxi                                                       assets:current:cash:bank:ICBC                                      -19.5          80.5<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BB%A5%E6%AF%8F%E6%9C%88%E4%B8%BA%E5%91%A8%E6%9C%9F%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E6%89%80%E6%9C%89%E6%94%AF%E6%94%B6%E6%83%85%E5%86%B5\"><\/span>\u4ee5\u6bcf\u6708\u4e3a\u5468\u671f\u67e5\u770b\u8d26\u6237\u6240\u6709\u652f\u6536\u60c5\u51b5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger bal -M<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BB%A5%E6%AF%8F%E6%9C%88%E4%B8%BA%E5%91%A8%E6%9C%9F%E6%9F%A5%E7%9C%8B_expenses_%E8%8A%B1%E8%B4%B9%E6%83%85%E5%86%B5\"><\/span>\u4ee5\u6bcf\u6708\u4e3a\u5468\u671f\u67e5\u770b expenses \u82b1\u8d39\u60c5\u51b5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger bal expenses -M\n$ hledger bal -M\nBalance changes in 2022\/02\/01-2022\/06\/30:\n\n                                               ||    Feb  Mar  Apr  May    Jun\n===============================================++==============================\n assets:current:cash:bank:ICBC                 ||  100.0    0    0    0  -19.5\n assets:current:investment:fund:alipay:yu'ebao ||  100.0    0    0    0      0\n assets:current:investment:fund:\u5929\u5929\u57fa\u91d1        ||  100.0    0    0    0      0\n assets:current:investment:stock:\u534e\u6cf0\u8bc1\u5238       ||  100.0    0    0    0      0\n assets:fixed:housing                          ||  100.0    0    0    0      0\n equity:opening\/closing balances               || -300.0    0    0    0      0\n expenses:food                                 ||      0    0    0    0   15.0\n expenses:taxi                                 ||      0    0    0    0   19.5\n liabilities:credicard:CCB                     || -100.0    0    0    0      0\n liabilities:credicard:CMB                     || -100.0    0    0    0  -15.0\n-----------------------------------------------++------------------------------\n                                               ||      0    0    0    0      0<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u5f53\u524d\u7684\u51c0\u8d44\u4ea7\uff08\u8d44\u4ea7 &#8211; \u8d1f\u503a\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> hledger balance assets liabilities\n $ hledger balance assets liabilities\n               480.5  assets\n               380.5    current\n                80.5      cash:bank:ICBC\n               300.0      investment\n               200.0        fund\n               100.0          alipay:yu'ebao\n               100.0          \u5929\u5929\u57fa\u91d1\n               100.0        stock:\u534e\u6cf0\u8bc1\u5238\n               100.0    fixed:housing\n              -215.0  liabilities:credicard\n              -100.0    CCB\n              -115.0    CMB\n--------------------\n               265.5<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E6%80%BB%E6%94%B6%E5%85%A5\"><\/span>\u67e5\u770b\u603b\u6536\u5165<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger balance income\n$ hledger balance income\n--------------------\n                   0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E6%94%B6%E5%85%A5%E8%AF%A6%E6%83%85\"><\/span>\u67e5\u770b\u6536\u5165\u8be6\u60c5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger reg income<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>hledger print -b 5\/9 -e 5\/16\nhledger bal -b 5\/9 -e 5\/16\nhledger bal -W -b 5\/9 -e 5\/16\nhledger bal -M<\/code><\/pre>\n\n\n\n<p>\u53c2\u8003\u6587\u732e<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/158628437\">\u52b2\u7af9\u5929\u5730\u5ba2<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/cn-sec.com\/archives\/612451.html\">bean_Count<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/hledger.org\/quickstart.html\">hledger<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f1a\u8ba1\u5b66\u4e2d\uff0c\u590d\u5f0f\u8bb0\u8d26\u6cd5 \u662f\u5546\u4e1a\u53ca&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":492,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[10],"class_list":["post-141","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-10"],"_links":{"self":[{"href":"https:\/\/lxylp.com\/index.php?rest_route=\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lxylp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lxylp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lxylp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lxylp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=141"}],"version-history":[{"count":1,"href":"https:\/\/lxylp.com\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":142,"href":"https:\/\/lxylp.com\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions\/142"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lxylp.com\/index.php?rest_route=\/wp\/v2\/media\/492"}],"wp:attachment":[{"href":"https:\/\/lxylp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lxylp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lxylp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}