41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
import psycopg2
|
|
from psycopg2.extras import RealDictCursor
|
|
|
|
conn = psycopg2.connect('host=192.168.0.61 port=55432 dbname=njts_acct user=njts_app password=njts_app2025')
|
|
cur = conn.cursor(cursor_factory=RealDictCursor)
|
|
|
|
# 查看 7月 Entry#358, 361 和 8月 Entry#359, 362 的详细信息
|
|
cur.execute('''
|
|
SELECT
|
|
je.journal_entry_id,
|
|
je.entry_date,
|
|
je.description,
|
|
je.parent_entry_id,
|
|
jl.account_id,
|
|
a.account_code,
|
|
a.account_name,
|
|
jl.debit,
|
|
jl.credit,
|
|
jl.tax_rate,
|
|
jl.tax_direction
|
|
FROM journal_entries je
|
|
LEFT JOIN journal_lines jl ON je.journal_entry_id = jl.journal_entry_id
|
|
LEFT JOIN accounts a ON jl.account_id = a.account_id
|
|
WHERE je.journal_entry_id IN (358, 361, 359, 362)
|
|
AND je.is_deleted = false
|
|
ORDER BY je.journal_entry_id, jl.journal_line_id
|
|
''')
|
|
|
|
rows = cur.fetchall()
|
|
print("=" * 120)
|
|
print("7月/8月の問題のあるEntry詳細情報")
|
|
print("=" * 120)
|
|
|
|
for row in rows:
|
|
parent_info = f"parent_id={row['parent_entry_id']}" if row['parent_entry_id'] else "parent_id=None (!)問題"
|
|
print(f"Entry#{row['journal_entry_id']}: {row['entry_date']} | {row['account_code']} {row['account_name']:20s} | 借: {row['debit']:>10,.0f} 貳: {row['credit']:>10,.0f} | {parent_info}")
|
|
print(f" Description: {row['description']}")
|
|
print()
|
|
|
|
conn.close()
|