| Line 1... |
Line 1... |
| 1 |
'''
|
1 |
'''
|
| 2 |
Created on 27-May-2015
|
2 |
Created on 27-May-2015
|
| 3 |
|
- |
|
| 4 |
@author: kshitij
|
3 |
@author: kshitij
|
| 5 |
'''
|
4 |
'''
|
| 6 |
from datetime import date, datetime, timedelta
|
5 |
from datetime import date, datetime, timedelta
|
| 7 |
from dtr.storage.Mysql import getOrdersAfterDate, \
|
6 |
from dtr.storage.Mysql import getOrdersAfterDate, \
|
| 8 |
getOrdersByTag
|
7 |
getOrdersByTag
|
| Line 32... |
Line 31... |
| 32 |
DB_NAME = "dtr"
|
31 |
DB_NAME = "dtr"
|
| 33 |
TMP_FILE = "/tmp/CRM_OutBound_Report.xls"
|
32 |
TMP_FILE = "/tmp/CRM_OutBound_Report.xls"
|
| 34 |
|
33 |
|
| 35 |
con = None
|
34 |
con = None
|
| 36 |
|
35 |
|
| 37 |
SENDER = "cnc.center@shop2020.in"
|
36 |
SENDER = "adwords@shop2020.in"
|
| 38 |
PASSWORD = "5h0p2o2o"
|
37 |
PASSWORD = "adwords_shop2020"
|
| 39 |
SUBJECT = "CRM Outbound Report for " + str(date.today() - timedelta(days=3))
|
38 |
SUBJECT = "CRM Outbound Report for " + str(date.today() - timedelta(days=1))
|
| 40 |
SMTP_SERVER = "smtp.gmail.com"
|
39 |
SMTP_SERVER = "smtp.gmail.com"
|
| 41 |
SMTP_PORT = 587
|
40 |
SMTP_PORT = 587
|
| 42 |
|
41 |
|
| 43 |
date_format = xlwt.XFStyle()
|
42 |
date_format = xlwt.XFStyle()
|
| 44 |
date_format.num_format_str = 'yyyy/mm/dd'
|
43 |
date_format.num_format_str = 'yyyy/mm/dd'
|
| Line 88... |
Line 87... |
| 88 |
# as a group by retailer_id)
|
87 |
# as a group by retailer_id)
|
| 89 |
# a1 group by date(created), call_disposition;
|
88 |
# a1 group by date(created), call_disposition;
|
| 90 |
# """
|
89 |
# """
|
| 91 |
FRESH_QUERY="""
|
90 |
FRESH_QUERY="""
|
| 92 |
select call_disposition,count(1) from
|
91 |
select call_disposition,count(1) from
|
| 93 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 3 DAY)
|
92 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 1 DAY)
|
| 94 |
and call_type ='fresh' order by created desc)
|
93 |
and call_type ='fresh' order by created desc)
|
| 95 |
as a group by retailer_id)
|
94 |
as a group by retailer_id)
|
| 96 |
a1 group by date(created), call_disposition;
|
95 |
a1 group by date(created), call_disposition;
|
| 97 |
"""
|
96 |
"""
|
| 98 |
AGENT_FRESH_QUERY="""
|
97 |
AGENT_FRESH_QUERY="""
|
| 99 |
select call_disposition,count(1) from
|
98 |
select call_disposition,count(1) from
|
| 100 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 3 DAY)
|
99 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 1 DAY)
|
| 101 |
and call_type ='fresh' and agent_id=%s order by created desc)
|
100 |
and call_type ='fresh' and agent_id=%s order by created desc)
|
| 102 |
as a group by retailer_id)
|
101 |
as a group by retailer_id)
|
| 103 |
a1 group by date(created), call_disposition,agent_id;
|
102 |
a1 group by date(created), call_disposition,agent_id;
|
| 104 |
"""
|
103 |
"""
|
| 105 |
AGENT_NAME_QUERY="""
|
104 |
AGENT_NAME_QUERY="""
|
| 106 |
select name from agents where id=%s
|
105 |
select name from agents where id=%s
|
| 107 |
"""
|
106 |
"""
|
| 108 |
FRESH_QUERY_LOGIN_TIME="""
|
107 |
FRESH_QUERY_LOGIN_TIME="""
|
| 109 |
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='fresh' and date(created)=date(now() - INTERVAL 3 DAY);
|
108 |
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='fresh' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 110 |
"""
|
109 |
"""
|
| 111 |
FRESH_QUERY_DURATION="""
|
110 |
FRESH_QUERY_DURATION="""
|
| 112 |
select sum(duration_sec) from callhistory where call_type ='fresh' and date(created)=date(now() - INTERVAL 3 DAY);
|
111 |
select sum(duration_sec) from callhistory where call_type ='fresh' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 113 |
"""
|
112 |
"""
|
| 114 |
FRESH_QUERY_AHT="""
|
113 |
FRESH_QUERY_AHT="""
|
| 115 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='fresh' and date(created)=date(now() - INTERVAL 3 DAY );
|
114 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY );
|
| 116 |
"""
|
115 |
"""
|
| 117 |
FRESH_QUERY_AIT="""
|
116 |
FRESH_QUERY_AIT="""
|
| 118 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 3 DAY);
|
117 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 119 |
"""
|
118 |
"""
|
| 120 |
FRESH_QUERY_LINKS_CONVERTED="""
|
119 |
FRESH_QUERY_LINKS_CONVERTED="""
|
| 121 |
select count(*) from retailerlinks where date(activated) = date(created) and date(created)=date(now() - interval 3 day);
|
120 |
select count(*) from retailerlinks where date(activated) = date(created) and date(created)=date(now() - interval 1 day);
|
| 122 |
"""
|
121 |
"""
|
| 123 |
FRESH_QUERY_LINKS_NOT_CONVERTED="""
|
122 |
FRESH_QUERY_LINKS_NOT_CONVERTED="""
|
| 124 |
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 3 day);
|
123 |
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 1 day);
|
| 125 |
"""
|
124 |
"""
|
| 126 |
|
125 |
|
| 127 |
|
126 |
|
| 128 |
AGENT_FRESH_QUERY_LOGIN_TIME="""
|
127 |
AGENT_FRESH_QUERY_LOGIN_TIME="""
|
| 129 |
select TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='fresh' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
128 |
select TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='fresh' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 130 |
"""
|
129 |
"""
|
| 131 |
AGENT_FRESH_QUERY_DURATION="""
|
130 |
AGENT_FRESH_QUERY_DURATION="""
|
| 132 |
select sum(duration_sec) from callhistory where call_type ='fresh' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
131 |
select sum(duration_sec) from callhistory where call_type ='fresh' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 133 |
"""
|
132 |
"""
|
| 134 |
AGENT_FRESH_QUERY_AHT="""
|
133 |
AGENT_FRESH_QUERY_AHT="""
|
| 135 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='fresh' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
134 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 136 |
"""
|
135 |
"""
|
| 137 |
AGENT_FRESH_QUERY_AIT="""
|
136 |
AGENT_FRESH_QUERY_AIT="""
|
| 138 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
137 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 139 |
"""
|
138 |
"""
|
| 140 |
AGENT_FRESH_QUERY_LINKS_CONVERTED="""
|
139 |
AGENT_FRESH_QUERY_LINKS_CONVERTED="""
|
| 141 |
select count(*) from retailerlinks where date(activated) = date(created) and date(created)=date(now() - interval 3 day) and agent_id=%s;
|
140 |
select count(*) from retailerlinks where date(activated) = date(created) and date(created)=date(now() - interval 1 day) and agent_id=%s;
|
| 142 |
"""
|
141 |
"""
|
| 143 |
AGENT_FRESH_QUERY_LINKS_NOT_CONVERTED="""
|
142 |
AGENT_FRESH_QUERY_LINKS_NOT_CONVERTED="""
|
| 144 |
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 3 day) and agent_id=%s;
|
143 |
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 1 day) and agent_id=%s;
|
| 145 |
"""
|
144 |
"""
|
| 146 |
|
145 |
|
| 147 |
|
146 |
|
| 148 |
FOLLOW_UP_QUERY="""
|
147 |
FOLLOW_UP_QUERY="""
|
| 149 |
select call_disposition,count(1) from
|
148 |
select call_disposition,count(1) from
|
| 150 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 3 DAY)
|
149 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 1 DAY)
|
| 151 |
and call_type ='followup' order by created desc)
|
150 |
and call_type ='followup' order by created desc)
|
| 152 |
as a group by retailer_id)
|
151 |
as a group by retailer_id)
|
| 153 |
a1 group by date(created), call_disposition;
|
152 |
a1 group by date(created), call_disposition;
|
| 154 |
"""
|
153 |
"""
|
| 155 |
AGENT_FOLLOW_UP_QUERY="""
|
154 |
AGENT_FOLLOW_UP_QUERY="""
|
| 156 |
select call_disposition,count(1) from
|
155 |
select call_disposition,count(1) from
|
| 157 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 3 DAY)
|
156 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 1 DAY)
|
| 158 |
and call_type ='followup' and agent_id=%s order by created desc)
|
157 |
and call_type ='followup' and agent_id=%s order by created desc)
|
| 159 |
as a group by retailer_id)
|
158 |
as a group by retailer_id)
|
| 160 |
a1 group by date(created), call_disposition,agent_id;
|
159 |
a1 group by date(created), call_disposition,agent_id;
|
| 161 |
"""
|
160 |
"""
|
| 162 |
FOLLOW_UP_QUERY_LOGIN_TIME="""
|
161 |
FOLLOW_UP_QUERY_LOGIN_TIME="""
|
| 163 |
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='followup' and date(created)=date(now() - INTERVAL 3 DAY);
|
162 |
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='followup' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 164 |
"""
|
163 |
"""
|
| 165 |
FOLLOW_UP_QUERY_DURATION="""
|
164 |
FOLLOW_UP_QUERY_DURATION="""
|
| 166 |
select sum(duration_sec) from callhistory where call_type ='followup' and date(created)=date(now() - INTERVAL 3 DAY);
|
165 |
select sum(duration_sec) from callhistory where call_type ='followup' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 167 |
"""
|
166 |
"""
|
| 168 |
FOLLOW_UP_QUERY_AHT="""
|
167 |
FOLLOW_UP_QUERY_AHT="""
|
| 169 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='followup' and date(created)=date(now() - INTERVAL 3 DAY );
|
168 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='followup' and date(created)=date(now() - INTERVAL 1 DAY );
|
| 170 |
"""
|
169 |
"""
|
| 171 |
FOLLOW_UP_QUERY_AIT="""
|
170 |
FOLLOW_UP_QUERY_AIT="""
|
| 172 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='followup' and date(created)=date(now() - INTERVAL 3 DAY);
|
171 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='followup' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 173 |
"""
|
172 |
"""
|
| 174 |
AGENT_FOLLOW_UP_QUERY_LOGIN_TIME="""
|
173 |
AGENT_FOLLOW_UP_QUERY_LOGIN_TIME="""
|
| 175 |
select TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='followup' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
174 |
select TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='followup' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 176 |
"""
|
175 |
"""
|
| 177 |
AGENT_FOLLOW_UP_QUERY_DURATION="""
|
176 |
AGENT_FOLLOW_UP_QUERY_DURATION="""
|
| 178 |
select sum(duration_sec) from callhistory where call_type ='followup' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
177 |
select sum(duration_sec) from callhistory where call_type ='followup' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 179 |
"""
|
178 |
"""
|
| 180 |
AGENT_FOLLOW_UP_QUERY_AHT="""
|
179 |
AGENT_FOLLOW_UP_QUERY_AHT="""
|
| 181 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='followup' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
180 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='followup' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 182 |
"""
|
181 |
"""
|
| 183 |
AGENT_FOLLOW_UP_QUERY_AIT="""
|
182 |
AGENT_FOLLOW_UP_QUERY_AIT="""
|
| 184 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='followup' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
183 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='followup' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 185 |
"""
|
184 |
"""
|
| 186 |
|
185 |
|
| 187 |
|
186 |
|
| 188 |
ONBOARDING_QUERY="""
|
187 |
ONBOARDING_QUERY="""
|
| 189 |
select call_disposition,count(1) from
|
188 |
select call_disposition,count(1) from
|
| 190 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 3 DAY)
|
189 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 1 DAY)
|
| 191 |
and call_type ='onboarding' order by created desc)
|
190 |
and call_type ='onboarding' order by created desc)
|
| 192 |
as a group by retailer_id)
|
191 |
as a group by retailer_id)
|
| 193 |
a1 group by date(created), call_disposition;
|
192 |
a1 group by date(created), call_disposition;
|
| 194 |
"""
|
193 |
"""
|
| 195 |
ONBOARDING_QUERY_LOGIN_TIME="""
|
194 |
ONBOARDING_QUERY_LOGIN_TIME="""
|
| 196 |
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='onboarding' and date(created)=date(now() - INTERVAL 3 DAY);
|
195 |
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='onboarding' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 197 |
"""
|
196 |
"""
|
| 198 |
ONBOARDING_QUERY_DURATION="""
|
197 |
ONBOARDING_QUERY_DURATION="""
|
| 199 |
select sum(duration_sec) from callhistory where call_type ='onboarding' and date(created)=date(now() - INTERVAL 3 DAY);
|
198 |
select sum(duration_sec) from callhistory where call_type ='onboarding' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 200 |
"""
|
199 |
"""
|
| 201 |
ONBOARDING_QUERY_AHT="""
|
200 |
ONBOARDING_QUERY_AHT="""
|
| 202 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='onboarding' and date(created)=date(now() - INTERVAL 3 DAY );
|
201 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='onboarding' and date(created)=date(now() - INTERVAL 1 DAY );
|
| 203 |
"""
|
202 |
"""
|
| 204 |
ONBOARDING_QUERY_AIT="""
|
203 |
ONBOARDING_QUERY_AIT="""
|
| 205 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='onboarding' and date(created)=date(now() - INTERVAL 3 DAY);
|
204 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='onboarding' and date(created)=date(now() - INTERVAL 1 DAY);
|
| 206 |
"""
|
205 |
"""
|
| 207 |
|
206 |
|
| 208 |
AGENT_ONBOARDING_QUERY="""
|
207 |
AGENT_ONBOARDING_QUERY="""
|
| 209 |
select call_disposition,count(1) from
|
208 |
select call_disposition,count(1) from
|
| 210 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 3 DAY)
|
209 |
(select * from (select * from callhistory where date(created)=date(now() - INTERVAL 1 DAY)
|
| 211 |
and call_type ='onboarding' and agent_id=%s order by created desc)
|
210 |
and call_type ='onboarding' and agent_id=%s order by created desc)
|
| 212 |
as a group by retailer_id)
|
211 |
as a group by retailer_id)
|
| 213 |
a1 group by date(created), call_disposition,agent_id;
|
212 |
a1 group by date(created), call_disposition,agent_id;
|
| 214 |
"""
|
213 |
"""
|
| 215 |
AGENT_ONBOARDING_QUERY_LOGIN_TIME="""
|
214 |
AGENT_ONBOARDING_QUERY_LOGIN_TIME="""
|
| 216 |
select TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='onboarding' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
215 |
select TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='onboarding' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 217 |
"""
|
216 |
"""
|
| 218 |
AGENT_ONBOARDING_QUERY_DURATION="""
|
217 |
AGENT_ONBOARDING_QUERY_DURATION="""
|
| 219 |
select sum(duration_sec) from callhistory where call_type ='onboarding' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
218 |
select sum(duration_sec) from callhistory where call_type ='onboarding' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 220 |
"""
|
219 |
"""
|
| 221 |
AGENT_ONBOARDING_QUERY_AHT="""
|
220 |
AGENT_ONBOARDING_QUERY_AHT="""
|
| 222 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='onboarding' and date(created)=date(now() - INTERVAL 3 DAY ) and agent_id=%s;
|
221 |
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='onboarding' and date(created)=date(now() - INTERVAL 1 DAY ) and agent_id=%s;
|
| 223 |
"""
|
222 |
"""
|
| 224 |
AGENT_ONBOARDING_QUERY_AIT="""
|
223 |
AGENT_ONBOARDING_QUERY_AIT="""
|
| 225 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='onboarding' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
224 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='onboarding' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 226 |
"""
|
225 |
"""
|
| 227 |
AGENT_ONBOARDING_QUERY_AIT="""
|
226 |
AGENT_ONBOARDING_QUERY_AIT="""
|
| 228 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='onboarding' and date(created)=date(now() - INTERVAL 3 DAY) and agent_id=%s;
|
227 |
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='onboarding' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
|
| 229 |
"""
|
228 |
"""
|
| 230 |
|
229 |
|
| 231 |
center_alignment=xlwt.easyxf("align: horiz center")
|
230 |
center_alignment=xlwt.easyxf("align: horiz center")
|
| 232 |
|
231 |
|
| 233 |
|
232 |
|
| Line 448... |
Line 447... |
| 448 |
worksheet.write(row+21,column-1, 'Idle Time (In Hrs)', style)
|
447 |
worksheet.write(row+21,column-1, 'Idle Time (In Hrs)', style)
|
| 449 |
worksheet.write(row+22,column-1, 'Links Converted', style)
|
448 |
worksheet.write(row+22,column-1, 'Links Converted', style)
|
| 450 |
worksheet.write(row+23,column-1, 'Link sent yet to be converted', style)
|
449 |
worksheet.write(row+23,column-1, 'Link sent yet to be converted', style)
|
| 451 |
columnId=agentId
|
450 |
columnId=agentId
|
| 452 |
while True:
|
451 |
while True:
|
| 453 |
if agentId >5 :
|
452 |
if agentId >20 :
|
| 454 |
break
|
453 |
break
|
| 455 |
else:
|
454 |
else:
|
| 456 |
datesql=AGENT_FRESH_QUERY %(agentId)
|
455 |
datesql=AGENT_FRESH_QUERY %(agentId)
|
| 457 |
conn = getDbConnection()
|
456 |
conn = getDbConnection()
|
| 458 |
|
457 |
|
| Line 755... |
Line 754... |
| 755 |
worksheet.write(row+12,column-1, 'Call Duration (In Hrs)', style)
|
754 |
worksheet.write(row+12,column-1, 'Call Duration (In Hrs)', style)
|
| 756 |
worksheet.write(row+13,column-1, 'Handling Time (In Hrs)', style)
|
755 |
worksheet.write(row+13,column-1, 'Handling Time (In Hrs)', style)
|
| 757 |
worksheet.write(row+14,column-1, 'Idle Time (In Hrs)', style)
|
756 |
worksheet.write(row+14,column-1, 'Idle Time (In Hrs)', style)
|
| 758 |
columnId=agentId
|
757 |
columnId=agentId
|
| 759 |
while True:
|
758 |
while True:
|
| 760 |
if agentId >5 :
|
759 |
if agentId >20 :
|
| 761 |
break
|
760 |
break
|
| 762 |
else:
|
761 |
else:
|
| 763 |
datesql=AGENT_FOLLOW_UP_QUERY %(agentId)
|
762 |
datesql=AGENT_FOLLOW_UP_QUERY %(agentId)
|
| 764 |
conn = getDbConnection()
|
763 |
conn = getDbConnection()
|
| 765 |
|
764 |
|
| Line 1037... |
Line 1036... |
| 1037 |
worksheet.write(row+10,column-1, 'Call Duration (In Hrs)', style)
|
1036 |
worksheet.write(row+10,column-1, 'Call Duration (In Hrs)', style)
|
| 1038 |
worksheet.write(row+11,column-1, 'Handling Time (In Hrs)', style)
|
1037 |
worksheet.write(row+11,column-1, 'Handling Time (In Hrs)', style)
|
| 1039 |
worksheet.write(row+12,column-1, 'Idle Time (In Hrs)', style)
|
1038 |
worksheet.write(row+12,column-1, 'Idle Time (In Hrs)', style)
|
| 1040 |
columnId=agentId
|
1039 |
columnId=agentId
|
| 1041 |
while True:
|
1040 |
while True:
|
| 1042 |
if agentId >6 :
|
1041 |
if agentId >20 :
|
| 1043 |
break
|
1042 |
break
|
| 1044 |
else:
|
1043 |
else:
|
| 1045 |
datesql=AGENT_ONBOARDING_QUERY %(agentId)
|
1044 |
datesql=AGENT_ONBOARDING_QUERY %(agentId)
|
| 1046 |
conn = getDbConnection()
|
1045 |
conn = getDbConnection()
|
| 1047 |
|
1046 |
|
| Line 1157... |
Line 1156... |
| 1157 |
generateAgentWiseFreshCallingReport()
|
1156 |
generateAgentWiseFreshCallingReport()
|
| 1158 |
generateFollowUpCallingReport()
|
1157 |
generateFollowUpCallingReport()
|
| 1159 |
generateAgentWiseFollowupCallingReport()
|
1158 |
generateAgentWiseFollowupCallingReport()
|
| 1160 |
generateOnBoardingCallingReport()
|
1159 |
generateOnBoardingCallingReport()
|
| 1161 |
generateAgentWiseOnboardingCallingReport()
|
1160 |
generateAgentWiseOnboardingCallingReport()
|
| 1162 |
sendmail(["manas.kapoor@shop2020.in,amit.sirohi@shop2020.in"], "", TMP_FILE, SUBJECT)
|
1161 |
sendmail(["manas.kapoor@shop2020.in","amit.sirohi@shop2020.in"], "", TMP_FILE, SUBJECT)
|
| 1163 |
|
1162 |
|
| 1164 |
def sendmail(email, message, fileName, title):
|
1163 |
def sendmail(email, message, fileName, title):
|
| 1165 |
if email == "":
|
1164 |
if email == "":
|
| 1166 |
return
|
1165 |
return
|
| 1167 |
mailServer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
|
1166 |
mailServer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
|