feat: 对账与明细对账页面重构 - 对账: 按产品汇总的单边明细发生统计(supplychain_accounting + accounting_log) - 明细对账: 逐笔核对(supplychain_accounting每笔记录) - 分销商维度看dist_amount, 供应商维度看supply_amount - 核对状态: 待核对/我方单边/对方单边/一致

This commit is contained in:
Hermes Agent 2026-06-18 13:47:35 +08:00
parent fa57ab7092
commit a175d79cc2
8 changed files with 778 additions and 581 deletions

View File

@ -0,0 +1,87 @@
ns = params_kw.copy()
ns['page'] = ns.get('page') or 1
ns['sort'] = ns.get('sort') or 'sale_date'
date_start = ns.get('date_start', '')
date_end = ns.get('date_end', '')
supplier_id = ns.get('supplier_id', '')
sc_dbname = get_module_dbname('supplychain')
acc_dbname = get_module_dbname('accounting')
# 我方逐笔: supplychain_accounting (供应商维度看supply_amount)
sc_where = "WHERE 1=1"
sc_params = {}
if date_start:
sc_where += " AND sa.sale_date >= ${date_start}$"
sc_params['date_start'] = date_start
if date_end:
sc_where += " AND sa.sale_date <= ${date_end}$"
sc_params['date_end'] = date_end
if supplier_id:
sc_where += " AND sa.supplier_id = ${supplier_id}$"
sc_params['supplier_id'] = supplier_id
sc_sql = f"""
SELECT
sa.id,
sa.sale_date,
sa.productid,
p.name as product_name,
sa.supplier_id,
sp.supplier_name,
sa.quantity,
sa.unit_price,
sa.supply_discount,
sa.supply_amount,
sa.dist_amount,
sa.source_type,
sa.source_id
FROM supplychain_accounting sa
LEFT JOIN product p ON sa.productid = p.id COLLATE utf8mb4_unicode_ci
LEFT JOIN suppliers sp ON sa.supplier_id = sp.id COLLATE utf8mb4_unicode_ci
{sc_where}
ORDER BY sa.sale_date DESC, sa.id
"""
db = DBPools()
rows = []
async with db.sqlorContext(sc_dbname) as sc_sor:
sc_recs = await sc_sor.sqlExe(sc_sql, sc_params)
for r in (sc_recs or []):
rid = r.id
rows.append({
'id': rid,
'record_type': 'supplychain',
'sale_date': str(r.sale_date or ''),
'product_name': r.product_name or '',
'counterparty': r.supplier_name or '',
'quantity': float(r.quantity or 0),
'unit_price': float(r.unit_price or 0),
'our_amount': float(r.supply_amount or 0),
'their_amount': 0,
'diff_amount': float(r.supply_amount or 0),
'match_status': '0',
'source_id': r.source_id or '',
'source_type': r.source_type or ''
})
total = len(rows)
debug(f'get_provider_detail_reconcile: {total} records')
return json.dumps({
'success': True,
'total': total,
'rows': rows,
'summary': {
'our_count': total,
'our_total': sum(r['our_amount'] for r in rows),
'matched_count': 0,
'unmatched_count': total,
'their_count': 0,
'their_total': 0
}
}, ensure_ascii=False, default=str)

View File

