| Line 20... |
Line 20... |
| 20 |
retailer_list = []
|
20 |
retailer_list = []
|
| 21 |
user_sales = {}
|
21 |
user_sales = {}
|
| 22 |
|
22 |
|
| 23 |
xstr = lambda s: s or ""
|
23 |
xstr = lambda s: s or ""
|
| 24 |
|
24 |
|
| 25 |
date_format = XFStyle()
|
25 |
date_format = xlwt.XFStyle()
|
| 26 |
date_format.num_format_str = 'dd/MM/yyyy'
|
26 |
date_format.num_format_str = 'dd/mm/yyyy'
|
| 27 |
|
27 |
|
| 28 |
class __retailers:
|
28 |
class __retailers:
|
| 29 |
def __init__(self, user_id, activated_through, activation_code, order_list, name):
|
29 |
def __init__(self, user_id, activated_through, activation_code, order_list, name):
|
| 30 |
self.user_id = user_id
|
30 |
self.user_id = user_id
|
| 31 |
self.name = name
|
31 |
self.name = name
|
| Line 185... |
Line 185... |
| 185 |
sheet.write(i,3,order.city)
|
185 |
sheet.write(i,3,order.city)
|
| 186 |
sheet.write(i,4,order.pincode)
|
186 |
sheet.write(i,4,order.pincode)
|
| 187 |
sheet.write(i,5,order.contact_number)
|
187 |
sheet.write(i,5,order.contact_number)
|
| 188 |
sheet.write(i,6,order.name)
|
188 |
sheet.write(i,6,order.name)
|
| 189 |
sheet.write(i,7,"")
|
189 |
sheet.write(i,7,"")
|
| 190 |
sheet.write(i,8,get_formatted_date(order.order_date), date_format)
|
190 |
sheet.write(i,8, order.order_date, date_format)
|
| 191 |
sheet.write(i,9,order.order_id)
|
191 |
sheet.write(i,9,order.order_id)
|
| 192 |
sheet.write(i,10,OrderStatus._VALUES_TO_NAMES.get(order.order_status))
|
192 |
sheet.write(i,10,OrderStatus._VALUES_TO_NAMES.get(order.order_status))
|
| 193 |
sheet.write(i,11, get_formatted_date(order.invoice_date), date_format)
|
193 |
sheet.write(i,11, order.invoice_date, date_format)
|
| 194 |
sheet.write(i,12, xstr(order.invoice_number))
|
194 |
sheet.write(i,12, xstr(order.invoice_number))
|
| 195 |
sheet.write(i,13, get_formatted_date(order.delivery_date), date_format)
|
195 |
sheet.write(i,13, order.delivery_date, date_format)
|
| 196 |
sheet.write(i,14, xstr(order.brand))
|
196 |
sheet.write(i,14, xstr(order.brand))
|
| 197 |
sheet.write(i,15, xstr(order.model_name))
|
197 |
sheet.write(i,15, xstr(order.model_name))
|
| 198 |
sheet.write(i,16, xstr(order.model_number))
|
198 |
sheet.write(i,16, xstr(order.model_number))
|
| 199 |
sheet.write(i,17, xstr(order.color))
|
199 |
sheet.write(i,17, xstr(order.color))
|
| 200 |
sheet.write(i,18, order.item_id)
|
200 |
sheet.write(i,18, order.item_id)
|
| Line 207... |
Line 207... |
| 207 |
datestr = str(today.year) + "-" + str(today.month)+ "-"+str(today.day)+"-" +associate['emailId']
|
207 |
datestr = str(today.year) + "-" + str(today.month)+ "-"+str(today.day)+"-" +associate['emailId']
|
| 208 |
filename = "/tmp/sales-associate-" + datestr + ".xls"
|
208 |
filename = "/tmp/sales-associate-" + datestr + ".xls"
|
| 209 |
wbk.save(filename)
|
209 |
wbk.save(filename)
|
| 210 |
email_text = get_email_text(associate['name'], str(get_cut_off().year) + "-" + str(get_cut_off().month)+ "-"+str(get_cut_off().day))
|
210 |
email_text = get_email_text(associate['name'], str(get_cut_off().year) + "-" + str(get_cut_off().month)+ "-"+str(get_cut_off().day))
|
| 211 |
#EmailAttachmentSender.mail_send_grid("sales-associates@profitmandi.com","apikey", "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", [associate['emailId']], "Order Summary Report "+associate['emailId'],email_text , [get_attachment_part(filename)],["kamini.sharma@profitmandi.com","tarun.verma@profitmandi.com"],["amit.gupta@saholic.com","kshitij.sood@saholic.com"])
|
211 |
#EmailAttachmentSender.mail_send_grid("sales-associates@profitmandi.com","apikey", "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", [associate['emailId']], "Order Summary Report "+associate['emailId'],email_text , [get_attachment_part(filename)],["kamini.sharma@profitmandi.com","tarun.verma@profitmandi.com"],["amit.gupta@saholic.com","kshitij.sood@saholic.com"])
|
| 212 |
EmailAttachmentSender.mail_send_grid("sales-associates@profitmandi.com","apikey", "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", [associate['emailId']], "Order Summary Report "+associate['emailId'],email_text , [get_attachment_part(filename)],[],['amit.gupta@saholic.com'])
|
212 |
EmailAttachmentSender.mail_send_grid("sales-associates@profitmandi.com","apikey", "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", [associate['emailId']], "Order Summary Report "+associate['emailId'],email_text , [get_attachment_part(filename)],[],[])
|
| 213 |
|
213 |
|
| 214 |
|
214 |
|
| 215 |
def write_last_month_report():
|
215 |
def write_last_month_report():
|
| 216 |
pass
|
216 |
pass
|
| 217 |
|
217 |
|