Fix bat file argument. Adding Company Name to address block. Add option to "un-send" an email. This marks the InvoiceSent column as False. You can then re-test and re-send the mail. This doesn't remove the original email history from the SentInvoice table, and resending the email will add a new record to the table. Orders can be un-sent via the Invoice Number or Order Number
This commit is contained in:
@@ -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 &1"
|
||||
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"
|
||||
@@ -145,3 +145,14 @@ def mark_sent(InvoiceID, InvoiceDate):
|
||||
session.query(Invoice).filter(Invoice.InvoiceID == InvoiceID).update({Invoice.InvoiceSent: 1})
|
||||
session.commit()
|
||||
|
||||
|
||||
def unsend(option, number):
|
||||
option = option
|
||||
number = number
|
||||
# Invoice Number
|
||||
if option == 1:
|
||||
session.query(Invoice).filter(Invoice.InvoiceNumber == number).update({Invoice.InvoiceSent: 0})
|
||||
#Order Number
|
||||
elif option == 2:
|
||||
session.query(Invoice).filter(Invoice.OrderID == number).update({Invoice.InvoiceSent: 0})
|
||||
session.commit()
|
||||
8
main.py
8
main.py
@@ -10,7 +10,7 @@ except:
|
||||
fileName = ''
|
||||
|
||||
while running is True:
|
||||
print('1. load new excel file\n2. Send Test emails\n3. Send Invoices\n4. Quit')
|
||||
print('1. load new excel file\n2. Send Test emails\n3. Send Invoices\n4. Un-send Invoce\n5. Quit')
|
||||
option = int(input())
|
||||
if option == 1:
|
||||
print('Enter invoice number')
|
||||
@@ -21,6 +21,12 @@ while running is True:
|
||||
elif option == 3:
|
||||
sendEmail.send_email(False, 'ALL')
|
||||
elif option == 4:
|
||||
print('1. Invoice Number\n2. Order Number')
|
||||
option = int(input())
|
||||
print('Enter Number: ')
|
||||
number = str(input())
|
||||
InvoiceDatabase.unsend(option, number)
|
||||
elif option == 5:
|
||||
running = False
|
||||
else:
|
||||
print('not an option')
|
||||
|
||||
@@ -44,6 +44,7 @@ def send_email(test, record):
|
||||
|
||||
# if ShippingCompany != 'None' and ShippingAddress2 == 'None':
|
||||
block = '''
|
||||
<br>{ShippingCompany}
|
||||
<br>{name}
|
||||
<br>{ShippingAddress1}
|
||||
<br>{ShippingCity}, {ShippingState} {ShippingZip}
|
||||
@@ -51,7 +52,7 @@ def send_email(test, record):
|
||||
</p>
|
||||
</td>
|
||||
'''
|
||||
addressBlock = block.format(name=Name, ShippingAddress1=ShippingAddress1, ShippingCity=ShippingCity,
|
||||
addressBlock = block.format(ShippingCompany=ShippingCompany, name=Name, ShippingAddress1=ShippingAddress1, ShippingCity=ShippingCity,
|
||||
ShippingState=ShippingState, ShippingZip=ShippingPostalCode)
|
||||
|
||||
|
||||
@@ -179,7 +180,7 @@ def send_email(test, record):
|
||||
f.close()
|
||||
|
||||
msg = MIMEMultipart()
|
||||
msg['Subject'] = 'INVOICE ' + InvoiceNumber
|
||||
msg['Subject'] = 'Payment Due: Invoice for CFF Portal Order ' + OrderNumber
|
||||
if test is True:
|
||||
msg['To'] = 'ddembinski@gll.com'
|
||||
# msg['Cc'] = 'ddembinski@gll.com'
|
||||
@@ -202,3 +203,4 @@ def send_email(test, record):
|
||||
sent_orders.append(OrderNumber)
|
||||
print(sent_orders)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user