Skip to content

Commit

Permalink
Revenue Letter - Changes for subject date
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 committed Feb 6, 2025
1 parent 1e176c9 commit d7951de
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jobs/notebook-report/notebookreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import fnmatch
import logging
import os
import pytz
import smtplib
import sys
import traceback
from datetime import date, datetime, timedelta, timezone
from dateutil.relativedelta import relativedelta
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
Expand Down Expand Up @@ -71,8 +73,13 @@ def send_email(file_processing, emailtype, errormessage, partner_code=None):
filenames = ["weekly_pay_stats_till_" + date_str + ".csv"]
recipients = Config.WEEKLY_PAY_RECIPIENTS
elif "reconciliation_summary" in file_processing:
year_month = datetime.strftime(datetime.now() - timedelta(1), "%Y-%m")
subject = "Monthly Reconciliation Stats " + year_month + ext
override_current_date = Config.OVERRIDE_CURRENT_DATE
current_time = datetime.strptime(override_current_date, "%Y-%m-%d") if override_current_date \
else datetime.now(pytz.timezone("America/Vancouver"))
last_month = current_time - relativedelta(months=1)
last_month = last_month.replace(day=1)
year_month = datetime.strftime(last_month, "%Y-%m")
subject = f"{partner_code} Monthly Reconciliation Stats for {year_month}{ext}"
filenames = [f for f in os.listdir(os.path.join(os.getcwd(), r"data/")) if f.startswith(partner_code)]
recipients = get_partner_recipients(file_processing, partner_code)

Expand Down

0 comments on commit d7951de

Please sign in to comment.