import sqlite3 from datetime import date conn = sqlite3.connect('database.db') cursor = conn.cursor() print("=== Recent overtime usage ===") cursor.execute('SELECT date, used_minutes, reason FROM overtime_usage ORDER BY date DESC LIMIT 5') for row in cursor.fetchall(): print(f"{row[0]}: {row[1]} min - {row[2]}") print("\n=== Recent work records ===") cursor.execute('SELECT date, clock_in, clock_out, lunch_break, dinner_break FROM work_records ORDER BY date DESC LIMIT 3') for row in cursor.fetchall(): lunch = "Yes" if row[3] else "No" dinner = "Yes" if row[4] if row[4] is not None else 0 else "No" print(f"{row[0]}: {row[1]} ~ {row[2]}, Lunch:{lunch}, Dinner:{dinner}") print(f"\n=== Today date: {date.today().isoformat()} ===") today = date.today().isoformat() cursor.execute('SELECT SUM(used_minutes) FROM overtime_usage WHERE date = ?', (today,)) used_today = cursor.fetchone()[0] or 0 print(f"Overtime used today: {used_today} minutes") conn.close()