Subversion Repositories SmartDukaan

Rev

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

Rev 2764 Rev 3475
Line 18... Line 18...
18
from shop2020.utils.EmailAttachmentSender import get_attachment_part, mail
18
from shop2020.utils.EmailAttachmentSender import get_attachment_part, mail
19
from shop2020.utils.Utils import to_py_date
19
from shop2020.utils.Utils import to_py_date
20
 
20
 
21
from_user = 'cnc.center@shop2020.in'
21
from_user = 'cnc.center@shop2020.in'
22
from_pwd = '5h0p2o2o'
22
from_pwd = '5h0p2o2o'
23
to = 'cnc.center@shop2020.in'
23
to = ['cnc.center@shop2020.in']
24
 
24
 
25
def process_pickup_records(provider):
25
def process_pickup_records(provider):
26
    try:
26
    try:
27
        filename = fetch_report(provider.name.upper() + ' PICKUP REPORT')
27
        filename = fetch_report(provider.name.upper() + ' PICKUP REPORT')
28
        pickup_details, doa_pickup_details = read_pickup_report(filename)
28
        pickup_details, doa_pickup_details = read_pickup_report(filename)
Line 44... Line 44...
44
        try:
44
        try:
45
            if doas_not_picked_up:
45
            if doas_not_picked_up:
46
                mismatch_file = "DoaPickupMismatch.csv"
46
                mismatch_file = "DoaPickupMismatch.csv"
47
                print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
47
                print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
48
                print_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
48
                print_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
49
                pickup_mismatch_part = get_attachment_part(mismatch_file)
49
                pickup_mismatch_part = [get_attachment_part(mismatch_file)]
50
                mail(from_user, from_pwd, to,\
50
                mail(from_user, from_pwd, to,\
51
                     "DOA Pickup Mismatch for " + provider.name,\
51
                     "DOA Pickup Mismatch for " + provider.name,\
52
                     "This is a system generated email.Please don't reply to it.",\
52
                     "This is a system generated email.Please don't reply to it.",\
53
                     pickup_mismatch_part)
53
                     pickup_mismatch_part)
54
        except Exception:
54
        except Exception:
Line 67... Line 67...
67
            update_returned_orders(provider.id, returned_orders)
67
            update_returned_orders(provider.id, returned_orders)
68
            
68
            
69
            mail(from_user, from_pwd, to,\
69
            mail(from_user, from_pwd, to,\
70
                 "Returned Orders Report for " + provider.name,\
70
                 "Returned Orders Report 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
                 None)
72
                 [])
73
    finally:
73
    finally:
74
        os.remove(filename)
74
        os.remove(filename)
75
 
75
 
76
def process_non_delivery_report(provider):
76
def process_non_delivery_report(provider):
77
    try:
77
    try: