bugfix
This commit is contained in:
parent
9ef2c812dd
commit
c5ac9639d1
@ -1,48 +1,17 @@
|
|||||||
from appPublic.registerfunction import RegisterFunction
|
from appPublic.registerfunction import RegisterFunction
|
||||||
from appPublic.dictOBject import DictObject
|
from appPublic.dictOBject import DictObject
|
||||||
from appPublic.log import debug, exception, error
|
from appPublic.log import debug, exception, error
|
||||||
|
from ahserver.serverenv import ServerEnv
|
||||||
from accounting_config import AccountingOrgs
|
from accounting_config import AccountingOrgs
|
||||||
|
|
||||||
"""
|
def load_accounting():
|
||||||
We use Biz module's function to get inner provider and its sellprice, and product cost
|
g = ServerEnv()
|
||||||
We use platform biz module to get pay_fee, and trans_fee amount by transamt
|
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(
|
|
||||||
|
17
json/acc_balance.json
Normal file
17
json/acc_balance.json
Normal file
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
17
json/acc_detail.json
Normal file
17
json/acc_detail.json
Normal file
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
34
json/account.json
Normal file
34
json/account.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
16
json/account_config.json
Normal file
16
json/account_config.json
Normal file
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
16
json/accounting_config.json
Normal file
16
json/accounting_config.json
Normal file
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
17
json/accounting_log.json
Normal file
17
json/accounting_log.json
Normal file
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
25
json/subject.json
Normal file
25
json/subject.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user