| Line 21... |
Line 21... |
| 21 |
from shop2020.utils.Utils import to_py_date, to_java_date
|
21 |
from shop2020.utils.Utils import to_py_date, to_java_date
|
| 22 |
from shop2020.clients.TransactionClient import TransactionClient
|
22 |
from shop2020.clients.TransactionClient import TransactionClient
|
| 23 |
from shop2020.clients.LogisticsClient import LogisticsClient
|
23 |
from shop2020.clients.LogisticsClient import LogisticsClient
|
| 24 |
from shop2020.clients.CatalogClient import CatalogClient
|
24 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 25 |
from shop2020.thriftpy.model.v1.order.ttypes import Order, DelayReason
|
25 |
from shop2020.thriftpy.model.v1.order.ttypes import Order, DelayReason
|
| 26 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part
|
26 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part, mail_html
|
| 27 |
to = ["sandeep.sachdeva@shop2020.in","ashutosh.saxena@shop2020.in","suraj.sharma@shop2020.in","pankaj.jain@spiceglobal.com", "pankaj.kankar@shop2020.in", "chaitnaya.vats@shop2020.in", "asghar.bilgrami@shop2020.in", "rajneesharora@spiceretail.co.in"]
|
27 |
to = ["sandeep.sachdeva@shop2020.in","ashutosh.saxena@shop2020.in","suraj.sharma@shop2020.in","pankaj.jain@spiceglobal.com", "pankaj.kankar@shop2020.in", "chaitnaya.vats@shop2020.in", "asghar.bilgrami@shop2020.in", "rajneesharora@spiceretail.co.in"]
|
| 28 |
|
28 |
|
| 29 |
def generate_delayed_orders_file():
|
29 |
def generate_delayed_orders_file():
|
| 30 |
txn_client = TransactionClient().get_client()
|
30 |
txn_client = TransactionClient().get_client()
|
| 31 |
slipped_orders = txn_client.getSlippedSippingDateOrders()
|
31 |
slipped_orders = txn_client.getSlippedSippingDateOrders()
|
| Line 48... |
Line 48... |
| 48 |
sheet.write(0, 0, "Order ID", heading_xf)
|
48 |
sheet.write(0, 0, "Order ID", heading_xf)
|
| 49 |
sheet.write(0, 1, "Mode.", heading_xf)
|
49 |
sheet.write(0, 1, "Mode.", heading_xf)
|
| 50 |
sheet.write(0, 2, "Brand", heading_xf)
|
50 |
sheet.write(0, 2, "Brand", heading_xf)
|
| 51 |
sheet.write(0, 3, "Model Name", heading_xf)
|
51 |
sheet.write(0, 3, "Model Name", heading_xf)
|
| 52 |
sheet.write(0, 4, "Model Number", heading_xf)
|
52 |
sheet.write(0, 4, "Model Number", heading_xf)
|
| 53 |
sheet.write(0, 5, "Color", heading_xf)
|
53 |
sheet.write(0, 5, "Colour", heading_xf)
|
| 54 |
sheet.write(0, 6, "Creation Date", heading_xf)
|
54 |
sheet.write(0, 6, "Creation Date", heading_xf)
|
| 55 |
sheet.write(0, 7, "Promised Shipping Date", heading_xf)
|
55 |
sheet.write(0, 7, "Promised Shipping Date", heading_xf)
|
| 56 |
sheet.write(0, 8, "Expected Shipping Date", heading_xf)
|
56 |
sheet.write(0, 8, "Expected Shipping Date", heading_xf)
|
| 57 |
sheet.write(0, 9, "Delay Reason", heading_xf)
|
57 |
sheet.write(0, 9, "Delay Reason", heading_xf)
|
| 58 |
sheet.write(0, 10, "Detailed Reason Text", heading_xf)
|
58 |
sheet.write(0, 10, "Detailed Reason Text", heading_xf)
|
| 59 |
|
59 |
|
| - |
|
60 |
html = """\
|
| - |
|
61 |
<html>
|
| - |
|
62 |
<head>
|
| - |
|
63 |
<style type="text/css">
|
| - |
|
64 |
table, tr, th { border :1px solid black;}
|
| - |
|
65 |
</style>
|
| - |
|
66 |
</head>
|
| - |
|
67 |
<body>
|
| - |
|
68 |
<center><h3>Delayed Orders</h3></center>
|
| - |
|
69 |
<table>
|
| - |
|
70 |
<tr>
|
| - |
|
71 |
<th>Order ID</th>
|
| - |
|
72 |
<th>Mode</th>
|
| - |
|
73 |
<th>Brand</th>
|
| - |
|
74 |
<th>Model Name</th>
|
| - |
|
75 |
<th>Model Number</th>
|
| - |
|
76 |
<th>Colour</th>
|
| - |
|
77 |
<th>Creation Date</th>
|
| - |
|
78 |
<th>Promised Shipping Date</th>
|
| - |
|
79 |
<th>Expected Shipping Date</th>
|
| - |
|
80 |
<th>Delay Reason</th>
|
| - |
|
81 |
<th>Detailed Reason Text</th>
|
| - |
|
82 |
</tr>
|
| - |
|
83 |
"""
|
| - |
|
84 |
|
| 60 |
order = Order()
|
85 |
order = Order()
|
| 61 |
mode = {}
|
86 |
mode = {}
|
| 62 |
mode[0] = 'Prepaid'
|
87 |
mode[0] = 'Prepaid'
|
| 63 |
mode[1] = 'COD'
|
88 |
mode[1] = 'COD'
|
| 64 |
|
89 |
|
| 65 |
i = 1
|
90 |
i = 1
|
| 66 |
for order in slipped_orders:
|
91 |
for order in slipped_orders:
|
| - |
|
92 |
html +="<tr>"
|
| 67 |
sheet.write(i, 0, order.id)
|
93 |
sheet.write(i, 0, order.id)
|
| - |
|
94 |
html +="<td>" + str(order.id) + "</td>"
|
| 68 |
sheet.write(i, 1, mode[order.cod])
|
95 |
sheet.write(i, 1, mode[order.cod])
|
| - |
|
96 |
html +="<td>" + str(mode[order.cod]) + "</td>"
|
| 69 |
|
97 |
|
| 70 |
lineitem = order.lineitems[0]
|
98 |
lineitem = order.lineitems[0]
|
| 71 |
sheet.write(i, 2, lineitem.brand)
|
99 |
sheet.write(i, 2, lineitem.brand)
|
| - |
|
100 |
html +="<td>" + str(lineitem.brand) + "</td>"
|
| 72 |
sheet.write(i, 3, lineitem.model_name)
|
101 |
sheet.write(i, 3, lineitem.model_name)
|
| - |
|
102 |
html +="<td>" + str(lineitem.model_name) + "</td>"
|
| 73 |
sheet.write(i, 4, lineitem.model_number)
|
103 |
sheet.write(i, 4, lineitem.model_number)
|
| - |
|
104 |
html +="<td>" + str(lineitem.model_number) + "</td>"
|
| 74 |
sheet.write(i, 5, lineitem.color)
|
105 |
sheet.write(i, 5, lineitem.color)
|
| 75 |
|
106 |
html +="<td>" + str(lineitem.color) + "</td>"
|
| 76 |
sheet.write(i, 6, to_py_date(order.created_timestamp), date_style)
|
107 |
sheet.write(i, 6, to_py_date(order.created_timestamp), date_style)
|
| - |
|
108 |
html +="<td>" + str(to_py_date(order.created_timestamp)) + "</td>"
|
| 77 |
sheet.write(i, 7, to_py_date(order.promised_shipping_time), date_style)
|
109 |
sheet.write(i, 7, to_py_date(order.promised_shipping_time), date_style)
|
| - |
|
110 |
html +="<td>" + str(to_py_date(order.promised_shipping_time)) + "</td>"
|
| 78 |
sheet.write(i, 8, to_py_date(order.expected_shipping_time), date_style)
|
111 |
sheet.write(i, 8, to_py_date(order.expected_shipping_time), date_style)
|
| - |
|
112 |
html +="<td>" + str(to_py_date(order.expected_shipping_time)) + "</td>"
|
| 79 |
if order.delayReason:
|
113 |
if order.delayReason:
|
| 80 |
sheet.write(i, 9, DelayReason._VALUES_TO_NAMES[order.delayReason])
|
114 |
sheet.write(i, 9, DelayReason._VALUES_TO_NAMES[order.delayReason])
|
| - |
|
115 |
html +="<td>" + str(DelayReason._VALUES_TO_NAMES[order.delayReason]) + "</td>"
|
| 81 |
sheet.write(i, 10, order.delayReasonText)
|
116 |
sheet.write(i, 10, order.delayReasonText)
|
| - |
|
117 |
html +="<td>" + str(order.delayReasonText) + "</td>"
|
| 82 |
|
118 |
html +="</tr>"
|
| 83 |
i= i+1
|
119 |
i= i+1
|
| 84 |
|
120 |
|
| 85 |
today = datetime.date.today()
|
121 |
today = datetime.date.today()
|
| 86 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
122 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
| 87 |
filename = "/tmp/SlippedOrders-" + datestr + ".xls"
|
123 |
filename = "/tmp/SlippedOrders-" + datestr + ".xls"
|
| 88 |
wbk.save(filename)
|
124 |
wbk.save(filename)
|
| 89 |
|
125 |
html +="</table></body></html>"
|
| 90 |
try:
|
126 |
try:
|
| 91 |
part = get_attachment_part(filename)
|
127 |
part = get_attachment_part(filename)
|
| 92 |
mail("cnc.center@shop2020.in", "5h0p2o2o", to, "Slipped Orders as on: " + datestr, "PFA attached xls files for the orders which missed the shipping date.", [part])
|
128 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", to, "Slipped Orders as on: " + datestr, html, [part])
|
| 93 |
finally:
|
129 |
finally:
|
| 94 |
os.remove(filename)
|
130 |
os.remove(filename)
|
| 95 |
|
131 |
|
| 96 |
def generate_cancelled_orders_file():
|
132 |
def generate_cancelled_orders_file():
|
| 97 |
txn_client = TransactionClient().get_client()
|
133 |
txn_client = TransactionClient().get_client()
|
| Line 116... |
Line 152... |
| 116 |
sheet.write(0, 0, "Order ID", heading_xf)
|
152 |
sheet.write(0, 0, "Order ID", heading_xf)
|
| 117 |
sheet.write(0, 1, "Mode.", heading_xf)
|
153 |
sheet.write(0, 1, "Mode.", heading_xf)
|
| 118 |
sheet.write(0, 2, "Brand", heading_xf)
|
154 |
sheet.write(0, 2, "Brand", heading_xf)
|
| 119 |
sheet.write(0, 3, "Model Name", heading_xf)
|
155 |
sheet.write(0, 3, "Model Name", heading_xf)
|
| 120 |
sheet.write(0, 4, "Model Number", heading_xf)
|
156 |
sheet.write(0, 4, "Model Number", heading_xf)
|
| 121 |
sheet.write(0, 5, "Color", heading_xf)
|
157 |
sheet.write(0, 5, "Colour", heading_xf)
|
| 122 |
sheet.write(0, 6, "Creation Date", heading_xf)
|
158 |
sheet.write(0, 6, "Creation Date", heading_xf)
|
| 123 |
sheet.write(0, 7, "Promised Shipping Date", heading_xf)
|
159 |
sheet.write(0, 7, "Promised Shipping Date", heading_xf)
|
| 124 |
sheet.write(0, 8, "Expected Shipping Date", heading_xf)
|
160 |
sheet.write(0, 8, "Expected Shipping Date", heading_xf)
|
| 125 |
sheet.write(0, 9, "Cancellation Reason", heading_xf)
|
161 |
sheet.write(0, 9, "Cancellation Reason", heading_xf)
|
| 126 |
sheet.write(0, 10, "Cancellation Date", heading_xf)
|
162 |
sheet.write(0, 10, "Cancellation Date", heading_xf)
|
| 127 |
|
163 |
|
| - |
|
164 |
html = """\
|
| - |
|
165 |
<html>
|
| - |
|
166 |
<head>
|
| - |
|
167 |
<style type="text/css">
|
| - |
|
168 |
table, tr, th { border :1px solid black;}
|
| - |
|
169 |
</style>
|
| - |
|
170 |
</head>
|
| - |
|
171 |
<body>
|
| - |
|
172 |
<center><h3>Delayed Orders</h3></center>
|
| - |
|
173 |
<table>
|
| - |
|
174 |
<tr>
|
| - |
|
175 |
<th>Order ID</th>
|
| - |
|
176 |
<th>Mode</th>
|
| - |
|
177 |
<th>Brand</th>
|
| - |
|
178 |
<th>Model Name</th>
|
| - |
|
179 |
<th>Model Number</th>
|
| - |
|
180 |
<th>Colour</th>
|
| - |
|
181 |
<th>Creation Date</th>
|
| - |
|
182 |
<th>Promised Shipping Date</th>
|
| - |
|
183 |
<th>Expected Shipping Date</th>
|
| - |
|
184 |
<th>Cancellation Reason</th>
|
| - |
|
185 |
<th>Cancellation Date</th>
|
| - |
|
186 |
</tr>
|
| - |
|
187 |
"""
|
| - |
|
188 |
|
| - |
|
189 |
|
| 128 |
order = Order()
|
190 |
order = Order()
|
| 129 |
mode = {}
|
191 |
mode = {}
|
| 130 |
mode[0] = 'Prepaid'
|
192 |
mode[0] = 'Prepaid'
|
| 131 |
mode[1] = 'COD'
|
193 |
mode[1] = 'COD'
|
| 132 |
|
194 |
|
| 133 |
i = 1
|
195 |
i = 1
|
| 134 |
for order in cancelled_orders:
|
196 |
for order in cancelled_orders:
|
| - |
|
197 |
html +="<tr>"
|
| 135 |
sheet.write(i, 0, order.id)
|
198 |
sheet.write(i, 0, order.id)
|
| - |
|
199 |
html +="<td>" + str(order.id) + "</td>"
|
| 136 |
sheet.write(i, 1, mode[order.cod])
|
200 |
sheet.write(i, 1, mode[order.cod])
|
| - |
|
201 |
html +="<td>" + str(mode[order.cod]) + "</td>"
|
| 137 |
|
202 |
|
| 138 |
lineitem = order.lineitems[0]
|
203 |
lineitem = order.lineitems[0]
|
| 139 |
sheet.write(i, 2, lineitem.brand)
|
204 |
sheet.write(i, 2, lineitem.brand)
|
| - |
|
205 |
html +="<td>" + str(lineitem.brand) + "</td>"
|
| 140 |
sheet.write(i, 3, lineitem.model_name)
|
206 |
sheet.write(i, 3, lineitem.model_name)
|
| - |
|
207 |
html +="<td>" + str(lineitem.model_name) + "</td>"
|
| 141 |
sheet.write(i, 4, lineitem.model_number)
|
208 |
sheet.write(i, 4, lineitem.model_number)
|
| - |
|
209 |
html +="<td>" + str(lineitem.model_number) + "</td>"
|
| 142 |
sheet.write(i, 5, lineitem.color)
|
210 |
sheet.write(i, 5, lineitem.color)
|
| - |
|
211 |
html +="<td>" + str(lineitem.color) + "</td>"
|
| 143 |
|
212 |
|
| 144 |
sheet.write(i, 6, to_py_date(order.created_timestamp), date_style)
|
213 |
sheet.write(i, 6, to_py_date(order.created_timestamp), date_style)
|
| - |
|
214 |
html +="<td>" + str(to_py_date(order.created_timestamp)) + "</td>"
|
| 145 |
sheet.write(i, 7, to_py_date(order.promised_shipping_time), date_style)
|
215 |
sheet.write(i, 7, to_py_date(order.promised_shipping_time), date_style)
|
| - |
|
216 |
html +="<td>" + str(to_py_date(order.promised_shipping_time)) + "</td>"
|
| 146 |
sheet.write(i, 8, to_py_date(order.expected_shipping_time), date_style)
|
217 |
sheet.write(i, 8, to_py_date(order.expected_shipping_time), date_style)
|
| - |
|
218 |
html +="<td>" + str(to_py_date(order.expected_shipping_time)) + "</td>"
|
| 147 |
sheet.write(i, 9, order.refundReason)
|
219 |
sheet.write(i, 9, order.refundReason)
|
| - |
|
220 |
html +="<td>" + str(order.refundReason) + "</td>"
|
| 148 |
sheet.write(i, 10, to_py_date(order.refund_timestamp), date_style)
|
221 |
sheet.write(i, 10, to_py_date(order.refund_timestamp), date_style)
|
| - |
|
222 |
html +="<td>" + str(to_py_date(order.refund_timestamp)) + "</td>"
|
| - |
|
223 |
html +="<td>" + str(order.delayReasonText) + "</td>"
|
| - |
|
224 |
html +="</tr>"
|
| 149 |
|
225 |
|
| 150 |
i= i+1
|
226 |
i= i+1
|
| 151 |
|
227 |
|
| 152 |
today = datetime.date.today()
|
228 |
today = datetime.date.today()
|
| 153 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
229 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
| 154 |
filename = "/tmp/CancelledOrders-" + datestr + ".xls"
|
230 |
filename = "/tmp/CancelledOrders-" + datestr + ".xls"
|
| 155 |
wbk.save(filename)
|
231 |
wbk.save(filename)
|
| - |
|
232 |
html +="</table></body></html>"
|
| 156 |
|
233 |
|
| 157 |
try:
|
234 |
try:
|
| 158 |
part = get_attachment_part(filename)
|
235 |
part = get_attachment_part(filename)
|
| 159 |
mail("cnc.center@shop2020.in", "5h0p2o2o", to, "Low Inventory Cancelled Orders as on: " + datestr, "PFA attached xls files for the orders which has been cancelled.", [part])
|
236 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", to, "Low Inventory Cancelled Orders as on: " + datestr, html, [part])
|
| 160 |
finally:
|
237 |
finally:
|
| 161 |
os.remove(filename)
|
238 |
os.remove(filename)
|
| 162 |
|
239 |
|
| 163 |
def generate_expected_delivery_missed_orders_file():
|
240 |
def generate_expected_delivery_missed_orders_file():
|
| 164 |
|
241 |
|
| Line 208... |
Line 285... |
| 208 |
sheet.write(0, 10, "Logistics Provider ID", heading_xf)
|
285 |
sheet.write(0, 10, "Logistics Provider ID", heading_xf)
|
| 209 |
sheet.write(0, 11, "Customer City", heading_xf)
|
286 |
sheet.write(0, 11, "Customer City", heading_xf)
|
| 210 |
sheet.write(0, 12, "Customer State", heading_xf)
|
287 |
sheet.write(0, 12, "Customer State", heading_xf)
|
| 211 |
sheet.write(0, 13, "Customer Pincode", heading_xf)
|
288 |
sheet.write(0, 13, "Customer Pincode", heading_xf)
|
| 212 |
|
289 |
|
| - |
|
290 |
html = """\
|
| - |
|
291 |
<html>
|
| - |
|
292 |
<head>
|
| - |
|
293 |
<style type="text/css">
|
| - |
|
294 |
table, tr, th { border :1px solid black;}
|
| - |
|
295 |
</style>
|
| - |
|
296 |
</head>
|
| - |
|
297 |
<body>
|
| - |
|
298 |
<center><h3>Delayed Orders</h3></center>
|
| - |
|
299 |
<table border=1>
|
| - |
|
300 |
<tr>
|
| - |
|
301 |
<th>Order ID</th>
|
| - |
|
302 |
<th>Mode</th>
|
| - |
|
303 |
<th>Airway BillNo</th>
|
| - |
|
304 |
<th>Current Status</th>
|
| - |
|
305 |
<th>Shipping Date</th>
|
| - |
|
306 |
<th>Pickup Date</th>
|
| - |
|
307 |
<th>Expected Delivery Date</th>
|
| - |
|
308 |
<th>Warehouse</th>
|
| - |
|
309 |
<th>Warehouse ID</th>
|
| - |
|
310 |
<th>Logistics Provider</th>
|
| - |
|
311 |
<th>Logistics Provider ID</th>
|
| - |
|
312 |
<th>Customer City</th>
|
| - |
|
313 |
<th>Customer State</th>
|
| - |
|
314 |
<th>Customer Pincode</th>
|
| - |
|
315 |
</tr>
|
| - |
|
316 |
"""
|
| - |
|
317 |
|
| 213 |
order = Order()
|
318 |
order = Order()
|
| 214 |
mode = {}
|
319 |
mode = {}
|
| 215 |
mode[0] = 'Prepaid'
|
320 |
mode[0] = 'Prepaid'
|
| 216 |
mode[1] = 'COD'
|
321 |
mode[1] = 'COD'
|
| 217 |
|
322 |
|
| 218 |
i = 1
|
323 |
i = 1
|
| 219 |
for order in orders_not_delivered:
|
324 |
for order in orders_not_delivered:
|
| - |
|
325 |
html +="<tr>"
|
| 220 |
sheet.write(i, 0, order.id)
|
326 |
sheet.write(i, 0, order.id)
|
| - |
|
327 |
html +="<td>" + str(order.id) + "</td>"
|
| 221 |
sheet.write(i, 1, mode[order.cod])
|
328 |
sheet.write(i, 1, mode[order.cod])
|
| - |
|
329 |
html +="<td>" + str(mode[order.cod]) + "</td>"
|
| 222 |
sheet.write(i, 2, order.airwaybill_no)
|
330 |
sheet.write(i, 2, order.airwaybill_no)
|
| - |
|
331 |
html +="<td>" + str(order.airwaybill_no) + "</td>"
|
| 223 |
sheet.write(i, 3, order.statusDescription)
|
332 |
sheet.write(i, 3, order.statusDescription)
|
| - |
|
333 |
html +="<td>" + order.statusDescription + "</td>"
|
| 224 |
sheet.write(i, 4, to_py_date(order.shipping_timestamp), date_style)
|
334 |
sheet.write(i, 4, to_py_date(order.shipping_timestamp), date_style)
|
| - |
|
335 |
html +="<td>" + str(to_py_date(order.shipping_timestamp)) + "</td>"
|
| 225 |
sheet.write(i, 5, to_py_date(order.pickup_timestamp), date_style)
|
336 |
sheet.write(i, 5, to_py_date(order.pickup_timestamp), date_style)
|
| - |
|
337 |
html +="<td>" + str(to_py_date(order.pickup_timestamp)) + "</td>"
|
| 226 |
sheet.write(i, 6, to_py_date(order.expected_delivery_time), date_style)
|
338 |
sheet.write(i, 6, to_py_date(order.expected_delivery_time), date_style)
|
| - |
|
339 |
html +="<td>" + str(to_py_date(order.expected_delivery_time)) + "</td>"
|
| 227 |
sheet.write(i, 7, warehouses_map.get(order.warehouse_id))
|
340 |
sheet.write(i, 7, warehouses_map.get(order.warehouse_id))
|
| - |
|
341 |
html +="<td>" + str(warehouses_map.get(order.warehouse_id)) + "</td>"
|
| 228 |
sheet.write(i, 8, order.warehouse_id)
|
342 |
sheet.write(i, 8, order.warehouse_id)
|
| - |
|
343 |
html +="<td>" + str(order.warehouse_id) + "</td>"
|
| 229 |
sheet.write(i, 9, providers_map.get(order.logistics_provider_id))
|
344 |
sheet.write(i, 9, providers_map.get(order.logistics_provider_id))
|
| - |
|
345 |
html +="<td>" + str(providers_map.get(order.logistics_provider_id)) + "</td>"
|
| 230 |
sheet.write(i, 10, order.logistics_provider_id)
|
346 |
sheet.write(i, 10, order.logistics_provider_id)
|
| - |
|
347 |
html +="<td>" + str(order.logistics_provider_id) + "</td>"
|
| 231 |
sheet.write(i, 11, order.customer_city)
|
348 |
sheet.write(i, 11, order.customer_city)
|
| - |
|
349 |
html +="<td>" + str(order.customer_city) + "</td>"
|
| 232 |
sheet.write(i, 12, order.customer_state)
|
350 |
sheet.write(i, 12, order.customer_state)
|
| - |
|
351 |
html +="<td>" + str(order.customer_state) + "</td>"
|
| 233 |
sheet.write(i, 13, order.customer_pincode)
|
352 |
sheet.write(i, 13, order.customer_pincode)
|
| - |
|
353 |
html +="<td>" + str(order.customer_pincode) + "</td>"
|
| 234 |
|
354 |
|
| - |
|
355 |
html +="</tr>"
|
| 235 |
i= i+1
|
356 |
i= i+1
|
| 236 |
|
357 |
|
| 237 |
today = datetime.date.today()
|
358 |
today = datetime.date.today()
|
| 238 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
359 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
| 239 |
filename = "/tmp/UndeliveredOrders-" + datestr + ".xls"
|
360 |
filename = "/tmp/UndeliveredOrders-" + datestr + ".xls"
|
| 240 |
wbk.save(filename)
|
361 |
wbk.save(filename)
|
| - |
|
362 |
html +="</table></body></html>"
|
| 241 |
|
363 |
|
| 242 |
try:
|
364 |
try:
|
| 243 |
part = get_attachment_part(filename)
|
365 |
part = get_attachment_part(filename)
|
| 244 |
mail("cnc.center@shop2020.in", "5h0p2o2o", to, "Orders which missed Expected Delivery Date as on: " + datestr, "PFA attached xls files for the orders which missed the Expected Delivery Date.", [part])
|
366 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", to, "Orders which missed Expected Delivery Date as on: " + datestr, html, [part])
|
| 245 |
finally:
|
367 |
finally:
|
| 246 |
os.remove(filename)
|
368 |
os.remove(filename)
|
| 247 |
|
369 |
|
| 248 |
def main():
|
370 |
def main():
|
| 249 |
parser = OptionParser()
|
371 |
parser = OptionParser()
|