| Line 12... |
Line 12... |
| 12 |
from shop2020.utils.EmailAttachmentSender import get_attachment_part
|
12 |
from shop2020.utils.EmailAttachmentSender import get_attachment_part
|
| 13 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderStatus
|
13 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderStatus
|
| 14 |
from shop2020.clients.CatalogClient import CatalogClient
|
14 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 15 |
|
15 |
|
| 16 |
def delivered_orders():
|
16 |
def delivered_orders():
|
| 17 |
DataService.initialize()
|
17 |
DataService.initialize(db_hostname="192.168.190.114")
|
| 18 |
todate = datetime.now()
|
18 |
todate = datetime.now()
|
| 19 |
todate = todate-timedelta(days = 10)
|
19 |
todate = todate-timedelta(days = 10)
|
| 20 |
insurances = InsuranceDetailForOrder.query.filter(InsuranceDetailForOrder.isDeclared == False).filter(InsuranceDetailForOrder.startDate >= todate).all()
|
20 |
insurances = InsuranceDetailForOrder.query.filter(InsuranceDetailForOrder.isDeclared == False).filter(InsuranceDetailForOrder.startDate >= todate).all()
|
| 21 |
if not insurances:
|
21 |
if not insurances:
|
| 22 |
return
|
22 |
return
|
| Line 91... |
Line 91... |
| 91 |
|
91 |
|
| 92 |
today = date.today()
|
92 |
today = date.today()
|
| 93 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
93 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
| 94 |
filename = "/tmp/insurance-" + datestr + ".xls"
|
94 |
filename = "/tmp/insurance-" + datestr + ".xls"
|
| 95 |
wbk.save(filename)
|
95 |
wbk.save(filename)
|
| 96 |
EmailAttachmentSender.mail("cnc.center@shop2020.in", "5h0p2o2o", ["ab@universalinsurance.co.in", "urmila.phadke@universalinsurace.co.in"], "Insurance Details for date ", "Please find attached insurance details for today.", [get_attachment_part(filename)], ["pramit.singh@shop2020.in","rbuniversal@gmail.com","rajveer.singh@shop2020.in","anupam.singh@shop2020.in","rajneesh.arora@shop2020.in"], [])
|
96 |
EmailAttachmentSender.mail("cnc.center@shop2020.in", "5h0p2o2o", ["ab@universalinsurance.co.in", "urmila.phadke@universalinsurace.co.in"], "Insurance Details for date " + datestr, "Please find attached insurance details for today.", [get_attachment_part(filename)], ["pramit.singh@shop2020.in","rbuniversal@gmail.com","rajveer.singh@shop2020.in","anupam.singh@shop2020.in","rajneesh.arora@shop2020.in"], [])
|
| 97 |
|
97 |
|
| 98 |
def returned_orders():
|
98 |
def returned_orders():
|
| 99 |
DataService.initialize()
|
99 |
DataService.initialize(db_hostname="192.168.190.114")
|
| 100 |
todate = datetime.now()
|
100 |
todate = datetime.now()
|
| 101 |
todate = todate-timedelta(days = 2)
|
101 |
todate = todate-timedelta(days = 2)
|
| 102 |
orders = Order.query.filter(Order.insurer > 0).filter(Order.received_return_timestamp >= todate).all()
|
102 |
orders = Order.query.filter(Order.insurer > 0).filter(Order.received_return_timestamp >= todate).all()
|
| 103 |
|
103 |
|
| 104 |
if not orders:
|
104 |
if not orders:
|
| Line 158... |
Line 158... |
| 158 |
|
158 |
|
| 159 |
today = date.today()
|
159 |
today = date.today()
|
| 160 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
160 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
| 161 |
filename = "/tmp/insurance-return-" + datestr + ".xls"
|
161 |
filename = "/tmp/insurance-return-" + datestr + ".xls"
|
| 162 |
wbk.save(filename)
|
162 |
wbk.save(filename)
|
| 163 |
EmailAttachmentSender.mail("cnc.center@shop2020.in", "5h0p2o2o", ["ab@universalinsurance.co.in", "urmila.phadke@universalinsurace.co.in"], "Insurance Details for date ", "Please find attached insurance details for today.", [get_attachment_part(filename)], ["pramit.singh@shop2020.in","rbuniversal@gmail.com","rajveer.singh@shop2020.in","anupam.singh@shop2020.in","rajneesh.arora@shop2020.in"], [])
|
163 |
EmailAttachmentSender.mail("cnc.center@shop2020.in", "5h0p2o2o", ["ab@universalinsurance.co.in", "urmila.phadke@universalinsurace.co.in"], "Insurance Details for date " + datestr, "Please find attached insurance details for today.", [get_attachment_part(filename)], ["pramit.singh@shop2020.in","rbuniversal@gmail.com","rajveer.singh@shop2020.in","anupam.singh@shop2020.in","rajneesh.arora@shop2020.in"], [])
|
| 164 |
|
164 |
|
| 165 |
def main():
|
165 |
def main():
|
| 166 |
delivered_orders()
|
166 |
delivered_orders()
|
| 167 |
returned_orders()
|
167 |
returned_orders()
|
| 168 |
|
168 |
|