This commit is contained in:
yumoqing 2024-12-26 17:56:37 +08:00
parent 40595979c6
commit fe7dd68d7f
8 changed files with 100 additions and 4 deletions

View File

@ -2,7 +2,7 @@ from sqlor.dbpools import DBPools
from .const import *
from accounting.accountingnode import get_parent_orgid
async def getAccountByName(sor, accounting_orgid, orgid, name):
async def getAccountByName(sor, accounting_orgid, orgid, name, org1id):
sql = """select a.* from account a, subject b
where a.subjectid = b.id and
a.accounting_orgid = ${accounting_orgid}$ and
@ -15,7 +15,10 @@ where a.subjectid = b.id and
});
if len(recs) == 0:
return None
return recs[0]['id']
for rec in recs:
if a.org1id == org1id:
return rec['id']
return None
async def getTransPayMode():
pass
@ -43,10 +46,10 @@ async def getCustomerBalance(sor, customerid):
return None
return balance
async def getAccountBalance(sor, accounting_orgid, orgid, subjectname):
async def getAccountBalance(sor, accounting_orgid, orgid, subjectname, org1id):
accid = await getAccountByName(sor, accounting_orgid,
orgid,
subjectname)
subjectname,org1id)
if accid is None:
print(f'accid is None, {accounting_orgid=}, {orgid=}, {subjectname=}')
return None

17
accounting/init.py Normal file
View File

@ -0,0 +1,17 @@
from ahserver.serverenv import ServerEnv
from accounting.openaccount import openAllResellerAccounts
from accounting.openaccount import openAllCustomerAccounts
from accounting.openaccount import openAllProviderAccounts
from accounting.openaccount import openRetailRelationshipAccounts
from accounting.openaccount import openOwnerAccounts
from accounting.recharge import recharge_accounting
from accounting.getaccount import getAccountBalance, getCustomerBalance
def load_accounting():
g = ServerEnv()
g.openAllResellerAccounts = openAllResellerAccounts
g.openAllCustomerAccounts = openAllCustomerAccounts
g.openAllProviderAccounts = openAllProviderAccounts
g.openRetailRelationshipAccounts = openRetailRelationshipAccounts
g.openOwnerAccounts = openOwnerAccounts
g.recharge_accounting = recharge_accounting

View File

@ -16,6 +16,7 @@ class RechargeAccounting:
self.db = DBPools()
self.recharge_log = recharge_log
self.customerid = recharge_log['customerid']
self.summary = recharge_log['summary']
self.orderid = None
self.curdate = recharge_log['recharge_date']
self.transamount = recharge_log['recharge_amt']
@ -62,3 +63,25 @@ class RechargeAccounting:
await sor.C('bill', self.bill.copy())
# await sor.C('recharge_log', self.recharge_log.copy())
async def recharge_accounting(sor, customerid, action, logid, trnasdate, recharge_amt):
"""
summary:recharge channe(handly, wechat, alipay)
"""
recharge_log = {
"customerid":customerid,
"recharge_date":transdate,
"recharge_logid":logid,
"recharge_amt":recharge_amt,
"action":action,
}
ra = RechargeAccounting(recharge_log)
if sor:
r = await ra.accounting(sor)
return True
db = DBPools()
dbname = await rfrun('get_module_dbname', 'accounting')
async with db.sqlorContext(dbname) as sor:
r = await ra.accounting(sor)
return True

6
www/alipay_recharge.ui Normal file
View File

@ -0,0 +1,6 @@
{
"widgettype":"VBox",
"options":{
"height":"100%"
}
}

View File

@ -0,0 +1,5 @@
debug(f'{params_kw=}')
return {
'status':'ok',
'message':'is ok'
}

View File

@ -0,0 +1,5 @@
debug(f'{params_kw=}')
return {
'status':'ok',
'message':'is ok'
}

31
www/recharge.ui Normal file
View File

@ -0,0 +1,31 @@
{
"widgettype":"Form",
"options":{
"fields":[
{
"name":"recharge_amt",
"uitype":"float",
"required":true,
"label":"充值金额"
},
{
"name":"channel",
"label":"选择充值方式",
"uitype":"checkbox",
"multicheck":false,
"required":true,
"value":"alipay",
"data":[
{
"value":"alipay",
"text":"支付宝"
},
{
"value":"wechatpay",
"text":"微信支付"
}
]
}
]
}
}

6
www/wechat_recharge.ui Normal file
View File

@ -0,0 +1,6 @@
{
"widgettype":"VBox",
"options":{
"height":"100%"
}
}