bugfix
This commit is contained in:
parent
7c77aa7bd6
commit
b29322d138
48
accounting/accounting.py
Normal file
48
accounting/accounting.py
Normal file
@ -0,0 +1,48 @@
|
||||
from appPublic.registerfunction import RegisterFunction
|
||||
from appPublic.dictOBject import DictObject
|
||||
from appPublic.log import debug, exception, error
|
||||
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
|
||||
|
||||
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(
|
@ -27,11 +27,9 @@ class AccountingOrgs:
|
||||
def __init__(self, caller,
|
||||
accounting_orgid,
|
||||
customerid,
|
||||
dbname=DBNAME,
|
||||
resellerid=None
|
||||
):
|
||||
self.caller = caller
|
||||
self.dbname = dbname
|
||||
self.curdate = caller.curdate
|
||||
self.realtimesettled = False
|
||||
self.curdte = caller.curdate
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user