bugfix
This commit is contained in:
parent
b9fd12d043
commit
a967858d75
28
wwwroot/mybalance.dspy
Normal file
28
wwwroot/mybalance.dspy
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
userid = await get_user()
|
||||||
|
userorgid = await get_userorgid()
|
||||||
|
async with get_sor_context(request._run_ns, 'accounting') as sor:
|
||||||
|
sql = """select b.id, a.name, b.balance_at, c.balance from
|
||||||
|
subject a, account b,
|
||||||
|
(select a.* from acc_balance a, (select accountid, max(acc_date) max_date from acc_balance group by accountid) b where a.accountid=b.accountid and a.acc_date=b.max_date) c
|
||||||
|
where c.accountid = b.id
|
||||||
|
and b.subjectid = a.id
|
||||||
|
and b.orgid = ${orgid}$
|
||||||
|
"""
|
||||||
|
ns = {'orgid': userorgid}
|
||||||
|
recs = await sor.sqlExe(sql, ns)
|
||||||
|
data = []
|
||||||
|
for r in recs:
|
||||||
|
data.append({
|
||||||
|
'account': r.name,
|
||||||
|
'balance': r.balance
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
'status': 'ok',
|
||||||
|
'data': data
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
'status': 'error',
|
||||||
|
'data': {
|
||||||
|
'message': '系统错误'
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user