| Line 7... |
Line 7... |
| 7 |
getOrdersByTag
|
7 |
getOrdersByTag
|
| 8 |
from email import encoders
|
8 |
from email import encoders
|
| 9 |
from email.mime.base import MIMEBase
|
9 |
from email.mime.base import MIMEBase
|
| 10 |
from email.mime.multipart import MIMEMultipart
|
10 |
from email.mime.multipart import MIMEMultipart
|
| 11 |
from email.mime.text import MIMEText
|
11 |
from email.mime.text import MIMEText
|
| 12 |
from pymongo.mongo_client import MongoClient
|
12 |
#from pymongo.mongo_client import MongoClient
|
| 13 |
from xlrd import open_workbook
|
13 |
from xlrd import open_workbook
|
| 14 |
from xlutils.copy import copy
|
14 |
from xlutils.copy import copy
|
| 15 |
from xlwt.Workbook import Workbook
|
15 |
from xlwt.Workbook import Workbook
|
| 16 |
import MySQLdb
|
16 |
import MySQLdb
|
| 17 |
import smtplib
|
17 |
import smtplib
|
| 18 |
import time
|
18 |
import time
|
| 19 |
import xlwt
|
19 |
import xlwt
|
| 20 |
import pymongo
|
20 |
# import pymongo
|
| 21 |
from datetime import datetime
|
21 |
from datetime import datetime
|
| 22 |
from elixir import *
|
22 |
from elixir import *
|
| 23 |
from dtr.storage import DataService
|
23 |
from dtr.storage import DataService
|
| 24 |
from dtr.storage.DataService import Orders, Users, CallHistory
|
24 |
from dtr.storage.DataService import Orders, Users, CallHistory
|
| 25 |
from sqlalchemy.sql.expression import func
|
25 |
from sqlalchemy.sql.expression import func
|
| Line 53... |
Line 53... |
| 53 |
freshList=['1','2','3','4','5','6','7','8','9','10','11','12','13']
|
53 |
freshList=['1','2','3','4','5','6','7','8','9','10','11','12','13']
|
| 54 |
followUpList=['1','2','3','4','5','6','7','8','9','10']
|
54 |
followUpList=['1','2','3','4','5','6','7','8','9','10']
|
| 55 |
onBoardingList=['1','2','3','4','5']
|
55 |
onBoardingList=['1','2','3','4','5']
|
| 56 |
accsList=['1','2','3','4','5','6','7','8','9','10','11','12']
|
56 |
accsList=['1','2','3','4','5','6','7','8','9','10','11','12']
|
| 57 |
accsOrdersList=['1','2','3','4','5','6','7','8','9','10','11','12','13','14']
|
57 |
accsOrdersList=['1','2','3','4','5','6','7','8','9','10','11','12','13','14']
|
| - |
|
58 |
inactiveUsersList=['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23']
|
| 58 |
dispositionMap = { 'call_later':0,
|
59 |
dispositionMap = { 'call_later':0,
|
| 59 |
'ringing_no_answer':1,
|
60 |
'ringing_no_answer':1,
|
| 60 |
'not_reachable':2,
|
61 |
'not_reachable':2,
|
| 61 |
'switch_off':3,
|
62 |
'switch_off':3,
|
| 62 |
'invalid_no':4,
|
63 |
'invalid_no':4,
|
| Line 102... |
Line 103... |
| 102 |
'order_process':10,
|
103 |
'order_process':10,
|
| 103 |
'placed_order':11,
|
104 |
'placed_order':11,
|
| 104 |
'place_order':12
|
105 |
'place_order':12
|
| 105 |
}
|
106 |
}
|
| 106 |
|
107 |
|
| - |
|
108 |
|
| - |
|
109 |
inactiveUsersDispositionMap = { 'call_later':1,
|
| - |
|
110 |
'ringing_no_answer':2,
|
| - |
|
111 |
'not_reachable':3,
|
| - |
|
112 |
'switch_off':4,
|
| - |
|
113 |
'app_uninstalled':5,
|
| - |
|
114 |
'place_order':6,
|
| - |
|
115 |
'pricing_issue':7,
|
| - |
|
116 |
'technical_issue':8,
|
| - |
|
117 |
'shipping_issue':9,
|
| - |
|
118 |
'product_availability':10,
|
| - |
|
119 |
'return_replacement':11,
|
| - |
|
120 |
'product_quality_issue':12,
|
| - |
|
121 |
'delayed_delivery':13,
|
| - |
|
122 |
'order_diff_acc':14,
|
| - |
|
123 |
'not_retailer':15,
|
| - |
|
124 |
'business_closed':16,
|
| - |
|
125 |
'invalid_no':17,
|
| - |
|
126 |
'wrong_no':18,
|
| - |
|
127 |
'hang_up':19,
|
| - |
|
128 |
'service_center_retailer':20,
|
| - |
|
129 |
'recharge_retailer':21,
|
| - |
|
130 |
'other_complaint':22,
|
| - |
|
131 |
'other_reason':23,
|
| - |
|
132 |
'verified_link_sent':24
|
| - |
|
133 |
|
| - |
|
134 |
}
|
| - |
|
135 |
|
| 107 |
accsDispositionOrdersMap = { 'call_later':1,
|
136 |
accsDispositionOrdersMap = { 'call_later':1,
|
| 108 |
'ringing_no_answer':2,
|
137 |
'ringing_no_answer':2,
|
| 109 |
'not_reachable':3,
|
138 |
'not_reachable':3,
|
| 110 |
'switch_off':4,
|
139 |
'switch_off':4,
|
| 111 |
'technical_issue':5,
|
140 |
'technical_issue':5,
|
| Line 356... |
Line 385... |
| 356 |
ACCS_ORDER_PRODUCT_PRICING="""
|
385 |
ACCS_ORDER_PRODUCT_PRICING="""
|
| 357 |
select user_id,call_disposition,product_input,pricing_input from productpricinginputs where
|
386 |
select user_id,call_disposition,product_input,pricing_input from productpricinginputs where
|
| 358 |
date(created)=date(now() - interval 1 day) and product_input not like '' and project_id=3;
|
387 |
date(created)=date(now() - interval 1 day) and product_input not like '' and project_id=3;
|
| 359 |
"""
|
388 |
"""
|
| 360 |
|
389 |
|
| - |
|
390 |
ACCS_INACTIVE_USERS_QUERY="""
|
| - |
|
391 |
select call_disposition,count(1) from
|
| - |
|
392 |
(select * from (select * from callhistorycrm where date(created)=date(now()- interval 1 day)
|
| - |
|
393 |
and project_id=5 order by created desc)
|
| - |
|
394 |
as a group by user_id)
|
| - |
|
395 |
a1 group by date(created), call_disposition;
|
| - |
|
396 |
"""
|
| - |
|
397 |
|
| - |
|
398 |
ACCS_INACTIVE_USERS_AGENTS_CALLED_COUNT="""
|
| - |
|
399 |
select distinct(agent_id) from callhistorycrm where project_id=5 and date(created) = date(now() - interval 1 day)
|
| - |
|
400 |
"""
|
| - |
|
401 |
|
| - |
|
402 |
ACCS_INACTIVE_USERS_QUERY_LOGIN_TIME="""
|
| - |
|
403 |
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='inactive_users' and date(created)=date(now() - interval 1 day);
|
| - |
|
404 |
"""
|
| - |
|
405 |
|
| - |
|
406 |
ACCS_INACTIVE_USERS_DISPOSITION_DESCRIPTION="""
|
| - |
|
407 |
select user_id,call_disposition,disposition_description,disposition_comments
|
| - |
|
408 |
from callhistorycrm where call_disposition not in ('ringing_no_answer','not_reachable','switch_off','call_later')
|
| - |
|
409 |
and date(created)=date(now() - interval 1 day) and project_id=5"""
|
| - |
|
410 |
|
| - |
|
411 |
ACCS_INACTIVE_USERS_PRODUCT_PRICING="""
|
| - |
|
412 |
select user_id,call_disposition,product_input,pricing_input from productpricinginputs where
|
| - |
|
413 |
date(created)=date(now() - interval 1 day) and product_input not like '' and project_id=5;
|
| - |
|
414 |
"""
|
| - |
|
415 |
|
| 361 |
def getDbConnection():
|
416 |
def getDbConnection():
|
| 362 |
return MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)
|
417 |
return MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)
|
| 363 |
|
418 |
|
| 364 |
def generateAccessoriesCartReport():
|
419 |
def generateAccessoriesCartReport():
|
| 365 |
datesql=ACCS_CART_QUERY
|
420 |
datesql=ACCS_CART_QUERY
|
| Line 504... |
Line 559... |
| 504 |
worksheet.write(row,column,data)
|
559 |
worksheet.write(row,column,data)
|
| 505 |
column+=1
|
560 |
column+=1
|
| 506 |
|
561 |
|
| 507 |
newWorkbook.save(RET_FILE)
|
562 |
newWorkbook.save(RET_FILE)
|
| 508 |
|
563 |
|
| - |
|
564 |
def generateInactiveUsersReport():
|
| - |
|
565 |
datesql=ACCS_INACTIVE_USERS_QUERY
|
| - |
|
566 |
conn = getDbConnection()
|
| - |
|
567 |
|
| - |
|
568 |
cursor = conn.cursor()
|
| - |
|
569 |
cursor.execute(datesql)
|
| - |
|
570 |
result = cursor.fetchall()
|
| - |
|
571 |
global newWorkbook
|
| - |
|
572 |
newWorkbook = xlwt.Workbook()
|
| - |
|
573 |
worksheet = newWorkbook.add_sheet("Inactive Users")
|
| - |
|
574 |
boldStyle = xlwt.XFStyle()
|
| - |
|
575 |
newStyle= xlwt.XFStyle()
|
| - |
|
576 |
style = xlwt.XFStyle()
|
| - |
|
577 |
pattern = xlwt.Pattern()
|
| - |
|
578 |
pattern.pattern = xlwt.Pattern.SOLID_PATTERN
|
| - |
|
579 |
pattern.pattern_fore_colour = xlwt.Style.colour_map['yellow']
|
| - |
|
580 |
style.pattern = pattern
|
| - |
|
581 |
f = xlwt.Font()
|
| - |
|
582 |
f.bold = True
|
| - |
|
583 |
boldStyle.font = f
|
| - |
|
584 |
|
| - |
|
585 |
column = 0
|
| - |
|
586 |
row = 0
|
| - |
|
587 |
currentList=[]
|
| - |
|
588 |
|
| - |
|
589 |
worksheet.write(0,0,'Call Disposition Type',style)
|
| - |
|
590 |
worksheet.write(0,1,'Count',style)
|
| - |
|
591 |
worksheet.write(1, column, 'Call Later', newStyle)
|
| - |
|
592 |
worksheet.write(2,column, 'Ringing No Answer', newStyle)
|
| - |
|
593 |
worksheet.write(3,column, 'Not Reachable', newStyle)
|
| - |
|
594 |
worksheet.write(4,column, 'Switched Off', newStyle)
|
| - |
|
595 |
worksheet.write(5,column, 'App Uninstalled', newStyle)
|
| - |
|
596 |
worksheet.write(6,column, 'Will Place Order', boldStyle)
|
| - |
|
597 |
worksheet.write(7,column, 'Pricing Issue(High)', newStyle)
|
| - |
|
598 |
worksheet.write(8,column, 'Technical Issue', newStyle)
|
| - |
|
599 |
worksheet.write(9,column, 'Shipping Issue', newStyle)
|
| - |
|
600 |
worksheet.write(10,column, 'Product Not Available', newStyle)
|
| - |
|
601 |
worksheet.write(11,column, 'Return Replacement Pending', newStyle)
|
| - |
|
602 |
worksheet.write(12,column, 'Product Quality Issue', newStyle)
|
| - |
|
603 |
worksheet.write(13, column, 'Delayed Delivery', newStyle)
|
| - |
|
604 |
worksheet.write(14,column, 'Placing Order from Different Account', newStyle)
|
| - |
|
605 |
worksheet.write(15,column, 'Not a Retailer', newStyle)
|
| - |
|
606 |
worksheet.write(16,column, 'Business Closed', newStyle)
|
| - |
|
607 |
worksheet.write(17,column, 'Invalid No', newStyle)
|
| - |
|
608 |
worksheet.write(18,column, 'Wrong No', newStyle)
|
| - |
|
609 |
worksheet.write(19,column, 'Hang up', newStyle)
|
| - |
|
610 |
worksheet.write(20,column, 'Service Center', newStyle)
|
| - |
|
611 |
worksheet.write(21,column, 'Recharge Retailer', newStyle)
|
| - |
|
612 |
worksheet.write(22,column, 'Other Complaint', newStyle)
|
| - |
|
613 |
worksheet.write(23,column, 'Other Reasons', newStyle)
|
| - |
|
614 |
worksheet.write(24,column, 'App Link Sent', newStyle)
|
| - |
|
615 |
worksheet.write(25,column, 'Contactable Data (%)', newStyle)
|
| - |
|
616 |
worksheet.write(26,column, 'Non Contactable Data (%)', newStyle)
|
| - |
|
617 |
worksheet.write(27,column, 'Agents Logged In', style)
|
| - |
|
618 |
worksheet.write(28,column, 'Average Login Time (In Hrs)', style)
|
| - |
|
619 |
worksheet.write(29,column, 'Total Dialed Out', style)
|
| - |
|
620 |
worksheet.write(30,column, 'Average Dialed Out per agent', style)
|
| - |
|
621 |
|
| - |
|
622 |
contactableData=0
|
| - |
|
623 |
nonContactableData=0
|
| - |
|
624 |
global INACTIVE_USERS_WILL_PLACE_ORDER
|
| - |
|
625 |
INACTIVE_USERS_WILL_PLACE_ORDER=0
|
| - |
|
626 |
for r in result:
|
| - |
|
627 |
row = inactiveUsersDispositionMap.get(r[0])
|
| - |
|
628 |
if inactiveUsersDispositionMap.get(r[0]) == 2 or inactiveUsersDispositionMap.get(r[0]) == 3 or inactiveUsersDispositionMap.get(r[0]) == 4 or inactiveUsersDispositionMap.get(r[0]) == 17 or inactiveUsersDispositionMap.get(r[0]) == 18 or inactiveUsersDispositionMap.get(r[0]) == 19:
|
| - |
|
629 |
nonContactableData+=int(r[1])
|
| - |
|
630 |
else:
|
| - |
|
631 |
if inactiveUsersDispositionMap.get(r[0])== 6:
|
| - |
|
632 |
INACTIVE_USERS_WILL_PLACE_ORDER = r[1]
|
| - |
|
633 |
contactableData+=r[1]
|
| - |
|
634 |
currentList.append(str(row))
|
| - |
|
635 |
column = 1
|
| - |
|
636 |
worksheet.write(row, column, r[1],center_alignment)
|
| - |
|
637 |
|
| - |
|
638 |
remainingList = list(set(inactiveUsersList) - set(currentList))
|
| - |
|
639 |
for i,val in enumerate(remainingList):
|
| - |
|
640 |
row = int(val)
|
| - |
|
641 |
column = 1
|
| - |
|
642 |
worksheet.write(row, column, 0,center_alignment)
|
| - |
|
643 |
totalDispositions=contactableData+nonContactableData
|
| - |
|
644 |
global INACTIVE_USERS_TOTAL
|
| - |
|
645 |
global INACTIVE_USERS_SUCCESSFUL
|
| - |
|
646 |
INACTIVE_USERS_TOTAL = totalDispositions
|
| - |
|
647 |
INACTIVE_USERS_SUCCESSFUL=contactableData
|
| - |
|
648 |
if totalDispositions > 0:
|
| - |
|
649 |
worksheet.write(25,1,round((contactableData/float(totalDispositions))*100,2),center_alignment)
|
| - |
|
650 |
worksheet.write(26,1,round((nonContactableData/float(totalDispositions))*100,2),center_alignment)
|
| - |
|
651 |
|
| - |
|
652 |
conn.close()
|
| - |
|
653 |
|
| - |
|
654 |
datesql=ACCS_INACTIVE_USERS_AGENTS_CALLED_COUNT
|
| - |
|
655 |
conn = getDbConnection()
|
| - |
|
656 |
cursor = conn.cursor()
|
| - |
|
657 |
cursor.execute(datesql)
|
| - |
|
658 |
result = cursor.fetchall()
|
| - |
|
659 |
agentLoginList=[]
|
| - |
|
660 |
for r in result:
|
| - |
|
661 |
agentLoginList.append(str(r[0]))
|
| - |
|
662 |
conn.close()
|
| - |
|
663 |
global INACTIVE_USERS_LOGIN
|
| - |
|
664 |
INACTIVE_USERS_LOGIN = len(list(set(agentLoginList)))
|
| - |
|
665 |
if len(list(set(agentLoginList))) > 0:
|
| - |
|
666 |
datesql=ACCS_INACTIVE_USERS_QUERY_LOGIN_TIME
|
| - |
|
667 |
conn = getDbConnection()
|
| - |
|
668 |
cursor = conn.cursor()
|
| - |
|
669 |
cursor.execute(datesql)
|
| - |
|
670 |
result = cursor.fetchall()
|
| - |
|
671 |
loginTime=0
|
| - |
|
672 |
for r in result:
|
| - |
|
673 |
loginTime+=r[1].seconds
|
| - |
|
674 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
| - |
|
675 |
hours=averageLoginTime/3600
|
| - |
|
676 |
minutesLeft=(averageLoginTime%3600)/60
|
| - |
|
677 |
worksheet.write(27,1,len(list(set(agentLoginList))),center_alignment)
|
| - |
|
678 |
worksheet.write(28,1,str(hours) + ':'+ str(minutesLeft),center_alignment)
|
| - |
|
679 |
worksheet.write(29,1,totalDispositions,center_alignment)
|
| - |
|
680 |
worksheet.write(30,1,totalDispositions/float(len(list(set(agentLoginList)))),center_alignment)
|
| - |
|
681 |
conn.close()
|
| - |
|
682 |
|
| - |
|
683 |
|
| - |
|
684 |
worksheet.write(0,5, 'User Id', style)
|
| - |
|
685 |
worksheet.write(0,6, 'Call Disposition', style)
|
| - |
|
686 |
worksheet.write(0,7, 'Disposition Description', style)
|
| - |
|
687 |
worksheet.write(0,8, 'Disposition Comments', style)
|
| - |
|
688 |
datesql = ACCS_INACTIVE_USERS_DISPOSITION_DESCRIPTION
|
| - |
|
689 |
conn = getDbConnection()
|
| - |
|
690 |
cursor = conn.cursor()
|
| - |
|
691 |
cursor.execute(datesql)
|
| - |
|
692 |
result = cursor.fetchall()
|
| - |
|
693 |
row=0
|
| - |
|
694 |
for r in result:
|
| - |
|
695 |
row=row+1
|
| - |
|
696 |
column =5
|
| - |
|
697 |
for data in r:
|
| - |
|
698 |
worksheet.write(row,column,data)
|
| - |
|
699 |
column+=1
|
| - |
|
700 |
conn.close()
|
| - |
|
701 |
|
| - |
|
702 |
worksheet.write(32,0, 'User Id', style)
|
| - |
|
703 |
worksheet.write(32,1, 'Call Disposition', style)
|
| - |
|
704 |
worksheet.write(32,2, 'Product Inputs', style)
|
| - |
|
705 |
worksheet.write(32,3, 'Pricing Inputs', style)
|
| - |
|
706 |
datesql = ACCS_INACTIVE_USERS_PRODUCT_PRICING
|
| - |
|
707 |
conn = getDbConnection()
|
| - |
|
708 |
cursor = conn.cursor()
|
| - |
|
709 |
cursor.execute(datesql)
|
| - |
|
710 |
result = cursor.fetchall()
|
| - |
|
711 |
row=20
|
| - |
|
712 |
for r in result:
|
| - |
|
713 |
row=row+1
|
| - |
|
714 |
column =0
|
| - |
|
715 |
for data in r:
|
| - |
|
716 |
worksheet.write(row,column,data)
|
| - |
|
717 |
column+=1
|
| - |
|
718 |
|
| - |
|
719 |
newWorkbook.save(RET_FILE)
|
| - |
|
720 |
|
| 509 |
def generateAccessoriesTabsReport():
|
721 |
def generateAccessoriesTabsReport():
|
| 510 |
datesql=ACCS_TAB_QUERY
|
722 |
datesql=ACCS_TAB_QUERY
|
| 511 |
conn = getDbConnection()
|
723 |
conn = getDbConnection()
|
| 512 |
|
724 |
|
| 513 |
cursor = conn.cursor()
|
725 |
cursor = conn.cursor()
|
| Line 1758... |
Line 1970... |
| 1758 |
generateAgentWiseFreshCallingReport()
|
1970 |
generateAgentWiseFreshCallingReport()
|
| 1759 |
generateFollowUpCallingReport()
|
1971 |
generateFollowUpCallingReport()
|
| 1760 |
generateAgentWiseFollowupCallingReport()
|
1972 |
generateAgentWiseFollowupCallingReport()
|
| 1761 |
generateOnBoardingCallingReport()
|
1973 |
generateOnBoardingCallingReport()
|
| 1762 |
generateAgentWiseOnboardingCallingReport()
|
1974 |
generateAgentWiseOnboardingCallingReport()
|
| 1763 |
#sendmail(["rajender.singh@shop2020.in"], "", TMP_FILE, SUBJECT)
|
1975 |
# sendmail(["rajender.singh@shop2020.in"], "", TMP_FILE, SUBJECT)
|
| 1764 |
sendmail(["amit.sirohi@shop2020.in","rajneesh.arora@saholic.com","ritesh.chauhan@shop2020.in", "shailesh.kumar@shop2020.in","utkarsh@coreoutsourcingservices.com","gupta.varun@coreoutsourcingservices.com","rajender.singh@shop2020.in"], "", TMP_FILE, SUBJECT)
|
1976 |
sendmail(["amit.sirohi@shop2020.in","rajneesh.arora@saholic.com","ritesh.chauhan@shop2020.in", "shailesh.kumar@shop2020.in","utkarsh@coreoutsourcingservices.com","gupta.varun@coreoutsourcingservices.com","rajender.singh@shop2020.in"], "", TMP_FILE, SUBJECT)
|
| 1765 |
if options.reporttype == 'retention':
|
1977 |
if options.reporttype == 'retention':
|
| 1766 |
generateAccessoriesCartReport()
|
1978 |
# generateAccessoriesCartReport()
|
| 1767 |
generateAccessoriesTabsReport()
|
1979 |
# generateAccessoriesTabsReport()
|
| 1768 |
generateAccessoriesOrderReport()
|
1980 |
# generateAccessoriesOrderReport()
|
| - |
|
1981 |
generateInactiveUsersReport()
|
| 1769 |
#sendmailretention(["rajender.singh@shop2020.in"], "", RET_FILE, RET_SUBJECT)
|
1982 |
# sendmailretention(["rajender.singh@shop2020.in"], "", RET_FILE, RET_SUBJECT)
|
| 1770 |
sendmailretention(["amit.sirohi@shop2020.in","rajneesh.arora@saholic.com", "shailesh.kumar@shop2020.in","chaitnaya.vats@shop2020.in","rajender.singh@shop2020.in"], "", RET_FILE, RET_SUBJECT)
|
1983 |
sendmailretention(["amit.sirohi@shop2020.in","rajneesh.arora@saholic.com", "shailesh.kumar@shop2020.in","chaitnaya.vats@shop2020.in","rajender.singh@shop2020.in"], "", RET_FILE, RET_SUBJECT)
|
| 1771 |
|
1984 |
|
| 1772 |
def sendmail(email, message, fileName, title):
|
1985 |
def sendmail(email, message, fileName, title):
|
| 1773 |
if email == "":
|
1986 |
if email == "":
|
| 1774 |
return
|
1987 |
return
|
| Line 1792... |
Line 2005... |
| 1792 |
encoders.encode_base64(fileMsg)
|
2005 |
encoders.encode_base64(fileMsg)
|
| 1793 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
2006 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
| 1794 |
msg.attach(fileMsg)
|
2007 |
msg.attach(fileMsg)
|
| 1795 |
|
2008 |
|
| 1796 |
MAILTO = ['amit.sirohi@shop2020.in','rajneesh.arora@saholic.com', 'shailesh.kumar@shop2020.in','gupta.varun@coreoutsourcingservices.com','utkarsh@coreoutsourcingservices.com','rajender.singh@shop2020.in']
|
2009 |
MAILTO = ['amit.sirohi@shop2020.in','rajneesh.arora@saholic.com', 'shailesh.kumar@shop2020.in','gupta.varun@coreoutsourcingservices.com','utkarsh@coreoutsourcingservices.com','rajender.singh@shop2020.in']
|
| 1797 |
#MAILTO = ['rajender.singh@saholic.com']
|
2010 |
# MAILTO = ['rajender.singh@saholic.com']
|
| 1798 |
mailServer.login(SENDER, PASSWORD)
|
2011 |
mailServer.login(SENDER, PASSWORD)
|
| 1799 |
try:
|
2012 |
try:
|
| 1800 |
mailServer.sendmail(SENDER, MAILTO, msg.as_string())
|
2013 |
mailServer.sendmail(SENDER, MAILTO, msg.as_string())
|
| 1801 |
except:
|
2014 |
except:
|
| 1802 |
m = Email('localhost')
|
2015 |
m = Email('localhost')
|
| Line 1818... |
Line 2031... |
| 1818 |
message4="Will Order % " +str(round((ACCS_CART_WILL_PLACE_ORDER/float(ACCS_CART_TOTAL))*100,2))
|
2031 |
message4="Will Order % " +str(round((ACCS_CART_WILL_PLACE_ORDER/float(ACCS_CART_TOTAL))*100,2))
|
| 1819 |
else:
|
2032 |
else:
|
| 1820 |
message4="Will Order % 0"
|
2033 |
message4="Will Order % 0"
|
| 1821 |
return "<u>" + heading + "</u><br>" +message+"<br>"+message1+"<br>"+message2+"<br>"+message3+"<br>"+message4+"<br>"
|
2034 |
return "<u>" + heading + "</u><br>" +message+"<br>"+message1+"<br>"+message2+"<br>"+message3+"<br>"+message4+"<br>"
|
| 1822 |
|
2035 |
|
| - |
|
2036 |
def getInactiveUsersHtml():
|
| - |
|
2037 |
heading = "Inactive Users(Project 5)"
|
| - |
|
2038 |
message="No. of Agents " + str(INACTIVE_USERS_LOGIN)
|
| - |
|
2039 |
message1="Total Calls attempted " + str(INACTIVE_USERS_TOTAL)
|
| - |
|
2040 |
message2="Total Successful calls " + str(INACTIVE_USERS_SUCCESSFUL)
|
| - |
|
2041 |
message3="Will Order "+ str(INACTIVE_USERS_WILL_PLACE_ORDER)
|
| - |
|
2042 |
if INACTIVE_USERS_TOTAL!=0:
|
| - |
|
2043 |
message4="Will Order % " +str(round((INACTIVE_USERS_WILL_PLACE_ORDER/float(INACTIVE_USERS_TOTAL))*100,2))
|
| - |
|
2044 |
else:
|
| - |
|
2045 |
message4="Will Order % 0"
|
| - |
|
2046 |
return "<u>" + heading + "</u><br>" +message+"<br>"+message1+"<br>"+message2+"<br>"+message3+"<br>"+message4+"<br>"
|
| - |
|
2047 |
|
| - |
|
2048 |
|
| 1823 |
def getAccsTabHtml():
|
2049 |
def getAccsTabHtml():
|
| 1824 |
heading = "Accessories Active Users(Project 2)"
|
2050 |
heading = "Accessories Active Users(Project 2)"
|
| 1825 |
message="No. of Agents " + str(ACCS_TAB_LOGIN)
|
2051 |
message="No. of Agents " + str(ACCS_TAB_LOGIN)
|
| 1826 |
message1="Total Calls attempted " + str(ACCS_TAB_TOTAL)
|
2052 |
message1="Total Calls attempted " + str(ACCS_TAB_TOTAL)
|
| 1827 |
message2="Total Successful calls " + str(ACCS_TAB_SUCCESSFUL)
|
2053 |
message2="Total Successful calls " + str(ACCS_TAB_SUCCESSFUL)
|
| Line 1840... |
Line 2066... |
| 1840 |
result = cursor.fetchall()
|
2066 |
result = cursor.fetchall()
|
| 1841 |
inputs = "No of users who placed orders on Date " + str(result[0][0]) + "<br> Number of Users " + str(result[0][1])+ " <br> Total Orders " + str(result[0][2]) + "<br>Total Quantity " + str(result[0][3]) + "<br>Total Value " + str(result[0][4]) + "<br>"
|
2067 |
inputs = "No of users who placed orders on Date " + str(result[0][0]) + "<br> Number of Users " + str(result[0][1])+ " <br> Total Orders " + str(result[0][2]) + "<br>Total Quantity " + str(result[0][3]) + "<br>Total Value " + str(result[0][4]) + "<br>"
|
| 1842 |
conn.close()
|
2068 |
conn.close()
|
| 1843 |
return inputs
|
2069 |
return inputs
|
| 1844 |
|
2070 |
|
| - |
|
2071 |
def getInactiveUsersOrders():
|
| - |
|
2072 |
datesql = "select date(now() - interval 1 day), count(distinct user_id),count(distinct order_id), sum(quantity),sum(amount_paid) from allorder where store_id='spice' and category='Accs' and date(created_on)=date(now() - interval 1 day) and user_id in (select user_id from usercrmcallingdata where project_id=5 and date(created)>=date(now()- interval 7 day));"
|
| - |
|
2073 |
conn = getDbConnection()
|
| - |
|
2074 |
cursor = conn.cursor()
|
| - |
|
2075 |
cursor.execute(datesql)
|
| - |
|
2076 |
result = cursor.fetchall()
|
| - |
|
2077 |
inputs = "No of users who placed orders on Date " + str(result[0][0]) + "<br> Number of Users " + str(result[0][1])+ " <br> Total Orders " + str(result[0][2]) + "<br>Total Quantity " + str(result[0][3]) + "<br>Total Value " + str(result[0][4]) + "<br>"
|
| - |
|
2078 |
conn.close()
|
| - |
|
2079 |
return inputs
|
| - |
|
2080 |
|
| 1845 |
def getAccsTabOrders():
|
2081 |
def getAccsTabOrders():
|
| 1846 |
datesql = "select date(now() - interval 1 day), count(distinct user_id),count(distinct order_id), sum(quantity),sum(amount_paid) from allorder where store_id='spice' and category='Accs' and date(created_on)=date(now() - interval 1 day) and user_id in (select user_id from usercrmcallingdata where project_id=2 and date(created)>=date(now()- interval 7 day));"
|
2082 |
datesql = "select date(now() - interval 1 day), count(distinct user_id),count(distinct order_id), sum(quantity),sum(amount_paid) from allorder where store_id='spice' and category='Accs' and date(created_on)=date(now() - interval 1 day) and user_id in (select user_id from usercrmcallingdata where project_id=2 and date(created)>=date(now()- interval 7 day));"
|
| 1847 |
conn = getDbConnection()
|
2083 |
conn = getDbConnection()
|
| 1848 |
cursor = conn.cursor()
|
2084 |
cursor = conn.cursor()
|
| 1849 |
cursor.execute(datesql)
|
2085 |
cursor.execute(datesql)
|
| Line 1862... |
Line 2098... |
| 1862 |
for r in result:
|
2098 |
for r in result:
|
| 1863 |
inputs = inputs + "<br>" + r[0] + "-----" + str(r[1])
|
2099 |
inputs = inputs + "<br>" + r[0] + "-----" + str(r[1])
|
| 1864 |
conn.close()
|
2100 |
conn.close()
|
| 1865 |
return inputs
|
2101 |
return inputs
|
| 1866 |
|
2102 |
|
| - |
|
2103 |
def getInactiveUsersProductPricingInput():
|
| - |
|
2104 |
datesql = "select product_input,pricing_input from productpricinginputs where date(created)=date(now() - interval 1 day) and project_id=5 and product_input not like '';"
|
| - |
|
2105 |
conn = getDbConnection()
|
| - |
|
2106 |
cursor = conn.cursor()
|
| - |
|
2107 |
cursor.execute(datesql)
|
| - |
|
2108 |
result = cursor.fetchall()
|
| - |
|
2109 |
inputs="Product Pricing Inputs"
|
| - |
|
2110 |
for r in result:
|
| - |
|
2111 |
inputs = inputs + "<br>" + r[0] + "-----" + str(r[1])
|
| - |
|
2112 |
conn.close()
|
| - |
|
2113 |
return inputs
|
| - |
|
2114 |
|
| 1867 |
def getAccsTabProductPricingInput():
|
2115 |
def getAccsTabProductPricingInput():
|
| 1868 |
datesql = "select product_input,pricing_input from productpricinginputs where date(created)=date(now() - interval 1 day) and project_id=2 and product_input not like '';"
|
2116 |
datesql = "select product_input,pricing_input from productpricinginputs where date(created)=date(now() - interval 1 day) and project_id=2 and product_input not like '';"
|
| 1869 |
conn = getDbConnection()
|
2117 |
conn = getDbConnection()
|
| 1870 |
cursor = conn.cursor()
|
2118 |
cursor = conn.cursor()
|
| 1871 |
cursor.execute(datesql)
|
2119 |
cursor.execute(datesql)
|
| Line 1916... |
Line 2164... |
| 1916 |
# Create the container (outer) email message.
|
2164 |
# Create the container (outer) email message.
|
| 1917 |
msg = MIMEMultipart()
|
2165 |
msg = MIMEMultipart()
|
| 1918 |
msg['Subject'] = title
|
2166 |
msg['Subject'] = title
|
| 1919 |
msg.preamble = title
|
2167 |
msg.preamble = title
|
| 1920 |
|
2168 |
|
| 1921 |
msg.attach(MIMEText(getAccsCartHtml(), 'html'))
|
2169 |
# msg.attach(MIMEText(getAccsCartHtml(), 'html'))
|
| 1922 |
msg.attach(MIMEText(getAccsCartOrders(),'html'))
|
2170 |
# msg.attach(MIMEText(getAccsCartOrders(),'html'))
|
| 1923 |
msg.attach(MIMEText(getAccsCartProductPricingInput(),'html'))
|
2171 |
# msg.attach(MIMEText(getAccsCartProductPricingInput(),'html'))
|
| 1924 |
|
2172 |
#
|
| 1925 |
msg.attach(MIMEText(getAccsTabHtml(), 'html'))
|
2173 |
# msg.attach(MIMEText(getAccsTabHtml(), 'html'))
|
| 1926 |
msg.attach(MIMEText(getAccsTabOrders(),'html'))
|
2174 |
# msg.attach(MIMEText(getAccsTabOrders(),'html'))
|
| 1927 |
msg.attach(MIMEText(getAccsTabProductPricingInput(),'html'))
|
2175 |
# msg.attach(MIMEText(getAccsTabProductPricingInput(),'html'))
|
| 1928 |
|
2176 |
#
|
| 1929 |
msg.attach(MIMEText(getAccsOrdersHtml(), 'html'))
|
2177 |
# msg.attach(MIMEText(getAccsOrdersHtml(), 'html'))
|
| 1930 |
msg.attach(MIMEText(getAccsOrdersProject(),'html'))
|
2178 |
# msg.attach(MIMEText(getAccsOrdersProject(),'html'))
|
| 1931 |
msg.attach(MIMEText(getAccsOrdersProductPricingInput(),'html'))
|
2179 |
# msg.attach(MIMEText(getAccsOrdersProductPricingInput(),'html'))
|
| - |
|
2180 |
|
| - |
|
2181 |
msg.attach(MIMEText(getInactiveUsersHtml(), 'html'))
|
| - |
|
2182 |
msg.attach(MIMEText(getInactiveUsersOrders(),'html'))
|
| - |
|
2183 |
msg.attach(MIMEText(getInactiveUsersProductPricingInput(),'html'))
|
| 1932 |
|
2184 |
|
| 1933 |
fileMsg = MIMEBase('application', 'vnd.ms-excel')
|
2185 |
fileMsg = MIMEBase('application', 'vnd.ms-excel')
|
| 1934 |
fileMsg.set_payload(file(RET_FILE).read())
|
2186 |
fileMsg.set_payload(file(RET_FILE).read())
|
| 1935 |
encoders.encode_base64(fileMsg)
|
2187 |
encoders.encode_base64(fileMsg)
|
| 1936 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
2188 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
| 1937 |
msg.attach(fileMsg)
|
2189 |
msg.attach(fileMsg)
|
| 1938 |
|
2190 |
|
| 1939 |
MAILTO = ['amit.sirohi@shop2020.in','rajneesh.arora@saholic.com', 'shailesh.kumar@shop2020.in','chaitnaya.vats@shop2020.in','rajender.singh@shop2020.in']
|
2191 |
MAILTO = ['amit.sirohi@shop2020.in','rajneesh.arora@saholic.com', 'shailesh.kumar@shop2020.in','chaitnaya.vats@shop2020.in','rajender.singh@shop2020.in']
|
| 1940 |
#MAILTO = ['rajender.singh@saholic.com']
|
2192 |
# MAILTO = ['rajender.singh@saholic.com']
|
| 1941 |
mailServer.login(SENDER, PASSWORD)
|
2193 |
mailServer.login(SENDER, PASSWORD)
|
| 1942 |
try:
|
2194 |
try:
|
| 1943 |
mailServer.sendmail(SENDER, MAILTO, msg.as_string())
|
2195 |
mailServer.sendmail(SENDER, MAILTO, msg.as_string())
|
| 1944 |
except:
|
2196 |
except:
|
| 1945 |
m = Email('localhost')
|
2197 |
m = Email('localhost')
|