This commit is contained in:
2025-10-29 15:51:39 +01:00
parent 56f1c8fc6a
commit e93c231c3c
3 changed files with 7 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ from openpyxl.styles import Font, Alignment
from openpyxl.utils import get_column_letter
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta # přidá měsíce správně
from Functions import get_reports_folder
GRAPHQL_URL = "https://api.medevio.cz/graphql"
@@ -54,8 +55,8 @@ headers = {
"authorization": f"Bearer {gateway_token}",
}
# === Dynamické datumy ===
tomorrow = datetime.utcnow().date() + timedelta(days=1)
since = datetime.combine(tomorrow, datetime.min.time()).replace(microsecond=1)
dnes = datetime.utcnow().date()
since = datetime.combine(dnes, datetime.min.time()).replace(microsecond=1)
until = since + relativedelta(months=1) - timedelta(milliseconds=1)
# ISO formát s "Z" (UTC)
@@ -160,7 +161,8 @@ for r in reservations:
df = pd.DataFrame(rows).sort_values(["Date", "Time"])
# ===== Excel export =====
EXPORT_DIR = Path(r"C:\Users\vlado\PycharmProjects\Medevio\exports")
EXPORT_DIR = Path(get_reports_folder())
# EXPORT_DIR = Path(r"C:\Users\vlado\PycharmProjects\Medevio\exports")
EXPORT_DIR.mkdir(exist_ok=True)
timestamp = time.strftime("%Y-%m-%d %H-%M-%S")
xlsx_path = EXPORT_DIR / f"Medevio_agenda_{timestamp}.xlsx"