fix(accounting): billing query uses LEFT JOIN subject to avoid dropping rows with missing subject

This commit is contained in:
yumoqing 2026-07-17 14:39:52 +08:00
parent 950df9a4c2
commit 91609f3606

View File

@ -22,7 +22,7 @@ async with get_sor_context(request._run_ns, 'accounting') as sor:
d.amount, d.balance, s.name as subject_name
from acc_detail d
join account a on d.accountid = a.id COLLATE utf8mb4_unicode_ci
join subject s on a.subjectid = s.id COLLATE utf8mb4_unicode_ci
left join subject s on a.subjectid = s.id COLLATE utf8mb4_unicode_ci
where a.orgid = ${orgid}$
and d.acc_date >= ${start_date}$
and d.acc_date <= ${end_date}$"""