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 62... Line 62...
62
        doas_not_picked_up = update_picked_doas(provider.id, doa_pickup_details)
62
        doas_not_picked_up = update_picked_doas(provider.id, doa_pickup_details)
63
        try:
63
        try:
64
            if doas_not_picked_up:
64
            if doas_not_picked_up:
65
                mismatch_file = "/tmp/DoaPickupMismatch.csv"
65
                mismatch_file = "/tmp/DoaPickupMismatch.csv"
66
                print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
66
                print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
67
                print_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
67
                print_dao_return_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
68
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
68
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
69
                mail(from_user, from_pwd, to,\
69
                mail(from_user, from_pwd, to,\
70
                     "DOA Pickup Mismatch for " + provider.name,\
70
                     "DOA Pickup Mismatch for " + provider.name,\
71
                     "This is a system generated email.Please don't reply to it.",\
71
                     "This is a system generated email.Please don't reply to it.",\
72
                     pickup_mismatch_part)
72
                     pickup_mismatch_part)
Line 77... Line 77...
77
        returns_not_picked_up = update_picked_returns(provider.id, returns_pickup_details)
77
        returns_not_picked_up = update_picked_returns(provider.id, returns_pickup_details)
78
        try:
78
        try:
79
            if returns_not_picked_up:
79
            if returns_not_picked_up:
80
                mismatch_file = "/tmp/ReturnsPickupMismatch.csv"
80
                mismatch_file = "/tmp/ReturnsPickupMismatch.csv"
81
                print "Some of our Return orders were not picked up. Printing report to:" + mismatch_file
81
                print "Some of our Return orders were not picked up. Printing report to:" + mismatch_file
82
                print_pickup_mismatch_report(mismatch_file, returns_not_picked_up)
82
                print_dao_return_pickup_mismatch_report(mismatch_file, returns_not_picked_up)
83
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
83
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
84
                mail(from_user, from_pwd, to,\
84
                mail(from_user, from_pwd, to,\
85
                     "Return orders Pickup Mismatch for " + provider.name,\
85
                     "Return orders Pickup Mismatch for " + provider.name,\
86
                     "This is a system generated email.Please don't reply to it.",\
86
                     "This is a system generated email.Please don't reply to it.",\
87
                     pickup_mismatch_part)
87
                     pickup_mismatch_part)
Line 280... Line 280...
280
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
280
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
281
    writer.writerow(['Order Id', 'AWB No', 'Shipping timestamp'])
281
    writer.writerow(['Order Id', 'AWB No', 'Shipping timestamp'])
282
    for order in orders:
282
    for order in orders:
283
        writer.writerow([order.id, order.airwaybill_no, to_py_date(order.shipping_timestamp)])
283
        writer.writerow([order.id, order.airwaybill_no, to_py_date(order.shipping_timestamp)])
284
 
284
 
-
 
285
def print_dao_return_pickup_mismatch_report(filename, orders):
-
 
286
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
-
 
287
    writer.writerow(['Order Id', 'Pickup Request No', 'Authorization timestamp'])
-
 
288
    for order in orders:
-
 
289
        writer.writerow([order.id, order.pickupRequestNo, to_py_date(order.doa_auth_timestamp)])
-
 
290
 
285
def print_rto_orders_report(filename, returned_orders):
291
def print_rto_orders_report(filename, returned_orders):
286
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
292
    writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_NONE)
287
    writer.writerow(['AWB No', 'Return date', 'Reason'])
293
    writer.writerow(['AWB No', 'Return date', 'Reason'])
288
    for awb, date_reason in returned_orders.iteritems():
294
    for awb, date_reason in returned_orders.iteritems():
289
        date, reason = date_reason.split('|')
295
        date, reason = date_reason.split('|')