@ -0,0 +1,141 @@
ns = params_kw.copy()
ns['page'] = ns.get('page') or 1
ns['sort'] = ns.get('sort') or 'sale_date'
date_start = ns.get('date_start', '')
date_end = ns.get('date_end', '')
supplier_id = ns.get('supplier_id', '')
userorgid = await get_userorgid()
sc_dbname = get_module_dbname('supplychain')
acc_dbname = get_module_dbname('accounting')
# 我方: supplychain_accounting 按产品汇总
sc_where = "WHERE 1=1"
sc_params = {}
if date_start:
sc_where += " AND sa.sale_date >= ${date_start}$"
sc_params['date_start'] = date_start
if date_end:
sc_where += " AND sa.sale_date <= ${date_end}$"
sc_params['date_end'] = date_end
if supplier_id:
sc_where += " AND sa.supplier_id = ${supplier_id}$"
sc_params['supplier_id'] = supplier_id
sc_sql = f"""
SELECT
sa.productid,
p.name as productid_text,
COUNT(*) as tx_count,
SUM(sa.quantity) as total_qty,
SUM(sa.supply_amount) as our_supply_amount,
SUM(sa.dist_amount) as dist_total_amount,
SUM(sa.profit_amount) as profit_total_amount
FROM supplychain_accounting sa
LEFT JOIN product p ON sa.productid = p.id COLLATE utf8mb4_unicode_ci
{sc_where}
GROUP BY sa.productid, p.name
ORDER BY p.name
"""
# 我方账务: bill_detail中供应商相关的记账
acc_sql = """
SELECT
bd.subjectname,
bd.subjectname as subjectname_text,
COUNT(*) as acc_tx_count,
SUM(CASE WHEN bd.accounting_dir = 'D' THEN bd.amount ELSE 0 END) as acc_debit,
SUM(CASE WHEN bd.accounting_dir = 'C' THEN bd.amount ELSE 0 END) as acc_credit
FROM bill_detail bd
INNER JOIN bill b ON bd.billid = b.id COLLATE utf8mb4_unicode_ci
WHERE bd.participanttype = 'supplier'
"""
acc_params = {}
if date_start:
acc_sql += " AND b.bill_date >= ${date_start}$"
acc_params['date_start'] = date_start
if date_end:
acc_sql += " AND b.bill_date <= ${date_end}$"
acc_params['date_end'] = date_end
if supplier_id:
acc_sql += " AND bd.participantid = ${supplier_id}$"
acc_params['supplier_id'] = supplier_id
acc_sql += " GROUP BY bd.subjectname ORDER BY bd.subjectname"
# 已结算: sales_ledger中settlement_status='1'且与供应商相关的
settled_sql = f"""
SELECT
COALESCE(SUM(supply_amount), 0) as settled_supply_amount,
COUNT(*) as settled_count
FROM sales_ledger
WHERE settlement_status = '1'
"""
if date_start:
settled_sql += " AND sale_date >= ${date_start}$"
if date_end:
settled_sql += " AND sale_date <= ${date_end}$"
if supplier_id:
settled_sql += " AND supplier_id = ${supplier_id}$"
db = DBPools()
rows = []
async with db.sqlorContext(sc_dbname) as sc_sor:
sc_recs = await sc_sor.sqlExe(sc_sql, sc_params)
settled_recs = await sc_sor.sqlExe(settled_sql, sc_params)
async with db.sqlorContext(acc_dbname) as acc_sor:
acc_recs = await acc_sor.sqlExe(acc_sql, acc_params)
# 我方交易明细行(按产品汇总)
for r in (sc_recs or []):
row = {
'id': r.productid or '',
'productid': r.productid or '',
'productid_text': r.productid_text or '',
'category': '我方交易',
'tx_count': int(r.tx_count or 0),
'total_qty': float(r.total_qty or 0),
'our_amount': float(r.our_supply_amount or 0),
'their_amount': 0,
'diff_amount': float(r.our_supply_amount or 0),
'match_status': '1'
}
rows.append(row)
# 我方账务汇总行
for r in (acc_recs or []):
row = {
'id': r.subjectname or '',
'productid': '',
'productid_text': r.subjectname or '',
'category': '我方账务',
'tx_count': int(r.acc_tx_count or 0),
'total_qty': 0,
'our_amount': float(r.acc_debit or 0) - float(r.acc_credit or 0),
'their_amount': 0,
'diff_amount': float(r.acc_debit or 0) - float(r.acc_credit or 0),
'match_status': '1'
}
rows.append(row)
total = len(rows)
our_supply_total = sum(r['our_amount'] for r in rows if r['category'] == '我方交易')
settled_supply = float(settled_recs[0].settled_supply_amount) if settled_recs else 0
unsettled_supply = our_supply_total - settled_supply
debug(f'get_provider_reconcile: rows={total}, our_supply={our_supply_total}, settled={settled_supply}')
return json.dumps({
'success': True,
'total': total,
'rows': rows,
'summary': {
'our_total': our_supply_total,
'settled': settled_supply,
'unsettled': unsettled_supply,
'tx_count': total
}
}, ensure_ascii=False, default=str)

View File

@ -0,0 +1,121 @@
ns = params_kw.copy()
ns['page'] = ns.get('page') or 1
ns['sort'] = ns.get('sort') or 'sale_date'
date_start = ns.get('date_start', '')
date_end = ns.get('date_end', '')
sub_reseller_id = ns.get('sub_reseller_id', '')
sc_dbname = get_module_dbname('supplychain')
acc_dbname = get_module_dbname('accounting')
# 我方逐笔: supplychain_accounting
sc_where = "WHERE 1=1"
sc_params = {}
if date_start:
sc_where += " AND sa.sale_date >= ${date_start}$"
sc_params['date_start'] = date_start
if date_end:
sc_where += " AND sa.sale_date <= ${date_end}$"
sc_params['date_end'] = date_end
if sub_reseller_id:
sc_where += " AND sa.sub_distributor_id = ${sub_reseller_id}$"
sc_params['sub_reseller_id'] = sub_reseller_id
sc_sql = f"""
SELECT
sa.id,
sa.sale_date,
sa.productid,
p.name as product_name,
sa.sub_distributor_id,
sr.sub_reseller_name as sub_distributor_name,
sa.quantity,
sa.unit_price,
sa.dist_discount,
sa.dist_amount,
sa.supply_amount,
sa.source_type,
sa.source_id
FROM supplychain_accounting sa
LEFT JOIN product p ON sa.productid = p.id COLLATE utf8mb4_unicode_ci
LEFT JOIN sub_resellers sr ON sa.sub_distributor_id = sr.id COLLATE utf8mb4_unicode_ci
{sc_where}
ORDER BY sa.sale_date DESC, sa.id
"""
# 我方账务逐笔: acc_detail关联bill
acc_where = "WHERE 1=1"
acc_params = {}
if date_start:
acc_where += " AND ad.acc_date >= ${date_start}$"
acc_params['date_start'] = date_start
if date_end:
acc_where += " AND ad.acc_date <= ${date_end}$"
acc_params['date_end'] = date_end
acc_sql = f"""
SELECT
ad.id,
ad.acc_date as sale_date,
ad.acclogid,
ad.acc_dir,
ad.amount,
ad.summary,
bd.subjectname,
bd.participantid,
bd.participanttype,
b.id as billid,
b.business_op,
b.resellerid
FROM acc_detail ad
LEFT JOIN bill_detail bd ON ad.acclogid = bd.id COLLATE utf8mb4_unicode_ci
LEFT JOIN bill b ON bd.billid = b.id COLLATE utf8mb4_unicode_ci
{acc_where}
ORDER BY ad.acc_date DESC, ad.id
"""
db = DBPools()
rows = []
async with db.sqlorContext(sc_dbname) as sc_sor:
sc_recs = await sc_sor.sqlExe(sc_sql, sc_params)
# 构建我方交易明细
our_records = {}
for r in (sc_recs or []):
rid = r.id
our_records[rid] = {
'id': rid,
'record_type': 'supplychain',
'sale_date': str(r.sale_date or ''),
'product_name': r.product_name or '',
'counterparty': r.sub_distributor_name or '',
'quantity': float(r.quantity or 0),
'unit_price': float(r.unit_price or 0),
'our_amount': float(r.dist_amount or 0),
'their_amount': 0,
'diff_amount': float(r.dist_amount or 0),
'match_status': '0',
'source_id': r.source_id or '',
'source_type': r.source_type or ''
}
rows.append(our_records[rid])
total = len(rows)
debug(f'get_reseller_detail_reconcile: {total} records')
return json.dumps({
'success': True,
'total': total,
'rows': rows,
'summary': {
'our_count': total,
'our_total': sum(r['our_amount'] for r in rows),
'matched_count': 0,
'unmatched_count': total,
'their_count': 0,
'their_total': 0
}
}, ensure_ascii=False, default=str)

