| Line 291... |
Line 291... |
| 291 |
def print_rto_orders_report(filename, returned_orders):
|
291 |
def print_rto_orders_report(filename, returned_orders):
|
| 292 |
writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
|
292 |
writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
|
| 293 |
writer.writerow(['AWB No', 'Return date', 'Reason'])
|
293 |
writer.writerow(['AWB No', 'Return date', 'Reason'])
|
| 294 |
for awb, date_reason in returned_orders.iteritems():
|
294 |
for awb, date_reason in returned_orders.iteritems():
|
| 295 |
date, reason = date_reason.split('|')
|
295 |
date, reason = date_reason.split('|')
|
| - |
|
296 |
if reason is not None:
|
| - |
|
297 |
reason = reason.replace(","," ")
|
| 296 |
writer.writerow([awb, date, reason])
|
298 |
writer.writerow([awb, date, reason])
|
| 297 |
|
299 |
|
| 298 |
def print_undelivered_orders_report(filename, orders):
|
300 |
def print_undelivered_orders_report(filename, orders):
|
| 299 |
writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
|
301 |
writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
|
| 300 |
writer.writerow(['Order Id', 'AWB No', 'Status', 'Status Description', 'Shipping timestamp', 'Pickup timestamp'])
|
302 |
writer.writerow(['Order Id', 'AWB No', 'Status', 'Status Description', 'Shipping timestamp', 'Pickup timestamp'])
|
| 301 |
for order in orders:
|
303 |
for order in orders:
|
| - |
|
304 |
statusDescription = ''
|
| - |
|
305 |
if order.statusDescription is not None:
|
| - |
|
306 |
statusDescription = order.statusDescription.replace(","," ")
|
| 302 |
writer.writerow([order.id, order.airwaybill_no, order.status, order.statusDescription, to_py_date(order.shipping_timestamp), to_py_date(order.pickup_timestamp)])
|
307 |
writer.writerow([order.id, order.airwaybill_no, order.status, statusDescription, to_py_date(order.shipping_timestamp), to_py_date(order.pickup_timestamp)])
|
| 303 |
|
308 |
|
| 304 |
def todays_date_string():
|
309 |
def todays_date_string():
|
| 305 |
today_date = time.strftime("%d-%b-%Y")
|
310 |
today_date = time.strftime("%d-%b-%Y")
|
| 306 |
return '"' + today_date + '"'
|
311 |
return '"' + today_date + '"'
|
| 307 |
|
312 |
|