add: user ledger file template

This commit is contained in:
leo 2021-11-17 14:16:22 +08:00
parent 70c3633103
commit de4fde612c
17 changed files with 154 additions and 4 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

9
.idea/beancount-gs.iml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/beancount-gs.iml" filepath="$PROJECT_DIR$/.idea/beancount-gs.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,20 @@
{
"Assets:Fixed": "固定资产",
"Assets:Invest": "投资",
"Assets:Invest:Fund": "基金",
"Assets:Flow": "现金流",
"Expenses:Life:Food": "饮食",
"Expenses:Life:Travel": "出行",
"Expenses:Life:Shopping": "购物",
"Expenses:Life:House": "居住",
"Expenses:Life:Subscribe": "订阅",
"Expenses:Life:Other": "其他",
"Expenses:Life:Hobby": "爱好",
"Expenses:Work": "工作支出",
"Expenses:Life": "生活消费",
"Income:Work": "工作收入",
"Income:Gov": "财政补贴",
"Income:Invest": "投资收益",
"Liabilities:Cycle": "周期性贷款",
"Liabilities:Life": "消费贷款"
}

View File

@ -0,0 +1,9 @@
%startDate% open Assets:Fixed:House:商品房 %operatingCurrency%
%startDate% open Assets:Invest:Stock:股票 %operatingCurrency%
%startDate% open Assets:Invest:Fund:自定义基金 SHR
%startDate% open Assets:Invest:Deposit:定期 %operatingCurrency%
%startDate% open Assets:Invest:Gold:黄金 %operatingCurrency%
%startDate% open Assets:Flow:Bank:ICBC:工商银行 %operatingCurrency%
%startDate% open Assets:Flow:EBank:AliPay:支付宝 %operatingCurrency%
%startDate% open Assets:Flow:EBank:WxPay:微信支付 %operatingCurrency%
%startDate% open Assets:Flow:Cash:现金 %operatingCurrency%

View File

@ -0,0 +1 @@
%startDate% open Equity:OpeningBalances

View File

@ -0,0 +1,33 @@
%startDate% open Expenses:Life:Food:Meal:早餐 %operatingCurrency%
%startDate% open Expenses:Life:Food:Meal:午餐 %operatingCurrency%
%startDate% open Expenses:Life:Food:Meal:晚餐 %operatingCurrency%
%startDate% open Expenses:Life:Food:Meal:聚餐 %operatingCurrency%
%startDate% open Expenses:Life:Food:Coffee:咖啡 %operatingCurrency%
%startDate% open Expenses:Life:Food:Drink:饮料 %operatingCurrency%
%startDate% open Expenses:Life:Food:Fruit:水果 %operatingCurrency%
%startDate% open Expenses:Life:Food:Snack:零食 %operatingCurrency%
%startDate% open Expenses:Life:Travel:Bus:公交地铁 %operatingCurrency%
%startDate% open Expenses:Life:Travel:Taxi:出租车 %operatingCurrency%
%startDate% open Expenses:Life:Travel:Train:火车 %operatingCurrency%
%startDate% open Expenses:Life:Travel:Airplane:飞机 %operatingCurrency%
%startDate% open Expenses:Life:Travel:Bike:共享单车 %operatingCurrency%
%startDate% open Expenses:Life:Shopping:Clothes:衣服 %operatingCurrency%
%startDate% open Expenses:Life:Shopping:Shoe:鞋 %operatingCurrency%
%startDate% open Expenses:Life:Shopping:Sock:袜子 %operatingCurrency%
%startDate% open Expenses:Life:Shopping:购物 %operatingCurrency%
%startDate% open Expenses:Life:House:Rent:房租 %operatingCurrency%
%startDate% open Expenses:Life:House:Hotel:酒店 %operatingCurrency%
%startDate% open Expenses:Life:House:Water:用水 %operatingCurrency%
%startDate% open Expenses:Life:House:Gas:天然气 %operatingCurrency%
%startDate% open Expenses:Life:House:Electricity:用电 %operatingCurrency%
%startDate% open Expenses:Life:Subscribe:Mobile:手机话费 %operatingCurrency%
%startDate% open Expenses:Life:Subscribe:会员订阅 %operatingCurrency%
%startDate% open Expenses:Life:Other:Exchange:红包转账 %operatingCurrency%
%startDate% open Expenses:Life:Other:Commission:手续费 %operatingCurrency%
%startDate% open Expenses:Life:Hobby:Book:图书 %operatingCurrency%
%startDate% open Expenses:Life:Hobby:Camera:摄影 %operatingCurrency%
%startDate% open Expenses:Life:Hobby:Travel:Ticket:门票 %operatingCurrency%
%startDate% open Expenses:Life:Hobby:Travel:Souvenir:纪念品 %operatingCurrency%
%startDate% open Expenses:Work:Tax:个人所得税 %operatingCurrency%
%startDate% open Expenses:Work:Insurance:三险 %operatingCurrency%
%startDate% open Expenses:Work:Punish:考勤 %operatingCurrency%

View File

@ -0,0 +1,6 @@
%startDate% open Income:Work:Salary:工作收入 %operatingCurrency%
%startDate% open Income:Work:Bonus:奖金 %operatingCurrency%
%startDate% open Income:Work:HouseFund:单位公积金 %operatingCurrency%
%startDate% open Income:Gov:退税 %operatingCurrency%
%startDate% open Income:Gov:政府补贴 %operatingCurrency%
%startDate% open Income:Invest:投资收益 %operatingCurrency%

View File

@ -0,0 +1,4 @@
%startDate% open Liabilities:Cycle:ICBC:房贷 %operatingCurrency%
%startDate% open Liabilities:Life:JD:京东白条 %operatingCurrency%
%startDate% open Liabilities:Life:Huabei:花呗 %operatingCurrency%
%startDate% open Liabilities:Life:CreditCard:信用卡 %operatingCurrency%

0
example/history.bean Normal file
View File

12
example/includes.bean Normal file
View File

@ -0,0 +1,12 @@
; 账户定义
include "./account/assets.bean"
include "./account/equity.bean"
include "./account/expenses.bean"
include "./account/income.bean"
include "./account/liabilities.bean"
; 多币种配置
include "./price/prices.bean"
; 历史数据(用于 导入 之前的数据)
include "./history.bean"
; 新的数据(按月拆分)
include "./month/months.bean"

11
example/index.bean Normal file
View File

@ -0,0 +1,11 @@
option "title" "我的账本"
option "operating_currency" "%operatingCurrency%"
option "render_commas" "TRUE"
; fava 配置
1970-01-01 custom "fava-option" "interval" "day"
1970-01-01 custom "fava-option" "language" "zh_CN"
include "./includes.bean"

View File

View File

View File

@ -0,0 +1,3 @@
include "./commodities.bean"
%startDate% price SHR 2.00 %operatingCurrency%

View File

@ -6,8 +6,28 @@ import (
"github.com/gin-gonic/gin"
)
func main() {
route := gin.Default()
route.StaticFS("/", http.Dir("./public"))
_ = http.ListenAndServe(":3001", nil)
func InitLedgerFiles() {
}
func LoadLedgerCache() {
}
func RegisterRoute(route *gin.Engine) {
route.StaticFS("/", http.Dir("./public"))
}
func main() {
// 默认端口号
var port = ":3001"
// 初始化账本文件结构
InitLedgerFiles()
// 加载缓存
LoadLedgerCache()
// 启动服务
route := gin.Default()
// 注册路由
RegisterRoute(route)
_ = http.ListenAndServe(port, nil)
}