View File

@ -0,0 +1,142 @@
ns = params_kw.copy()
ns['page'] = ns.get('page') or 1
ns['sort'] = ns.get('sort') or 'sale_date'
date_start = ns.get('date_start', '')
date_end = ns.get('date_end', '')
sub_reseller_id = ns.get('sub_reseller_id', '')
userorgid = await get_userorgid()
sc_dbname = get_module_dbname('supplychain')
acc_dbname = get_module_dbname('accounting')
# 我方: supplychain_accounting 按产品汇总
sc_where = "WHERE 1=1"
sc_params = {}
if date_start:
sc_where += " AND sa.sale_date >= ${date_start}$"
sc_params['date_start'] = date_start
if date_end:
sc_where += " AND sa.sale_date <= ${date_end}$"
sc_params['date_end'] = date_end
if sub_reseller_id:
sc_where += " AND sa.sub_distributor_id = ${sub_reseller_id}$"
sc_params['sub_reseller_id'] = sub_reseller_id
sc_sql = f"""
SELECT
sa.productid,
p.name as productid_text,
COUNT(*) as tx_count,
SUM(sa.quantity) as total_qty,
SUM(sa.dist_amount) as our_total_amount,
SUM(sa.supply_amount) as supply_total_amount,
SUM(sa.profit_amount) as profit_total_amount
FROM supplychain_accounting sa
LEFT JOIN product p ON sa.productid = p.id COLLATE utf8mb4_unicode_ci
{sc_where}
GROUP BY sa.productid, p.name
ORDER BY p.name
"""
# 我方账务: accounting_log 中与该分销商相关的记账汇总
acc_sql = """
SELECT
bd.subjectname,
bd.subjectname as subjectname_text,
COUNT(*) as acc_tx_count,
SUM(CASE WHEN bd.accounting_dir = 'D' THEN bd.amount ELSE 0 END) as acc_debit,
SUM(CASE WHEN bd.accounting_dir = 'C' THEN bd.amount ELSE 0 END) as acc_credit
FROM bill_detail bd
INNER JOIN bill b ON bd.billid = b.id COLLATE utf8mb4_unicode_ci
WHERE b.resellerid = ${userorgid}$
"""
acc_params = {'userorgid': userorgid}
if date_start:
acc_sql += " AND b.bill_date >= ${date_start}$"
acc_params['date_start'] = date_start
if date_end:
acc_sql += " AND b.bill_date <= ${date_end}$"
acc_params['date_end'] = date_end
acc_sql += " GROUP BY bd.subjectname ORDER BY bd.subjectname"
# 已结算金额: sales_ledger中settlement_status='1'的记录
settled_sql = f"""
SELECT
COALESCE(SUM(distribution_amount), 0) as settled_dist_amount,
COALESCE(SUM(supply_amount), 0) as settled_supply_amount,
COUNT(*) as settled_count
FROM sales_ledger
WHERE settlement_status = '1'
"""
if date_start:
settled_sql += " AND sale_date >= ${date_start}$"
if date_end:
settled_sql += " AND sale_date <= ${date_end}$"
if sub_reseller_id:
settled_sql += " AND sub_reseller_id = ${sub_reseller_id}$"
db = DBPools()
rows = []
total = 0
async with db.sqlorContext(sc_dbname) as sc_sor:
sc_recs = await sc_sor.sqlExe(sc_sql, sc_params)
settled_recs = await sc_sor.sqlExe(settled_sql, sc_params)
async with db.sqlorContext(acc_dbname) as acc_sor:
acc_recs = await acc_sor.sqlExe(acc_sql, acc_params)
# 组装我方产品明细行
for r in (sc_recs or []):
row = {
'id': r.productid or '',
'productid': r.productid or '',
'productid_text': r.productid_text or '',
'category': '我方交易',
'tx_count': int(r.tx_count or 0),
'total_qty': float(r.total_qty or 0),
'our_amount': float(r.our_total_amount or 0),
'their_amount': 0,
'diff_amount': float(r.our_total_amount or 0),
'match_status': '1'
}
rows.append(row)
# 组装我方账务汇总行
for r in (acc_recs or []):
row = {
'id': r.subjectname or '',
'productid': '',
'productid_text': r.subjectname or '',
'category': '我方账务',
'tx_count': int(r.acc_tx_count or 0),
'total_qty': 0,
'our_amount': float(r.acc_debit or 0) - float(r.acc_credit or 0),
'their_amount': 0,
'diff_amount': float(r.acc_debit or 0) - float(r.acc_credit or 0),
'match_status': '1'
}
rows.append(row)
total = len(rows)
# 汇总统计
our_dist_total = sum(r['our_amount'] for r in rows if r['category'] == '我方交易')
settled_dist = float(settled_recs[0].settled_dist_amount) if settled_recs else 0
unsettled_dist = our_dist_total - settled_dist
debug(f'get_reseller_reconcile: rows={total}, our_dist={our_dist_total}, settled={settled_dist}')
return json.dumps({
'success': True,
'total': total,
'rows': rows,
'summary': {
'our_total': our_dist_total,
'settled': settled_dist,
'unsettled': unsettled_dist,
'tx_count': total
}
}, ensure_ascii=False, default=str)

