From 64d913572c1e3d9d32849f82eb1284a66caa7d38 Mon Sep 17 00:00:00 2001 From: Dan Dembinski Date: Fri, 28 May 2021 12:33:51 -0400 Subject: [PATCH] Matt is gone. Changed email to Carla. Changed test emails. Added argument position to bat file. Updated main.py to take bat arguement as xlsx fileName. Can now drag and drop invoice spreadsheet onto the bat file to load it into the database. --- CFFInvoice.bat | 2 +- main.py | 7 ++++++- sendEmail.py | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CFFInvoice.bat b/CFFInvoice.bat index 05f7712..b597fa2 100644 --- a/CFFInvoice.bat +++ b/CFFInvoice.bat @@ -1,2 +1,2 @@ @echo off -cmd /k "cd /d C:\Program Files (x86)\AKSESS\Storefront\CFFInvoice\Scripts & activate & cd /d C:\Program Files (x86)\AKSESS\Storefront\CFFInvoice & python main.py" \ No newline at end of file +cmd /k "cd /d C:\Program Files (x86)\AKSESS\Storefront\CFFInvoice\Scripts & activate & cd /d C:\Program Files (x86)\AKSESS\Storefront\CFFInvoice & python main.py &1" \ No newline at end of file diff --git a/main.py b/main.py index 33eca49..a0e5704 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,13 @@ import sendEmail import InvoiceDatabase +import sys running = True -fileName = '1.xlsx' + +try: + fileName = sys.argv[1] +except: + fileName = '' while running is True: print('1. load new excel file\n2. Send Test emails\n3. Send Invoices\n4. Quit') diff --git a/sendEmail.py b/sendEmail.py index ea7e0be..ac14011 100644 --- a/sendEmail.py +++ b/sendEmail.py @@ -21,7 +21,7 @@ def send_email(test, record): InvoiceID = info[18] OrderNumber = info[0] - OrderDate = datetime.strptime(info[1], '%Y-%m-%d %I:%M:%S') + OrderDate = datetime.strptime(info[1], '%Y-%m-%d %H:%M:%S') UserLogon = info[2] Name = info[3] + ' ' + info[4] ChargeCode = info[5] @@ -181,13 +181,13 @@ def send_email(test, record): msg = MIMEMultipart() msg['Subject'] = 'INVOICE ' + InvoiceNumber if test is True: - msg['To'] = 'dan.dembinski@gmail.com' - msg['Cc'] = 'ddembinski@gll.com' + msg['To'] = 'ddembinski@gll.com' + # msg['Cc'] = 'ddembinski@gll.com' else: msg['To'] = InvoiceEmailAddress msg['Cc'] = 'Carrie Higgins ' msg['Bcc'] = 'ddembinski@gll.com' - msg['From'] = 'Matt MulQueeny ' + msg['From'] = 'Carla Lane ' msg.add_header('Content-Type', 'text/html') msg.attach(bodyHTML)