feat: profit chart in statistics
This commit is contained in:
19
test.py
19
test.py
@@ -1,21 +1,30 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from backend.session import session_maker
|
||||
from services.billing import BillingService
|
||||
from schemas.statistics import GetProfitDataRequest
|
||||
from services.statistics import StatisticsService
|
||||
|
||||
|
||||
async def main():
|
||||
session: AsyncSession = session_maker()
|
||||
|
||||
request = GetProfitDataRequest(
|
||||
date_range=(
|
||||
datetime.date(2020, 1, 1),
|
||||
datetime.date(2020, 1, 31),
|
||||
),
|
||||
)
|
||||
|
||||
try:
|
||||
service = BillingService(session)
|
||||
service = StatisticsService(session)
|
||||
|
||||
pdf_file = await service.create_billing_document_pdf(121)
|
||||
result = await service.get_profit_data(request)
|
||||
|
||||
with open("report.pdf", "wb") as f:
|
||||
f.write(pdf_file.getvalue())
|
||||
# for res in result:
|
||||
# print(res)
|
||||
finally:
|
||||
await session.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user