feat: 新增账单查询页面,按机构id+日期范围查询acc_detail
This commit is contained in:
parent
78ff190789
commit
997c7a445e
30
wwwroot/billing.dspy
Normal file
30
wwwroot/billing.dspy
Normal file
@ -0,0 +1,30 @@
|
||||
debug(f'{params_kw=}')
|
||||
userid = await get_user()
|
||||
userorgid = await get_userorgid()
|
||||
|
||||
start_date = params_kw.get('start_date', '')
|
||||
end_date = params_kw.get('end_date', '')
|
||||
|
||||
if not start_date or not end_date:
|
||||
return json.dumps({'total': 0, 'rows': []}, ensure_ascii=False, default=str)
|
||||
|
||||
ns = {
|
||||
'orgid': userorgid,
|
||||
'start_date': start_date,
|
||||
'end_date': end_date,
|
||||
'page': int(params_kw.get('page', 1)),
|
||||
'rows': int(params_kw.get('rows', 30)),
|
||||
'sort': 'acc_date desc'
|
||||
}
|
||||
|
||||
async with get_sor_context(request._run_ns, 'accounting') as sor:
|
||||
sql = """select d.acc_date, d.acc_timestamp, d.acc_dir, d.summary,
|
||||
d.amount, d.balance, s.name as subject_name
|
||||
from acc_detail d
|
||||
join account a on d.accountid = a.id
|
||||
join subject s on a.subjectid = s.id
|
||||
where a.orgid = ${orgid}$
|
||||
and d.acc_date >= ${start_date}$
|
||||
and d.acc_date <= ${end_date}$"""
|
||||
ret = await sor.sqlExe(sql, ns)
|
||||
return json.dumps(ret, ensure_ascii=False, default=str)
|
||||
70
wwwroot/billing.ui
Normal file
70
wwwroot/billing.ui
Normal file
@ -0,0 +1,70 @@
|
||||
{% set start_date = params_kw.get('start_date', '') %}
|
||||
{% set end_date = params_kw.get('end_date', '') %}
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"css":"card",
|
||||
"cwidth":30,
|
||||
"gap":"8px"
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"Title6",
|
||||
"options":{
|
||||
"text":"账单查询"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Form",
|
||||
"options":{
|
||||
"fields":[
|
||||
{
|
||||
"name":"start_date",
|
||||
"label":"开始日期",
|
||||
"uitype":"str",
|
||||
"value":"{{start_date}}"
|
||||
},
|
||||
{
|
||||
"name":"end_date",
|
||||
"label":"结束日期",
|
||||
"uitype":"str",
|
||||
"value":"{{end_date}}"
|
||||
}
|
||||
],
|
||||
"buttons":[
|
||||
{
|
||||
"name":"query",
|
||||
"label":"查询",
|
||||
"bgcolor":"#1890ff"
|
||||
}
|
||||
]
|
||||
},
|
||||
"binds":[
|
||||
{
|
||||
"wid":"self",
|
||||
"event":"submit",
|
||||
"actiontype":"urlwidget",
|
||||
"target":"self",
|
||||
"options":{
|
||||
"url":"{{entire_url('/accounting/billing.ui')}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
{% if start_date and end_date %}
|
||||
,{
|
||||
"widgettype":"DataViewer",
|
||||
"options":{
|
||||
"data_url":"{{entire_url('/accounting/billing.dspy')}}",
|
||||
"data_params":{
|
||||
"start_date":"{{start_date}}",
|
||||
"end_date":"{{end_date}}"
|
||||
},
|
||||
"editable":false,
|
||||
"page_size":30
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user