This commit is contained in:
admin
2026-02-20 15:47:27 +09:00
parent c60cbf2d9a
commit 584530937b
108 changed files with 12112 additions and 416 deletions

55
test_api_balance.py Normal file
View File

@@ -0,0 +1,55 @@
import requests
import json
BASE_URL = "http://localhost:18080"
print("=" * 80)
print("【修正後のAPI試算表テスト】")
print("=" * 80)
print()
try:
# Get trial balance
response = requests.get(f"{BASE_URL}/trial-balance")
response.raise_for_status()
data = response.json()
# Find account 701
accounts = data.get('accounts', [])
account_701 = None
for acc in accounts:
if acc.get('account_code') == '701':
account_701 = acc
break
if account_701:
print(f"701 売上高Sales Revenue:")
print(f" 借方Debit: {account_701.get('debit', 'N/A')}")
print(f" 貸方Credit: {account_701.get('credit', 'N/A')}")
print(f" 期末残高Closing Balance: {account_701.get('closing_balance', 'N/A')}")
print()
else:
print("Account 701 not found!")
print()
# Show totals
totals = data.get('totals', {})
print("試算表合計Trial Balance Totals:")
print(f" 借方合計: {totals.get('debit', 'N/A')}")
print(f" 貸方合計: {totals.get('credit', 'N/A')}")
print()
# Check if debit = credit (this is the test)
debit_total = float(totals.get('debit', 0) or 0)
credit_total = float(totals.get('credit', 0) or 0)
if debit_total == credit_total:
print("✓ 試算表が正しくバランスしています(借方=貸方)")
else:
print(f"✗ 試算表がバランスしていません(借方={debit_total}, 貸方={credit_total}")
except Exception as e:
print(f"エラー: {e}")
import traceback
traceback.print_exc()