This commit is contained in:
admin
2026-03-03 00:01:43 +09:00
parent 3b028b8fc0
commit 068903b933
31 changed files with 3204 additions and 889 deletions

View File

@@ -40,6 +40,7 @@ def get_trial_balance(
JOIN accounts a ON a.account_id = l.account_id
WHERE e.is_deleted = false
AND e.is_latest = true
AND a.account_code NOT IN ('512', '513', '516')
"""
else:
# 旧系统:排除已修正的记录(使用 parent_entry_id
@@ -55,6 +56,7 @@ def get_trial_balance(
JOIN journal_entries e ON e.journal_entry_id = l.journal_entry_id
JOIN accounts a ON a.account_id = l.account_id
WHERE e.is_deleted = false
AND a.account_code NOT IN ('512', '513', '516')
AND e.journal_entry_id NOT IN (
SELECT parent_entry_id
FROM journal_entries
@@ -83,7 +85,11 @@ def get_trial_balance(
a.account_name,
a.account_type
ORDER BY
a.account_code
CASE
WHEN a.account_code < '509' THEN a.account_code
WHEN a.account_code IN ('510', '511') THEN '508.' || a.account_code
ELSE a.account_code
END
"""
with get_connection() as conn, conn.cursor() as cur: