diff --git a/accounting/accounting.py b/accounting/accounting.py index 5ca518d..f8aeddc 100644 --- a/accounting/accounting.py +++ b/accounting/accounting.py @@ -1,48 +1,17 @@ from appPublic.registerfunction import RegisterFunction from appPublic.dictOBject import DictObject from appPublic.log import debug, exception, error +from ahserver.serverenv import ServerEnv from accounting_config import AccountingOrgs -""" -We use Biz module's function to get inner provider and its sellprice, and product cost -We use platform biz module to get pay_fee, and trans_fee amount by transamt +def load_accounting(): + g = ServerEnv() + g.recharge_accounting = recharge_accounting + g.pay_accounting = pay_accounting + g.settle_accounting = settle_accounting + g.open_customer_account = open_customer_account + g.open_reseller_account = open_reseller_account + g.open_provider_account = open_provider_account + g.open_owner_account = open_owner_account + g.get_customer_balance = get_customer_balance -async bz_get_transfee(sor, transamt:float) -> float: -async bz_get_pay_fee(sor, resellerid, transamt:float) -> float: -async bz_get_inner_provider(sor, resellerid, productid, transamt) ->list of iobject with key in (resellerid, productid, transamt, purchase_cost) -""" - -async def bay_accouting(sor, actname, - orderid, - customerid, - resellerid, - productid, - unitprice, - quantity, - transamt): - rf = RegisterFunction() - f = rf.get('bz_get_transfee') - if f is None: - e = Exception(f'fucntion "bz_get_transfee" not registed') - raise e - transfee = await f(sor, resellerid, transamt) - resellers = await bz_get_inner_provider(sor, resellerid, productid, transamt) - par = [] - for i, reseller in enumerate(resellers): - env = DictOBject(**{ - 'actname':actname, - 'orderid':orderid, - 'customerid':customerid, - 'productid':reseller.productid, - 'resellerid':resellerid, - '交易费': 0 if i>0 else transfee, - '交易金额':reseller.transamt, - '进货成本':reseller.purchase_cost, - 'accounting_rule':[ - ] - }) - - ac = AccountingOrgs(env.copy()) - ac.do_accounting(sor) - - PlatformAccount( diff --git a/json/acc_balance.json b/json/acc_balance.json new file mode 100644 index 0000000..a6d3fab --- /dev/null +++ b/json/acc_balance.json @@ -0,0 +1,17 @@ +{ + "models_dir": "${HOME}$/py/rbac/models", + "output_dir": "${HOME}$/py/sage/wwwroot/account", + "dbname": "sage", + "tblname": "acc_balance", + "title":"科目", + "params": { + "sortby":"name", + "browserfields": { + "exclouded": ["id"], + "cwidth": {} + }, + "editexclouded": [ + "id" + ] + } +} diff --git a/json/acc_detail.json b/json/acc_detail.json new file mode 100644 index 0000000..1bab98e --- /dev/null +++ b/json/acc_detail.json @@ -0,0 +1,17 @@ +{ + "models_dir": "${HOME}$/py/rbac/models", + "output_dir": "${HOME}$/py/sage/wwwroot/acc_detail", + "dbname": "sage", + "tblname": "acc_detail", + "title":"科目", + "params": { + "sortby":"name", + "browserfields": { + "exclouded": ["id"], + "cwidth": {} + }, + "editexclouded": [ + "id" + ] + } +} diff --git a/json/account.json b/json/account.json new file mode 100644 index 0000000..71a9a53 --- /dev/null +++ b/json/account.json @@ -0,0 +1,34 @@ +{ + "models_dir": "${HOME}$/py/rbac/models", + "output_dir": "${HOME}$/py/sage/wwwroot/account", + "dbname": "sage", + "tblname": "account", + "title":"科目", + "params": { + "sortby":"name", + "browserfields": { + "exclouded": ["id"], + "cwidth": {} + }, + "editexclouded": [ + "id" + ], + "subtables":[ + { + "field":"accountid", + "title":"账户余额", + "subtable":"acc_balance" + }, + { + "field":"accountid", + "title":"账户明细", + "subtable":"acc_detail" + }, + { + "field":"accountid", + "title":"账户日志", + "subtable":"accounting_log" + } + ] + } +} diff --git a/json/account_config.json b/json/account_config.json new file mode 100644 index 0000000..fa5d29c --- /dev/null +++ b/json/account_config.json @@ -0,0 +1,16 @@ +{ + "models_dir": "${HOME}$/py/accounting/models", + "output_dir": "${HOME}$/py/sage/wwwroot/account_config", + "dbname": "sage", + "tblname": "account_config", + "title":"账户设置", + "params": { + "browserfields": { + "exclouded": ["id"], + "cwidth": {} + }, + "editexclouded": [ + "id" + ] + } +} diff --git a/json/accounting_config.json b/json/accounting_config.json new file mode 100644 index 0000000..c01137a --- /dev/null +++ b/json/accounting_config.json @@ -0,0 +1,16 @@ +{ + "models_dir": "${HOME}$/py/accounting/models", + "output_dir": "${HOME}$/py/sage/wwwroot/accounting_config", + "dbname": "sage", + "tblname": "accounting_config", + "title":"账务设置", + "params": { + "browserfields": { + "exclouded": ["id"], + "cwidth": {} + }, + "editexclouded": [ + "id" + ] + } +} diff --git a/json/accounting_log.json b/json/accounting_log.json new file mode 100644 index 0000000..3d5441f --- /dev/null +++ b/json/accounting_log.json @@ -0,0 +1,17 @@ +{ + "models_dir": "${HOME}$/py/rbac/models", + "output_dir": "${HOME}$/py/sage/wwwroot/accounting_log", + "dbname": "sage", + "tblname": "accounting_log", + "title":"科目", + "params": { + "sortby":"name", + "browserfields": { + "exclouded": ["id"], + "cwidth": {} + }, + "editexclouded": [ + "id" + ] + } +} diff --git a/json/subject.json b/json/subject.json new file mode 100644 index 0000000..71a7c41 --- /dev/null +++ b/json/subject.json @@ -0,0 +1,25 @@ +{ + "models_dir": "${HOME}$/py/rbac/models", + "output_dir": "${HOME}$/py/sage/wwwroot/subject", + "dbname": "sage", + "tblname": "subject", + "title":"科目", + "params": { + "sortby":"name", + "browserfields": { + "exclouded": ["id"], + "cwidth": {} + }, + "editexclouded": [ + "id" + ], + "subtables":[ + { + "field":"subjectid", + "title":"账户设置", + "url":"../account_config", + "subtable":"account_config" + } + ] + } +}