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

@@ -0,0 +1,50 @@
import sys
sys.path.insert(0, '/app')
from app.core.database import get_connection
print("=" * 80)
print("【期間内2025-06-0106-30のすべての仕訳と科目】")
print("=" * 80)
from_date = "2025-06-01"
to_date = "2025-06-30"
with get_connection() as conn:
with conn.cursor() as cur:
# 期間内のすべての仕訳
cur.execute("""
SELECT je.journal_entry_id, je.entry_date, je.description
FROM journal_entries je
WHERE je.is_deleted = false
AND je.is_latest = true
AND je.entry_date >= %s
AND je.entry_date <= %s
ORDER BY je.entry_date DESC, je.journal_entry_id DESC
LIMIT 10
""", [from_date, to_date])
rows = cur.fetchall()
print(f"\n期間内の仕訳(最新版のみ):{len(rows)}")
for i, row in enumerate(rows, 1):
print(f"\n{i}. 仕訳 ID {row['journal_entry_id']}: {row['entry_date']} - {row['description']}")
# この仕訳の科目を表示
cur.execute("""
SELECT
a.account_id,
a.account_code,
a.account_name,
jl.debit,
jl.credit
FROM journal_lines jl
JOIN accounts a ON jl.account_id = a.account_id
WHERE jl.journal_entry_id = %s
ORDER BY a.account_id
""", [row['journal_entry_id']])
for line in cur.fetchall():
print(f" • ID {line['account_id']} ({line['account_code']}) {line['account_name']}: 借方 {line['debit']}, 貸方 {line['credit']}")
print("\n" + "=" * 80)