bugfix
This commit is contained in:
parent
ec250a1593
commit
d44f6f74cd
@ -10,6 +10,45 @@ from accounting.bizaccount import BizAccounting
|
||||
from accounting.recharge import RechargeBiz, recharge_accounting
|
||||
from comsume import ConsumeBiz
|
||||
|
||||
async def all_my_accounts(request):
|
||||
env = request._run_ns
|
||||
userid = await env.get_user()
|
||||
userorgid = await env.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)
|
||||
return recs
|
||||
|
||||
async def get_accdetail(request, accountid, page=1):
|
||||
env = request._run_ns
|
||||
userorgid = await env.get_userorgid()
|
||||
async with get_sor_context(env, 'accounting') as sor:
|
||||
sql = """select a.*,
|
||||
c.name
|
||||
from acc_detail a, account b, subject c
|
||||
where b.subjectid = c.id
|
||||
and a.accountid = b.id
|
||||
and b.id = ${accountid}$
|
||||
"""
|
||||
ns = {
|
||||
'accountid': accountid,
|
||||
'page': page,
|
||||
'sort': 'acc_date desc'
|
||||
}
|
||||
ret = await sor.sqlExe(sql, ns)
|
||||
return ret
|
||||
return {
|
||||
'total': 0,
|
||||
'rows': []
|
||||
}
|
||||
|
||||
def load_accounting():
|
||||
g = ServerEnv()
|
||||
g.Accounting = Accounting
|
||||
@ -26,3 +65,5 @@ def load_accounting():
|
||||
g.get_account_total_amount = get_account_total_amount
|
||||
g.BizAccounting = BizAccounting
|
||||
g.recharge_accounting = recharge_accounting
|
||||
g.get_accdetail = get_accdetail
|
||||
g.all_my_accounts = all_my_accounts
|
||||
|
||||
1
wwwroot/accdetail.dspy
Normal file
1
wwwroot/accdetail.dspy
Normal file
@ -0,0 +1 @@
|
||||
return await get_accdetail(request, params_kw.accountid)
|
||||
53
wwwroot/accdetail.ui
Normal file
53
wwwroot/accdetail.ui
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"widgettype":"Cols",
|
||||
"options":{
|
||||
"data_url": "{{entire_url('accdetail.dspy')}}",
|
||||
"data_params":{
|
||||
"accountid":"{{params_kw.accountid}}"
|
||||
},
|
||||
"data_method": "GET"
|
||||
{% if params_kw._is_mobile %}
|
||||
"col_width": "{{params_kw.width / 2 - 5}}px",
|
||||
{% else %}
|
||||
"col_cwidth": 22,
|
||||
{% endif %}
|
||||
"record_view":{
|
||||
"widgettype":"VBox",
|
||||
"options":{
|
||||
"width":"100%"
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${acc_date}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${acc_dir}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${summary}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${amount}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"text":"${balance}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
13
wwwroot/myaccounts.dspy
Normal file
13
wwwroot/myaccounts.dspy
Normal file
@ -0,0 +1,13 @@
|
||||
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)
|
||||
return recs
|
||||
113
wwwroot/myaccounts.ui
Normal file
113
wwwroot/myaccounts.ui
Normal file
@ -0,0 +1,113 @@
|
||||
{
|
||||
"widgettype":"DynamicColumn",
|
||||
"options":{
|
||||
"css":"filler",
|
||||
"width":"100%"
|
||||
},
|
||||
"subwidgets":[
|
||||
{% for acc in myaccounts(request) %}
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{
|
||||
{% if params_kw.is_mobile %}
|
||||
"width":"{{params_kw.width/2-3}}px",
|
||||
"cheight":4
|
||||
{% else %}
|
||||
"cwidth":12,
|
||||
"cheight":4
|
||||
{% endif %}
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"IconBar",
|
||||
"options":{
|
||||
"rate": 1.5,
|
||||
"tools":[
|
||||
{% if acc.name == '客户资金账户' %}
|
||||
{
|
||||
"name":"recharge",
|
||||
"icon":"{{entire_url('/unipay/imgs/recharge.svg')}}",
|
||||
"tip":"账户充值"
|
||||
},
|
||||
{% endif %}
|
||||
{
|
||||
"name":"detail",
|
||||
"icon":"{{entire_url('imgs/accdetail.svg')}}",
|
||||
"tip":"查看账户明细"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Title6",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"text":"{{acc.name}}"
|
||||
}
|
||||
},{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"i18n":true,
|
||||
"otext":"{{'借' if acc.balance_at=='0' else '贷'}}"
|
||||
}
|
||||
},{
|
||||
"widgettype":"Text",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"text":"{{acc.balance}}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"binds":[
|
||||
{
|
||||
"wid":"self",
|
||||
"event":"recharge",
|
||||
"actiontype":"urlwidget",
|
||||
"target":"PopupWindow",
|
||||
"popup_options":{
|
||||
"icon":"{{entire_url('/unipay/imgs/recharge.svg')}}",
|
||||
"title":"充值",
|
||||
{% if params_kw._is_mobile %}
|
||||
"width":"100%",
|
||||
"height":"95%"
|
||||
{% else %}
|
||||
"width":"360px",
|
||||
"height":"240px"
|
||||
{% endif %}
|
||||
},
|
||||
"options":{
|
||||
"params_kw":{
|
||||
"accountid":"{{acc.id}}"
|
||||
},
|
||||
"url":"entire_url('/uniapy/recharge.ui')"
|
||||
}
|
||||
},{
|
||||
"wid":"self",
|
||||
"event":"recharge",
|
||||
"actiontype":"urlwidget",
|
||||
"target":"PopupWindow",
|
||||
"popup_options":{
|
||||
"icon":"{{entire_url('imgs/accdetail.svg')}}",
|
||||
"title":"充值",
|
||||
{% if params_kw._is_mobile %}
|
||||
"width":"100%",
|
||||
"height":"95%"
|
||||
{% else %}
|
||||
"width":"360px",
|
||||
"height":"240px"
|
||||
{% endif %}
|
||||
},
|
||||
"options":{
|
||||
"params_kw":{
|
||||
"accountid":"{{acc.id}}"
|
||||
},
|
||||
"url":"entire_url('accdetail.ui')"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user