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 360... Line 360...
360
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
360
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
361
    writer.writerow(['Order Id', 'AWB No', 'Shipping timestamp'])
361
    writer.writerow(['Order Id', 'AWB No', 'Shipping timestamp'])
362
    for order in orders:
362
    for order in orders:
363
        writer.writerow([order.id, order.airwaybill_no, to_py_date(order.shipping_timestamp)])
363
        writer.writerow([order.id, order.airwaybill_no, to_py_date(order.shipping_timestamp)])
364
 
364
 
-
 
365
def print_dao_return_pickup_mismatch_report(filename, orders):
-
 
366
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
-
 
367
    writer.writerow(['Order Id', 'Pickup Request No', 'Authorization timestamp'])
-
 
368
    for order in orders:
-
 
369
        writer.writerow([order.id, order.pickupRequestNo, to_py_date(order.doa_auth_timestamp)])
-
 
370
 
365
def print_rto_orders_report(filename, returned_orders):
371
def print_rto_orders_report(filename, returned_orders):
366
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
372
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
367
    writer.writerow(['AWB No', 'Return date', 'Reason'])
373
    writer.writerow(['AWB No', 'Return date', 'Reason'])
368
    for awb, date_reason in returned_orders.iteritems():
374
    for awb, date_reason in returned_orders.iteritems():
369
        date, reason = date_reason.split('|')
375
        date, reason = date_reason.split('|')