diff --git a/accounting/accounting.py b/accounting/accounting.py new file mode 100644 index 0000000..5ca518d --- /dev/null +++ b/accounting/accounting.py @@ -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( diff --git a/accounting/accounting_config.py b/accounting/accounting_config.py index e19dd08..2b65715 100644 --- a/accounting/accounting_config.py +++ b/accounting/accounting_config.py @@ -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 diff --git a/docs/平台类系统记账子系统.docx b/docs/平台类系统记账子系统.docx index 7ea76d4..850c96f 100644 Binary files a/docs/平台类系统记账子系统.docx and b/docs/平台类系统记账子系统.docx differ