diff --git a/accounting/consume.py b/accounting/consume.py index 3e8572b..7b2d68c 100644 --- a/accounting/consume.py +++ b/accounting/consume.py @@ -9,7 +9,6 @@ from .const import * from .accountingnode import get_accounting_nodes from .excep import * from .getaccount import getAccountByName -from .businessdate import get_business_date class ConsumeBiz(PFBiz): def __init__(self, consume_logs): @@ -54,16 +53,16 @@ class ConsumeBiz(PFBiz): ao = Accounting(self) await ao.do_accounting(sor) - async def get_orgid_by_trans_role(self, sor, leg, role): - if role == 'owner': - return '0' - if role == 'customer': - return self.customerid + async def get_orgid_by_trans_role(self, sor, leg, role): + if role == 'owner': + return '0' + if role == 'customer': + return self.customerid if role == 'reseller': return self.resellerid - if role is None or role == 'null': - return None - e = Exception(f'unknown role({role})') - exception(f'Exception:{e}') - raise e + if role is None or role == 'null': + return None + e = Exception(f'unknown role({role})') + exception(f'Exception:{e}') + raise e diff --git a/accounting/init.py b/accounting/init.py index 67dd67c..22aab48 100644 --- a/accounting/init.py +++ b/accounting/init.py @@ -2,13 +2,13 @@ from appPublic.registerfunction import RegisterFunction from appPublic.dictObject import DictObject from appPublic.log import debug, exception, error from ahserver.serverenv import ServerEnv -from accounting.accounting_config import Accounting -from accounting.bill import write_bill -from accounting.openaccount import openOwnerAccounts, openProviderAccounts, openResellerAccounts, openCustomerAccounts -from accounting.getaccount import getAccountBalance, getCustomerBalance, getAccountByName, get_account_total_amount -from accounting.bizaccount import BizAccounting -from accounting.recharge import RechargeBiz, recharge_accounting -from comsume import ConsumeBiz +from .accounting_config import Accounting +from .bill import write_bill +from .openaccount import openOwnerAccounts, openProviderAccounts, openResellerAccounts, openCustomerAccounts +from .getaccount import getAccountBalance, getCustomerBalance, getAccountByName, get_account_total_amount +from .bizaccount import BizAccounting +from .recharge import RechargeBiz, recharge_accounting +from .consume import ConsumeBiz async def all_my_accounts(request): env = request._run_ns diff --git a/wwwroot/open_customer_accounts.dspy b/wwwroot/open_customer_accounts.dspy new file mode 100644 index 0000000..255f483 --- /dev/null +++ b/wwwroot/open_customer_accounts.dspy @@ -0,0 +1,7 @@ +debug(f'{params_kw=}') +dbname = get_module_dbname('accounting') +db = DBPools() +async with db.sqlorContext(dbname) as sor: + await openCustomerAccounts(sor, '0', params_kw.orgid) + return f'{params_kw.orgid} accounts opened') +return f'{db.e_except=} diff --git a/wwwroot/open_owner_accounts.dspy b/wwwroot/open_owner_accounts.dspy new file mode 100644 index 0000000..f3b9813 --- /dev/null +++ b/wwwroot/open_owner_accounts.dspy @@ -0,0 +1,7 @@ +debug(f'{params_kw=}') +dbname = get_module_dbname('accounting') +db = DBPools() +async with db.sqlorContext(dbname) as sor: + await openOwnerAccounts(sor, '0') + return f'0 accounts opened') +return f'{db.e_except=} diff --git a/wwwroot/open_reseller_accounts.dspy b/wwwroot/open_reseller_accounts.dspy new file mode 100644 index 0000000..06e6083 --- /dev/null +++ b/wwwroot/open_reseller_accounts.dspy @@ -0,0 +1,7 @@ +debug(f'{params_kw=}') +dbname = get_module_dbname('accounting') +db = DBPools() +async with db.sqlorContext(dbname) as sor: + await openResellerAccounts(sor, '0', params_kw.orgid) + return f'{params_kw.orgid} accounts opened') +return f'{db.e_except=}