Files
njts-accounting-core/backend/app/utils/month_lock.py
FNOS-WIN11ENT\choshoukaku 87fa1aaa1f 修正
2025-12-18 15:30:39 +09:00

18 lines
499 B
Python

from datetime import date
from app.core.database import get_connection
def is_month_locked(target_date: date) -> bool:
fiscal_year = target_date.year
month = target_date.month
with get_connection() as conn, conn.cursor() as cur:
cur.execute("""
SELECT 1
FROM month_locks
WHERE fiscal_year = %s
AND month = %s
AND is_locked = true
""", (fiscal_year, month))
return cur.fetchone() is not None