diff --git a/main.py b/main.py index 762a876..1b5fdcd 100644 --- a/main.py +++ b/main.py @@ -112,10 +112,10 @@ def get_report_dates(): previous_business_day = now - timedelta(days=days_back) # Objetos .NET DateTime - dt_yesterday = DateTime(previous_business_day.year, previous_business_day.month, previous_business_day.day) + dt_previous_business_day = DateTime(previous_business_day.year, previous_business_day.month, previous_business_day.day) dt_month_start = DateTime(previous_business_day.year, previous_business_day.month, 1) - return dt_month_start, dt_yesterday + return dt_month_start, dt_previous_business_day # --- PROCESO PRINCIPAL --- ######################################################## @@ -137,8 +137,8 @@ def main(): output_dir.mkdir(parents=True, exist_ok=True) # 3. Cálculo de Fechas - dt_month_start, dt_yesterday = get_report_dates() - str_ayer = dt_yesterday.ToString("dd/MM/yyyy") + dt_month_start, dt_previous_business_day = get_report_dates() + str_previous_business_day = dt_previous_business_day.ToString("dd/MM/yyyy") str_inicio = dt_month_start.ToString("dd/MM/yyyy") # 4. Generación de Reportes @@ -146,24 +146,24 @@ def main(): adjuntos = [] # REPORTE 1: Venta del día de ayer - pdf_yesterday = output_dir / f"venta_presupuesto_linea_{dt_yesterday.ToString('dd_MM_yyyy')}.pdf" - if ejecutar_reporte(rpt_file, pdf_yesterday, {"FecIni": dt_yesterday, "FecFin": dt_yesterday}): + pdf_yesterday = output_dir / f"venta_presupuesto_linea_{dt_previous_business_day.ToString('dd_MM_yyyy')}.pdf" + if ejecutar_reporte(rpt_file, pdf_yesterday, {"FecIni": dt_previous_business_day, "FecFin": dt_previous_business_day}): adjuntos.append(str(pdf_yesterday)) # REPORTE 2: Acumulado del mes actual (MTD) - pdf_mtd = output_dir / f"venta_presupuesto_linea_{dt_month_start.ToString('dd_MM_yyyy')}_al_{dt_yesterday.ToString('dd_MM_yyyy')}.pdf" - if ejecutar_reporte(rpt_file, pdf_mtd, {"FecIni": dt_month_start, "FecFin": dt_yesterday}): + pdf_mtd = output_dir / f"venta_presupuesto_linea_{dt_month_start.ToString('dd_MM_yyyy')}_al_{dt_previous_business_day.ToString('dd_MM_yyyy')}.pdf" + if ejecutar_reporte(rpt_file, pdf_mtd, {"FecIni": dt_month_start, "FecFin": dt_previous_business_day}): adjuntos.append(str(pdf_mtd)) # 5. Envío de Correo Electrónico if adjuntos: - subject = f"Informe de Venta de Presupuestos por Línea - {str_ayer}" + subject = f"Informe de Venta de Presupuestos por Línea - {str_previous_business_day}" body = f"""
Buenos días
-Me complace compartir con ustedes el reporte de avance de ventas por línea correspondiente al {str_ayer}.
+Me complace compartir con ustedes el reporte de avance de ventas por línea correspondiente al {str_previous_business_day}.
La información se encuentra disponible en el siguiente dashboard: