import sqlite3 db_path = "/workspace/personal/blu/saman_bank_all_transactions.sqlite" conn = sqlite3.connect(db_path) cur = conn.cursor() print("=== CHECK SAMAN TRANSACTIONS FOR RETURNED TRANSFERS ===") # 1. Search for keywords related to afriteh / 1920 / unlock / providers keywords = ["عفریته", "افریته", "نوزده بیست", "۱۹۲۰", "1920", "آنلاک", "3241869490", "0014430711", "5173561701", "3343927079"] for kw in keywords: cur.execute("SELECT jdate, deposit_toman, withdrawal_toman, description, tracking_no FROM saman_transactions WHERE description LIKE ? OR notes LIKE ?", (f"%{kw}%", f"%{kw}%")) rows = cur.fetchall() if rows: print(f"\n--- Matches for keyword: {kw} ({len(rows)} records) ---") for r in rows: print(f"Date: {r[0]} | In: {r[1]:,} | Out: {r[2]:,} | Track: {r[4]} | Desc: {r[3]}") # 2. Search for all returned deposits print("\n=== ALL 'برگشت' DEPOSITS IN SAMAN BANK ===") cur.execute("SELECT jdate, deposit_toman, description, tracking_no FROM saman_transactions WHERE deposit_toman > 0 AND (description LIKE '%برگشت%' OR notes LIKE '%برگشت%')") returns = cur.fetchall() print(f"Total returned deposits found: {len(returns)}") for r in returns: print(f"Date: {r[0]} | Deposit: {r[1]:,} Toman | Track: {r[3]} | Desc: {r[2]}")