Subversion Repositories SmartDukaan

Rev

Rev 4760 | Rev 4792 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4760 Rev 4783
Line 59... Line 59...
59
            if doas_not_picked_up:
59
            if doas_not_picked_up:
60
                print "DOAs not Picked up:"
60
                print "DOAs not Picked up:"
61
                print doas_not_picked_up
61
                print doas_not_picked_up
62
                mismatch_file = "/tmp/DoaPickupMismatch.csv"
62
                mismatch_file = "/tmp/DoaPickupMismatch.csv"
63
                print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
63
                print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
64
                print_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
64
                print_dao_return_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
65
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
65
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
66
                mail(from_user, from_pwd, to,\
66
                mail(from_user, from_pwd, to,\
67
                     "DOA Pickup Mismatch for " + provider.name,\
67
                     "DOA Pickup Mismatch for " + provider.name,\
68
                     "This is a system generated email.Please don't reply to it.",\
68
                     "This is a system generated email.Please don't reply to it.",\
69
                     pickup_mismatch_part)
69
                     pickup_mismatch_part)
Line 83... Line 83...
83
            if returns_not_picked_up:
83
            if returns_not_picked_up:
84
                print "Return Orders not Picked up:"
84
                print "Return Orders not Picked up:"
85
                print returns_not_picked_up
85
                print returns_not_picked_up
86
                mismatch_file = "/tmp/ReturnsPickupMismatch.csv"
86
                mismatch_file = "/tmp/ReturnsPickupMismatch.csv"
87
                print "Some of our Return orders were not picked up. Printing report to:" + mismatch_file
87
                print "Some of our Return orders were not picked up. Printing report to:" + mismatch_file
88
                print_pickup_mismatch_report(mismatch_file, returns_not_picked_up)
88
                print_dao_return_pickup_mismatch_report(mismatch_file, returns_not_picked_up)
89
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
89
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
90
                mail(from_user, from_pwd, to,\
90
                mail(from_user, from_pwd, to,\
91
                     "Return orders Pickup Mismatch for " + provider.name,\
91
                     "Return orders Pickup Mismatch for " + provider.name,\
92
                     "This is a system generated email.Please don't reply to it.",\
92
                     "This is a system generated email.Please don't reply to it.",\
93
                     pickup_mismatch_part)
93
                     pickup_mismatch_part)
Line 347... Line 347...
347
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
347
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
348
    writer.writerow(['Order Id', 'AWB No', 'Shipping timestamp'])
348
    writer.writerow(['Order Id', 'AWB No', 'Shipping timestamp'])
349
    for order in orders:
349
    for order in orders:
350
        writer.writerow([order.id, order.airwaybill_no, to_py_date(order.shipping_timestamp)])
350
        writer.writerow([order.id, order.airwaybill_no, to_py_date(order.shipping_timestamp)])
351
 
351
 
-
 
352
def print_dao_return_pickup_mismatch_report(filename, orders):
-
 
353
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
-
 
354
    writer.writerow(['Order Id', 'Pickup Request No', 'Authorization timestamp'])
-
 
355
    for order in orders:
-
 
356
        writer.writerow([order.id, order.pickupRequestNo, to_py_date(order.doa_auth_timestamp)])
-
 
357
 
352
def print_rto_orders_report(filename, returned_orders):
358
def print_rto_orders_report(filename, returned_orders):
353
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
359
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
354
    writer.writerow(['AWB No', 'Return date', 'Reason'])
360
    writer.writerow(['AWB No', 'Return date', 'Reason'])
355
    for awb, date_reason in returned_orders.iteritems():
361
    for awb, date_reason in returned_orders.iteritems():
356
        date, reason = date_reason.split('|')
362
        date, reason = date_reason.split('|')