import asyncio from sqlalchemy import select from app.core.database import async_session from app.models.stock_ledger import StockLedger async def check_tx_ledger(): async with async_session() as db: result = await db.execute(select(StockLedger).where(StockLedger.transaction_id == 't-b77948ae8b72')) entries = result.scalars().all() print(f"Ledger Entries for Transaction t-b77948ae8b72:") for e in entries: print(f"ID: {e.id}, Mirchi: {e.mirchi_name}, Move: {e.movement_type}, In: {e.quantity_in}, Out: {e.quantity_out}, Balance: {e.balance_after}, Lot: {e.lot_number}") if __name__ == "__main__": asyncio.run(check_tx_ledger())