View File

@ -1,81 +1,44 @@
{
"widgettype": "VBox",
"options": {
"cheight": 40,
"width": "100%",
"padding": "16px"
"height": "100%",
"padding": "8px",
"gap": "8px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "供应商明细对账",
"fontSize": "20px",
"fontWeight": "bold",
"color": "#F1F5F9",
"marginBottom": "16px"
}
"options": {"text": "供应商明细对账", "i18n": true}
},
{
"widgettype": "HBox",
"widgettype": "Text",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"gap": "16px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "已匹配: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "未匹配: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "差异金额: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
}
]
"text": "我方账务明细逐笔与供应商方明细核对,差异笔标红",
"color": "#94A3B8",
"fontSize": "12px"
}
},
{
"id": "provider_detail_form",
"widgettype": "InlineForm",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"css": "card",
"padding": "8px",
"submit_label": "查询",
"submit_css": "primary",
"fields": [
{
"name": "date_start",
"uitype": "date",
"label": "开始日期",
"cwidth": 10,
"value": "{{strdate_add(monthfirstday(), months=-1)}}",
"required": true
"cwidth": 10
},
{
"name": "date_end",
"uitype": "date",
"label": "结束日期",
"cwidth": 10,
"value": "{{monthfirstday()}}",
"required": true
"cwidth": 10
},
{
"name": "supplier_id",
@ -93,21 +56,15 @@
"textField": "supplier_id_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "match_status",
"uitype": "code",
"label": "匹配状态",
"cwidth": 8,
"data": [
{"value": "", "text": "全部"},
{"value": "0", "text": "未匹配"},
{"value": "1", "text": "已匹配"},
{"value": "2", "text": "有差异"}
]
}
]
}
},
"binds": [{
"wid": "self",
"event": "submit",
"actiontype": "script",
"script": "var tbl = bricks.getWidgetById('provider_detail_tbl', bricks.app.root); if(tbl) await tbl.render(params);"
}]
},
{
"id": "provider_detail_tbl",
@ -115,67 +72,48 @@
"options": {
"width": "100%",
"height": "100%",
"title": "供应商明细对账",
"css": "card",
"bgcolor": "#1E293B",
"data_url": "{{entire_url('./get_provider_detail_reconcile.dspy')}}",
"data_method": "GET",
"data_params": {{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options": {
"browserfields": {
"exclouded": ["id"]
"exclouded": ["id", "record_type", "source_id", "source_type"]
},
"fields": [
{
"name": "id",
"title": "ID",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "ID"
"label": "ID",
"cwidth": 14
},
{
"name": "purchase_date",
"title": "采购日期",
"name": "sale_date",
"title": "交易日期",
"type": "date",
"length": 0,
"uitype": "date",
"datatype": "date",
"label": "采购日期",
"label": "交易日期",
"cwidth": 10
},
{
"name": "supplier_id",
"title": "供应商",
"type": "str",
"length": 32,
"label": "供应商",
"uitype": "code",
"valueField": "supplier_id",
"textField": "supplier_id_text",
"params": {
"dbname": "{{get_module_dbname('supplychain')}}",
"table": "suppliers",
"tblvalue": "id",
"tbltext": "supplier_name",
"valueField": "supplier_id",
"textField": "supplier_id_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
"cwidth": 15
},
{
"name": "product_name",
"title": "产品名称",
"title": "产品",
"type": "str",
"length": 100,
"cwidth": 15,
"uitype": "str",
"datatype": "str",
"label": "产品名称"
"label": "产品",
"cwidth": 14
},
{
"name": "counterparty",
"title": "供应商",
"type": "str",
"length": 100,
"uitype": "str",
"label": "供应商",
"cwidth": 12
},
{
"name": "quantity",
@ -183,10 +121,9 @@
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 8,
"uitype": "float",
"datatype": "double",
"label": "数量"
"label": "数量",
"cwidth": 8
},
{
"name": "unit_price",
@ -194,87 +131,58 @@
"type": "double",
"length": 15,
"dec": 4,
"cwidth": 10,
"uitype": "float",
"datatype": "double",
"label": "单价"
"label": "单价",
"cwidth": 8
},
{
"name": "our_amount",
"title": "我方金额",
"title": "我方金额(应付)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 12,
"uitype": "float",
"datatype": "double",
"label": "我方金额"
"label": "我方金额(应付)",
"cwidth": 10
},
{
"name": "their_amount",
"title": "对方金额",
"title": "对方金额(应收)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 12,
"uitype": "float",
"datatype": "double",
"label": "对方金额"
"label": "对方金额(应收)",
"cwidth": 10
},
{
"name": "difference",
"name": "diff_amount",
"title": "差异",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 10,
"uitype": "float",
"datatype": "double",
"label": "差异"
"label": "差异",
"cwidth": 8
},
{
"name": "match_status",
"title": "匹配状态",
"type": "char",
"length": 1,
"cwidth": 8,
"uitype": "code",
"datatype": "char",
"label": "匹配状态",
"data": [
{"value": "0", "text": "未匹配"},
{"value": "1", "text": "已匹配"},
{"value": "2", "text": "有差异"}
]
},
{
"name": "reference_no",
"title": "参考单号",
"title": "核对",
"type": "str",
"length": 50,
"cwidth": 15,
"uitype": "str",
"datatype": "str",
"label": "参考单号"
"length": 1,
"uitype": "code",
"label": "核对",
"cwidth": 6,
"data": [
{"value": "0", "text": "待核对"},
{"value": "1", "text": "我方单边"},
{"value": "2", "text": "对方单边"},
{"value": "3", "text": "一致"}
]
}
]
},
"data_filter": {
"AND": [
{"field": "purchase_date", "op": ">=", "var": "date_start"},
{"field": "purchase_date", "op": "<=", "var": "date_end"},
{"field": "supplier_id", "op": "=", "var": "supplier_id"},
{"field": "match_status", "op": "=", "var": "match_status"}
]
},
"filter_labels": {
"date_start": "开始日期",
"date_end": "结束日期",
"supplier_id": "供应商",
"match_status": "匹配状态"
},
"page_rows": 160,
"cache_limit": 5
"page_rows": 200
}
}
]

View File

@ -1,81 +1,44 @@
{
"widgettype": "VBox",
"options": {
"cheight": 40,
"width": "100%",
"padding": "16px"
"height": "100%",
"padding": "8px",
"gap": "8px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "供应商对账",
"fontSize": "20px",
"fontWeight": "bold",
"color": "#F1F5F9",
"marginBottom": "16px"
}
"options": {"text": "供应商对账", "i18n": true}
},
{
"widgettype": "HBox",
"widgettype": "Text",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"gap": "16px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "总应付款: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "已结算: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "未结算: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
}
]
"text": "结算周期内我方供销账务单边明细发生统计(按产品汇总),与供应商数据进行核对",
"color": "#94A3B8",
"fontSize": "12px"
}
},
{
"id": "provider_reconcile_form",
"widgettype": "InlineForm",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"css": "card",
"padding": "8px",
"submit_label": "查询",
"submit_css": "primary",
"fields": [
{
"name": "date_start",
"uitype": "date",
"label": "开始日期",
"cwidth": 10,
"value": "{{strdate_add(monthfirstday(), months=-1)}}",
"required": true
"cwidth": 10
},
{
"name": "date_end",
"uitype": "date",
"label": "结束日期",
"cwidth": 10,
"value": "{{monthfirstday()}}",
"required": true
"cwidth": 10
},
{
"name": "supplier_id",
@ -95,7 +58,13 @@
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
}
]
}
},
"binds": [{
"wid": "self",
"event": "submit",
"actiontype": "script",
"script": "var tbl = bricks.getWidgetById('provider_reconcile_tbl', bricks.app.root); if(tbl) await tbl.render(params);"
}]
},
{
"id": "provider_reconcile_tbl",
@ -103,131 +72,107 @@
"options": {
"width": "100%",
"height": "100%",
"title": "供应商对账汇总",
"css": "card",
"bgcolor": "#1E293B",
"data_url": "{{entire_url('./get_provider_reconcile.dspy')}}",
"data_method": "GET",
"data_params": {{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options": {
"browserfields": {
"exclouded": ["id"]
"exclouded": ["id", "record_type"]
},
"fields": [
{
"name": "id",
"title": "ID",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "ID"
"label": "ID",
"cwidth": 10
},
{
"name": "supplier_id",
"title": "供应商",
"name": "category",
"title": "类别",
"type": "str",
"length": 32,
"label": "供应商",
"uitype": "code",
"valueField": "supplier_id",
"textField": "supplier_id_text",
"params": {
"dbname": "{{get_module_dbname('supplychain')}}",
"table": "suppliers",
"tblvalue": "id",
"tbltext": "supplier_name",
"valueField": "supplier_id",
"textField": "supplier_id_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
"cwidth": 20
},
{
"name": "reconcile_period",
"title": "对账周期",
"type": "str",
"length": 30,
"cwidth": 15,
"length": 20,
"uitype": "str",
"datatype": "str",
"label": "对账周期"
"label": "类别",
"cwidth": 8
},
{
"name": "total_amount",
"title": "总金额",
"name": "productid_text",
"title": "产品",
"type": "str",
"length": 100,
"uitype": "str",
"label": "产品",
"cwidth": 15
},
{
"name": "tx_count",
"title": "交易笔数",
"type": "int",
"uitype": "int",
"label": "交易笔数",
"cwidth": 8
},
{
"name": "total_qty",
"title": "数量",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 15,
"uitype": "float",
"datatype": "double",
"label": "总金额"
"label": "数量",
"cwidth": 8
},
{
"name": "settled_amount",
"title": "已结算金额",
"name": "our_amount",
"title": "我方金额(应付)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 15,
"uitype": "float",
"datatype": "double",
"label": "已结算金额"
"label": "我方金额(应付)",
"cwidth": 12
},
{
"name": "unsettled_amount",
"title": "未结算金额",
"name": "their_amount",
"title": "对方金额(应收)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 15,
"uitype": "float",
"datatype": "double",
"label": "未结算金额"
"label": "对方金额(应收)",
"cwidth": 12
},
{
"name": "reconcile_status",
"title": "对账状态",
"type": "char",
"name": "diff_amount",
"title": "差异金额",
"type": "double",
"length": 15,
"dec": 2,
"uitype": "float",
"label": "差异金额",
"cwidth": 10
},
{
"name": "match_status",
"title": "核对状态",
"type": "str",
"length": 1,
"cwidth": 8,
"uitype": "code",
"datatype": "char",
"label": "对账状态",
"label": "核对状态",
"cwidth": 8,
"data": [
{"value": "0", "text": "待对账"},
{"value": "1", "text": "已确认"},
{"value": "2", "text": "有差异"}
{"value": "0", "text": "待核对"},
{"value": "1", "text": "我方单边"},
{"value": "2", "text": "对方单边"},
{"value": "3", "text": "一致"}
]
},
{
"name": "created_at",
"title": "创建时间",
"type": "datetime",
"length": 0,
"uitype": "str",
"datatype": "datetime",
"label": "创建时间"
}
]
},
"data_filter": {
"AND": [
{"field": "date_start", "op": ">=", "var": "date_start"},
{"field": "date_end", "op": "<=", "var": "date_end"},
{"field": "supplier_id", "op": "=", "var": "supplier_id"}
]
},
"filter_labels": {
"date_start": "开始日期",
"date_end": "结束日期",
"supplier_id": "供应商"
},
"page_rows": 160,
"cache_limit": 5
"page_rows": 200
}
}
]

View File

@ -1,81 +1,44 @@
{
"widgettype": "VBox",
"options": {
"cheight": 40,
"width": "100%",
"padding": "16px"
"height": "100%",
"padding": "8px",
"gap": "8px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "明细对账",
"fontSize": "20px",
"fontWeight": "bold",
"color": "#F1F5F9",
"marginBottom": "16px"
}
"options": {"text": "分销商明细对账", "i18n": true}
},
{
"widgettype": "HBox",
"widgettype": "Text",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"gap": "16px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "已匹配: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "未匹配: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "差异金额: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
}
]
"text": "我方账务明细逐笔与分销商方明细核对,差异笔标红",
"color": "#94A3B8",
"fontSize": "12px"
}
},
{
"id": "reseller_detail_form",
"widgettype": "InlineForm",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"css": "card",
"padding": "8px",
"submit_label": "查询",
"submit_css": "primary",
"fields": [
{
"name": "date_start",
"uitype": "date",
"label": "开始日期",
"cwidth": 10,
"value": "{{strdate_add(monthfirstday(), months=-1)}}",
"required": true
"cwidth": 10
},
{
"name": "date_end",
"uitype": "date",
"label": "结束日期",
"cwidth": 10,
"value": "{{monthfirstday()}}",
"required": true
"cwidth": 10
},
{
"name": "sub_reseller_id",
@ -93,21 +56,15 @@
"textField": "sub_reseller_id_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "match_status",
"uitype": "code",
"label": "匹配状态",
"cwidth": 8,
"data": [
{"value": "", "text": "全部"},
{"value": "0", "text": "未匹配"},
{"value": "1", "text": "已匹配"},
{"value": "2", "text": "有差异"}
]
}
]
}
},
"binds": [{
"wid": "self",
"event": "submit",
"actiontype": "script",
"script": "var tbl = bricks.getWidgetById('reseller_detail_tbl', bricks.app.root); if(tbl) await tbl.render(params);"
}]
},
{
"id": "reseller_detail_tbl",
@ -115,67 +72,48 @@
"options": {
"width": "100%",
"height": "100%",
"title": "分销商明细对账",
"css": "card",
"bgcolor": "#1E293B",
"data_url": "{{entire_url('./get_reseller_detail_reconcile.dspy')}}",
"data_method": "GET",
"data_params": {{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options": {
"browserfields": {
"exclouded": ["id"]
"exclouded": ["id", "record_type", "source_id", "source_type"]
},
"fields": [
{
"name": "id",
"title": "ID",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "ID"
"label": "ID",
"cwidth": 14
},
{
"name": "sale_date",
"title": "销售日期",
"title": "交易日期",
"type": "date",
"length": 0,
"uitype": "date",
"datatype": "date",
"label": "销售日期",
"label": "交易日期",
"cwidth": 10
},
{
"name": "sub_reseller_id",
"title": "二级分销商",
"type": "str",
"length": 32,
"label": "二级分销商",
"uitype": "code",
"valueField": "sub_reseller_id",
"textField": "sub_reseller_id_text",
"params": {
"dbname": "{{get_module_dbname('supplychain')}}",
"table": "sub_resellers",
"tblvalue": "id",
"tbltext": "sub_reseller_name",
"valueField": "sub_reseller_id",
"textField": "sub_reseller_id_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
"cwidth": 15
},
{
"name": "product_name",
"title": "产品名称",
"title": "产品",
"type": "str",
"length": 100,
"cwidth": 15,
"uitype": "str",
"datatype": "str",
"label": "产品名称"
"label": "产品",
"cwidth": 14
},
{
"name": "counterparty",
"title": "分销商",
"type": "str",
"length": 100,
"uitype": "str",
"label": "分销商",
"cwidth": 12
},
{
"name": "quantity",
@ -183,10 +121,9 @@
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 8,
"uitype": "float",
"datatype": "double",
"label": "数量"
"label": "数量",
"cwidth": 8
},
{
"name": "unit_price",
@ -194,87 +131,58 @@
"type": "double",
"length": 15,
"dec": 4,
"cwidth": 10,
"uitype": "float",
"datatype": "double",
"label": "单价"
"label": "单价",
"cwidth": 8
},
{
"name": "our_amount",
"title": "我方金额",
"title": "我方金额(应收)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 12,
"uitype": "float",
"datatype": "double",
"label": "我方金额"
"label": "我方金额(应收)",
"cwidth": 10
},
{
"name": "their_amount",
"title": "对方金额",
"title": "对方金额(应付)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 12,
"uitype": "float",
"datatype": "double",
"label": "对方金额"
"label": "对方金额(应付)",
"cwidth": 10
},
{
"name": "difference",
"name": "diff_amount",
"title": "差异",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 10,
"uitype": "float",
"datatype": "double",
"label": "差异"
"label": "差异",
"cwidth": 8
},
{
"name": "match_status",
"title": "匹配状态",
"type": "char",
"length": 1,
"cwidth": 8,
"uitype": "code",
"datatype": "char",
"label": "匹配状态",
"data": [
{"value": "0", "text": "未匹配"},
{"value": "1", "text": "已匹配"},
{"value": "2", "text": "有差异"}
]
},
{
"name": "reference_no",
"title": "参考单号",
"title": "核对",
"type": "str",
"length": 50,
"cwidth": 15,
"uitype": "str",
"datatype": "str",
"label": "参考单号"
"length": 1,
"uitype": "code",
"label": "核对",
"cwidth": 6,
"data": [
{"value": "0", "text": "待核对"},
{"value": "1", "text": "我方单边"},
{"value": "2", "text": "对方单边"},
{"value": "3", "text": "一致"}
]
}
]
},
"data_filter": {
"AND": [
{"field": "sale_date", "op": ">=", "var": "date_start"},
{"field": "sale_date", "op": "<=", "var": "date_end"},
{"field": "sub_reseller_id", "op": "=", "var": "sub_reseller_id"},
{"field": "match_status", "op": "=", "var": "match_status"}
]
},
"filter_labels": {
"date_start": "开始日期",
"date_end": "结束日期",
"sub_reseller_id": "二级分销商",
"match_status": "匹配状态"
},
"page_rows": 160,
"cache_limit": 5
"page_rows": 200
}
}
]

View File

@ -1,81 +1,44 @@
{
"widgettype": "VBox",
"options": {
"cheight": 40,
"width": "100%",
"padding": "16px"
"height": "100%",
"padding": "8px",
"gap": "8px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "分销商对账",
"fontSize": "20px",
"fontWeight": "bold",
"color": "#F1F5F9",
"marginBottom": "16px"
}
"options": {"text": "分销商对账", "i18n": true}
},
{
"widgettype": "HBox",
"widgettype": "Text",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"gap": "16px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "总应付款: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "已结算: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
},
{
"widgettype": "Text",
"options": {
"text": "未结算: --",
"fontSize": "14px",
"color": "#F1F5F9"
}
}
]
"text": "结算周期内我方供销账务单边明细发生统计(按产品汇总),与分销商数据进行核对",
"color": "#94A3B8",
"fontSize": "12px"
}
},
{
"id": "reseller_reconcile_form",
"widgettype": "InlineForm",
"options": {
"bgcolor": "#1E293B",
"padding": "12px",
"borderRadius": "8px",
"marginBottom": "12px",
"css": "card",
"padding": "8px",
"submit_label": "查询",
"submit_css": "primary",
"fields": [
{
"name": "date_start",
"uitype": "date",
"label": "开始日期",
"cwidth": 10,
"value": "{{strdate_add(monthfirstday(), months=-1)}}",
"required": true
"cwidth": 10
},
{
"name": "date_end",
"uitype": "date",
"label": "结束日期",
"cwidth": 10,
"value": "{{monthfirstday()}}",
"required": true
"cwidth": 10
},
{
"name": "sub_reseller_id",
@ -95,7 +58,13 @@
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
}
]
}
},
"binds": [{
"wid": "self",
"event": "submit",
"actiontype": "script",
"script": "var tbl = bricks.getWidgetById('reseller_reconcile_tbl', bricks.app.root); if(tbl) await tbl.render(params);"
}]
},
{
"id": "reseller_reconcile_tbl",
@ -103,131 +72,107 @@
"options": {
"width": "100%",
"height": "100%",
"title": "分销商对账汇总",
"css": "card",
"bgcolor": "#1E293B",
"data_url": "{{entire_url('./get_reseller_reconcile.dspy')}}",
"data_method": "GET",
"data_params": {{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options": {
"browserfields": {
"exclouded": ["id"]
"exclouded": ["id", "record_type"]
},
"fields": [
{
"name": "id",
"title": "ID",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "ID"
"label": "ID",
"cwidth": 10
},
{
"name": "sub_reseller_id",
"title": "二级分销商",
"name": "category",
"title": "类别",
"type": "str",
"length": 32,
"label": "二级分销商",
"uitype": "code",
"valueField": "sub_reseller_id",
"textField": "sub_reseller_id_text",
"params": {
"dbname": "{{get_module_dbname('supplychain')}}",
"table": "sub_resellers",
"tblvalue": "id",
"tbltext": "sub_reseller_name",
"valueField": "sub_reseller_id",
"textField": "sub_reseller_id_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
"cwidth": 20
},
{
"name": "reconcile_period",
"title": "对账周期",
"type": "str",
"length": 30,
"cwidth": 15,
"length": 20,
"uitype": "str",
"datatype": "str",
"label": "对账周期"
"label": "类别",
"cwidth": 8
},
{
"name": "total_amount",
"title": "总金额",
"name": "productid_text",
"title": "产品",
"type": "str",
"length": 100,
"uitype": "str",
"label": "产品",
"cwidth": 15
},
{
"name": "tx_count",
"title": "交易笔数",
"type": "int",
"uitype": "int",
"label": "交易笔数",
"cwidth": 8
},
{
"name": "total_qty",
"title": "数量",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 15,
"uitype": "float",
"datatype": "double",
"label": "总金额"
"label": "数量",
"cwidth": 8
},
{
"name": "settled_amount",
"title": "已结算金额",
"name": "our_amount",
"title": "我方金额(应收)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 15,
"uitype": "float",
"datatype": "double",
"label": "已结算金额"
"label": "我方金额(应收)",
"cwidth": 12
},
{
"name": "unsettled_amount",
"title": "未结算金额",
"name": "their_amount",
"title": "对方金额(应付)",
"type": "double",
"length": 15,
"dec": 2,
"cwidth": 15,
"uitype": "float",
"datatype": "double",
"label": "未结算金额"
"label": "对方金额(应付)",
"cwidth": 12
},
{
"name": "reconcile_status",
"title": "对账状态",
"type": "char",
"name": "diff_amount",
"title": "差异金额",
"type": "double",
"length": 15,
"dec": 2,
"uitype": "float",
"label": "差异金额",
"cwidth": 10
},
{
"name": "match_status",
"title": "核对状态",
"type": "str",
"length": 1,
"cwidth": 8,
"uitype": "code",
"datatype": "char",
"label": "对账状态",
"label": "核对状态",
"cwidth": 8,
"data": [
{"value": "0", "text": "待对账"},
{"value": "1", "text": "已确认"},
{"value": "2", "text": "有差异"}
{"value": "0", "text": "待核对"},
{"value": "1", "text": "我方单边"},
{"value": "2", "text": "对方单边"},
{"value": "3", "text": "一致"}
]
},
{
"name": "created_at",
"title": "创建时间",
"type": "datetime",
"length": 0,
"uitype": "str",
"datatype": "datetime",
"label": "创建时间"
}
]
},
"data_filter": {
"AND": [
{"field": "date_start", "op": ">=", "var": "date_start"},
{"field": "date_end", "op": "<=", "var": "date_end"},
{"field": "sub_reseller_id", "op": "=", "var": "sub_reseller_id"}
]
},
"filter_labels": {
"date_start": "开始日期",
"date_end": "结束日期",
"sub_reseller_id": "二级分销商"
},
"page_rows": 160,
"cache_limit": 5
"page_rows": 200
}
}
]