| Line 342... |
Line 342... |
| 342 |
agentLoginList=[]
|
342 |
agentLoginList=[]
|
| 343 |
for r in result:
|
343 |
for r in result:
|
| 344 |
agentLoginList.append(str(r[0]))
|
344 |
agentLoginList.append(str(r[0]))
|
| 345 |
|
345 |
|
| 346 |
conn.close()
|
346 |
conn.close()
|
| 347 |
|
- |
|
| 348 |
datesql=FRESH_QUERY_LOGIN_TIME
|
- |
|
| 349 |
conn = getDbConnection()
|
- |
|
| 350 |
cursor = conn.cursor()
|
- |
|
| 351 |
cursor.execute(datesql)
|
- |
|
| 352 |
result = cursor.fetchall()
|
- |
|
| 353 |
loginTime=0
|
- |
|
| 354 |
for r in result:
|
- |
|
| 355 |
loginTime+=r[1].seconds
|
- |
|
| 356 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
- |
|
| 357 |
hours=averageLoginTime/3600
|
- |
|
| 358 |
minutesLeft=(averageLoginTime%3600)/60
|
- |
|
| 359 |
worksheet.write(17,1,len(list(set(agentLoginList))),center_alignment)
|
- |
|
| 360 |
worksheet.write(18,1,str(hours) + ':'+ str(minutesLeft),center_alignment)
|
- |
|
| 361 |
worksheet.write(19,1,totalDispositions,center_alignment)
|
- |
|
| 362 |
worksheet.write(20,1,totalDispositions/float(len(list(set(agentLoginList)))),center_alignment)
|
- |
|
| 363 |
conn.close()
|
- |
|
| 364 |
datesql=FRESH_QUERY_DURATION
|
- |
|
| 365 |
conn = getDbConnection()
|
- |
|
| 366 |
|
- |
|
| 367 |
cursor = conn.cursor()
|
- |
|
| 368 |
cursor.execute(datesql)
|
- |
|
| 369 |
result = cursor.fetchall()
|
- |
|
| 370 |
for r in result:
|
- |
|
| 371 |
totalCallDuration= r[0]
|
- |
|
| 372 |
averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))
|
- |
|
| 373 |
hours=averageCallDuration/3600
|
- |
|
| 374 |
minutesLeft=(averageCallDuration%3600)/60
|
- |
|
| 375 |
worksheet.write(21,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
|
- |
|
| 376 |
|
- |
|
| 377 |
conn.close()
|
- |
|
| 378 |
datesql=FRESH_QUERY_AHT
|
- |
|
| 379 |
conn = getDbConnection()
|
- |
|
| 380 |
|
347 |
|
| - |
|
348 |
if len(list(set(agentLoginList))) > 0:
|
| - |
|
349 |
datesql=FRESH_QUERY_LOGIN_TIME
|
| - |
|
350 |
conn = getDbConnection()
|
| 381 |
cursor = conn.cursor()
|
351 |
cursor = conn.cursor()
|
| 382 |
cursor.execute(datesql)
|
352 |
cursor.execute(datesql)
|
| 383 |
result = cursor.fetchall()
|
353 |
result = cursor.fetchall()
|
| 384 |
loginTime=0
|
354 |
loginTime=0
|
| 385 |
for r in result:
|
355 |
for r in result:
|
| 386 |
loginTime+=r[0]
|
356 |
loginTime+=r[1].seconds
|
| 387 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
357 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
| 388 |
hours=averageLoginTime/3600
|
358 |
hours=averageLoginTime/3600
|
| 389 |
minutesLeft=(averageLoginTime%3600)/60
|
359 |
minutesLeft=(averageLoginTime%3600)/60
|
| 390 |
worksheet.write(22,1,len(list(set(agentLoginList))),center_alignment)
|
360 |
worksheet.write(17,1,len(list(set(agentLoginList))),center_alignment)
|
| - |
|
361 |
worksheet.write(18,1,str(hours) + ':'+ str(minutesLeft),center_alignment)
|
| - |
|
362 |
worksheet.write(19,1,totalDispositions,center_alignment)
|
| - |
|
363 |
worksheet.write(20,1,totalDispositions/float(len(list(set(agentLoginList)))),center_alignment)
|
| - |
|
364 |
conn.close()
|
| - |
|
365 |
datesql=FRESH_QUERY_DURATION
|
| - |
|
366 |
conn = getDbConnection()
|
| - |
|
367 |
|
| - |
|
368 |
cursor = conn.cursor()
|
| - |
|
369 |
cursor.execute(datesql)
|
| - |
|
370 |
result = cursor.fetchall()
|
| - |
|
371 |
for r in result:
|
| - |
|
372 |
totalCallDuration= r[0]
|
| - |
|
373 |
averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))
|
| - |
|
374 |
hours=averageCallDuration/3600
|
| - |
|
375 |
minutesLeft=(averageCallDuration%3600)/60
|
| - |
|
376 |
worksheet.write(21,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
|
| 391 |
|
377 |
|
| 392 |
conn.close()
|
378 |
conn.close()
|
| 393 |
datesql=FRESH_QUERY_AIT
|
379 |
datesql=FRESH_QUERY_AHT
|
| 394 |
conn = getDbConnection()
|
380 |
conn = getDbConnection()
|
| 395 |
|
381 |
|
| 396 |
cursor = conn.cursor()
|
382 |
cursor = conn.cursor()
|
| 397 |
cursor.execute(datesql)
|
383 |
cursor.execute(datesql)
|
| 398 |
result = cursor.fetchall()
|
384 |
result = cursor.fetchall()
|
| 399 |
loginTime=0
|
385 |
loginTime=0
|
| 400 |
for r in result:
|
386 |
for r in result:
|
| 401 |
if r[0] is not None:
|
- |
|
| 402 |
loginTime+=r[0]
|
387 |
loginTime+=r[0]
|
| 403 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
388 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
| 404 |
hours=averageLoginTime/3600
|
389 |
hours=averageLoginTime/3600
|
| 405 |
minutesLeft=(averageLoginTime%3600)/60
|
390 |
minutesLeft=(averageLoginTime%3600)/60
|
| 406 |
worksheet.write(23,1,len(list(set(agentLoginList))),center_alignment)
|
391 |
worksheet.write(22,1,len(list(set(agentLoginList))),center_alignment)
|
| - |
|
392 |
|
| - |
|
393 |
conn.close()
|
| - |
|
394 |
datesql=FRESH_QUERY_AIT
|
| - |
|
395 |
conn = getDbConnection()
|
| 407 |
|
396 |
|
| - |
|
397 |
cursor = conn.cursor()
|
| - |
|
398 |
cursor.execute(datesql)
|
| - |
|
399 |
result = cursor.fetchall()
|
| - |
|
400 |
loginTime=0
|
| - |
|
401 |
for r in result:
|
| - |
|
402 |
if r[0] is not None:
|
| - |
|
403 |
loginTime+=r[0]
|
| - |
|
404 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
| - |
|
405 |
hours=averageLoginTime/3600
|
| - |
|
406 |
minutesLeft=(averageLoginTime%3600)/60
|
| - |
|
407 |
worksheet.write(23,1,len(list(set(agentLoginList))),center_alignment)
|
| 408 |
conn.close()
|
408 |
conn.close()
|
| - |
|
409 |
|
| 409 |
datesql=FRESH_QUERY_LINKS_CONVERTED
|
410 |
datesql=FRESH_QUERY_LINKS_CONVERTED
|
| 410 |
conn = getDbConnection()
|
411 |
conn = getDbConnection()
|
| 411 |
global Converted
|
412 |
global Converted
|
| 412 |
global AgentsLoggedIn
|
413 |
global AgentsLoggedIn
|
| 413 |
AgentsLoggedIn=len(list(set(agentLoginList)))
|
414 |
AgentsLoggedIn=len(list(set(agentLoginList)))
|
| Line 518... |
Line 519... |
| 518 |
for i,val in enumerate(remainingList):
|
519 |
for i,val in enumerate(remainingList):
|
| 519 |
row = int(val)+26
|
520 |
row = int(val)+26
|
| 520 |
column = agentId
|
521 |
column = agentId
|
| 521 |
worksheet.write(row, columnId, 0,center_alignment)
|
522 |
worksheet.write(row, columnId, 0,center_alignment)
|
| 522 |
totalDialedOut = contactableData+nonContactableData
|
523 |
totalDialedOut = contactableData+nonContactableData
|
| - |
|
524 |
if totalDialedOut > 0:
|
| 523 |
worksheet.write(25+15,columnId,round((contactableData/float(totalDialedOut))*100,2),center_alignment)
|
525 |
worksheet.write(25+15,columnId,round((contactableData/float(totalDialedOut))*100,2),center_alignment)
|
| 524 |
worksheet.write(25+16,columnId,round((nonContactableData/float(totalDialedOut))*100,2),center_alignment)
|
526 |
worksheet.write(25+16,columnId,round((nonContactableData/float(totalDialedOut))*100,2),center_alignment)
|
| 525 |
worksheet.write(25+17,columnId,totalDialedOut,center_alignment)
|
527 |
worksheet.write(25+17,columnId,totalDialedOut,center_alignment)
|
| 526 |
conn.close()
|
528 |
conn.close()
|
| 527 |
|
529 |
|
| 528 |
name_query=AGENT_NAME_QUERY %(agentId)
|
530 |
name_query=AGENT_NAME_QUERY %(agentId)
|
| 529 |
conn = getDbConnection()
|
531 |
conn = getDbConnection()
|
| 530 |
column=agentId
|
532 |
column=agentId
|
| Line 692... |
Line 694... |
| 692 |
for i,val in enumerate(remainingList):
|
694 |
for i,val in enumerate(remainingList):
|
| 693 |
row = int(val)
|
695 |
row = int(val)
|
| 694 |
|
696 |
|
| 695 |
column = 1
|
697 |
column = 1
|
| 696 |
worksheet.write(row, column, 0,center_alignment)
|
698 |
worksheet.write(row, column, 0,center_alignment)
|
| - |
|
699 |
|
| 697 |
totalDispositions=contactableData+nonContactableData
|
700 |
totalDispositions=contactableData+nonContactableData
|
| - |
|
701 |
if totalDispositions >0:
|
| 698 |
worksheet.write(12,1,round((contactableData/float(totalDispositions))*100,2),center_alignment)
|
702 |
worksheet.write(12,1,round((contactableData/float(totalDispositions))*100,2),center_alignment)
|
| 699 |
worksheet.write(13,1,round((nonContactableData/float(totalDispositions))*100,2),center_alignment)
|
703 |
worksheet.write(13,1,round((nonContactableData/float(totalDispositions))*100,2),center_alignment)
|
| 700 |
|
704 |
|
| 701 |
|
705 |
|
| 702 |
conn.close()
|
706 |
conn.close()
|
| 703 |
datesql=FOLLOW_UP_QUERY_LOGIN_TIME
|
707 |
datesql=FOLLOW_UP_QUERY_LOGIN_TIME
|
| 704 |
conn = getDbConnection()
|
708 |
conn = getDbConnection()
|
| 705 |
|
709 |
|
| Line 710... |
Line 714... |
| 710 |
averageLoginTime=0
|
714 |
averageLoginTime=0
|
| 711 |
loginTime=0
|
715 |
loginTime=0
|
| 712 |
for r in result:
|
716 |
for r in result:
|
| 713 |
loginTime+=r[1].seconds
|
717 |
loginTime+=r[1].seconds
|
| 714 |
agentLoginList.append(str(r[0]))
|
718 |
agentLoginList.append(str(r[0]))
|
| - |
|
719 |
if len(list(set(agentLoginList))) > 0:
|
| 715 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
720 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
| 716 |
hours=averageLoginTime/3600
|
721 |
hours=averageLoginTime/3600
|
| 717 |
minutesLeft=(averageLoginTime%3600)/60
|
722 |
minutesLeft=(averageLoginTime%3600)/60
|
| 718 |
worksheet.write(14,1,len(list(set(agentLoginList))),center_alignment)
|
723 |
worksheet.write(14,1,len(list(set(agentLoginList))),center_alignment)
|
| 719 |
worksheet.write(15,1,str(hours) + ':'+ str(minutesLeft),center_alignment)
|
724 |
worksheet.write(15,1,str(hours) + ':'+ str(minutesLeft),center_alignment)
|
| 720 |
worksheet.write(16,1,totalDispositions,center_alignment)
|
725 |
worksheet.write(16,1,totalDispositions,center_alignment)
|
| 721 |
worksheet.write(17,1,(contactableData+nonContactableData)/len(list(set(agentLoginList))),center_alignment)
|
726 |
worksheet.write(17,1,(contactableData+nonContactableData)/len(list(set(agentLoginList))),center_alignment)
|
| 722 |
conn.close()
|
727 |
conn.close()
|
| 723 |
datesql=FOLLOW_UP_QUERY_DURATION
|
728 |
datesql=FOLLOW_UP_QUERY_DURATION
|
| 724 |
conn = getDbConnection()
|
729 |
conn = getDbConnection()
|
| 725 |
|
730 |
|
| 726 |
cursor = conn.cursor()
|
731 |
cursor = conn.cursor()
|
| 727 |
cursor.execute(datesql)
|
732 |
cursor.execute(datesql)
|
| 728 |
result = cursor.fetchall()
|
733 |
result = cursor.fetchall()
|
| 729 |
for r in result:
|
734 |
for r in result:
|
| 730 |
totalCallDuration= r[0]
|
735 |
totalCallDuration= r[0]
|
| 731 |
averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))
|
736 |
averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))
|
| 732 |
hours=averageCallDuration/3600
|
737 |
hours=averageCallDuration/3600
|
| 733 |
minutesLeft=(averageCallDuration%3600)/60
|
738 |
minutesLeft=(averageCallDuration%3600)/60
|
| 734 |
worksheet.write(18,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
|
739 |
worksheet.write(18,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
|
| 735 |
conn.close()
|
740 |
conn.close()
|
| 736 |
|
741 |
|
| 737 |
datesql=FOLLOW_UP_QUERY_AHT
|
742 |
datesql=FOLLOW_UP_QUERY_AHT
|
| 738 |
conn = getDbConnection()
|
743 |
conn = getDbConnection()
|
| 739 |
cursor = conn.cursor()
|
744 |
cursor = conn.cursor()
|
| 740 |
cursor.execute(datesql)
|
745 |
cursor.execute(datesql)
|
| 741 |
result = cursor.fetchall()
|
746 |
result = cursor.fetchall()
|
| 742 |
loginTime=0
|
747 |
loginTime=0
|
| 743 |
for r in result:
|
748 |
for r in result:
|
| 744 |
loginTime+=r[0]
|
749 |
loginTime+=r[0]
|
| 745 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
750 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
| 746 |
hours=averageLoginTime/3600
|
751 |
hours=averageLoginTime/3600
|
| 747 |
minutesLeft=(averageLoginTime%3600)/60
|
752 |
minutesLeft=(averageLoginTime%3600)/60
|
| 748 |
worksheet.write(19,1,len(list(set(agentLoginList))),center_alignment)
|
753 |
worksheet.write(19,1,len(list(set(agentLoginList))),center_alignment)
|
| 749 |
conn.close()
|
754 |
conn.close()
|
| 750 |
|
755 |
|
| 751 |
datesql=FOLLOW_UP_QUERY_AIT
|
756 |
datesql=FOLLOW_UP_QUERY_AIT
|
| 752 |
conn = getDbConnection()
|
757 |
conn = getDbConnection()
|
| 753 |
cursor = conn.cursor()
|
758 |
cursor = conn.cursor()
|
| 754 |
cursor.execute(datesql)
|
759 |
cursor.execute(datesql)
|
| 755 |
result = cursor.fetchall()
|
760 |
result = cursor.fetchall()
|
| 756 |
loginTime=0
|
761 |
loginTime=0
|
| 757 |
for r in result:
|
762 |
for r in result:
|
| 758 |
loginTime+=r[0]
|
763 |
loginTime+=r[0]
|
| 759 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
764 |
averageLoginTime=loginTime/len(list(set(agentLoginList)))
|
| 760 |
hours=averageLoginTime/3600
|
765 |
hours=averageLoginTime/3600
|
| 761 |
minutesLeft=(averageLoginTime%3600)/60
|
766 |
minutesLeft=(averageLoginTime%3600)/60
|
| 762 |
worksheet.write(20,1,len(list(set(agentLoginList))),center_alignment)
|
767 |
worksheet.write(20,1,len(list(set(agentLoginList))),center_alignment)
|
| 763 |
workbook.save(TMP_FILE)
|
768 |
workbook.save(TMP_FILE)
|
| 764 |
|
769 |
|
| 765 |
def generateAgentWiseFollowupCallingReport():
|
770 |
def generateAgentWiseFollowupCallingReport():
|
| 766 |
|
771 |
|
| 767 |
agentId=3
|
772 |
agentId=3
|
| Line 836... |
Line 841... |
| 836 |
for i,val in enumerate(remainingList):
|
841 |
for i,val in enumerate(remainingList):
|
| 837 |
row = int(val)+25
|
842 |
row = int(val)+25
|
| 838 |
column = agentId
|
843 |
column = agentId
|
| 839 |
worksheet.write(row, columnId, 0,center_alignment)
|
844 |
worksheet.write(row, columnId, 0,center_alignment)
|
| 840 |
totalDialedOut = contactableData+nonContactableData
|
845 |
totalDialedOut = contactableData+nonContactableData
|
| - |
|
846 |
if totalDialedOut>0:
|
| 841 |
worksheet.write(25+12,columnId,round((contactableData/float(totalDialedOut))*100,2),center_alignment)
|
847 |
worksheet.write(25+12,columnId,round((contactableData/float(totalDialedOut))*100,2),center_alignment)
|
| 842 |
worksheet.write(25+13,columnId,round((nonContactableData/float(totalDialedOut))*100,2),center_alignment)
|
848 |
worksheet.write(25+13,columnId,round((nonContactableData/float(totalDialedOut))*100,2),center_alignment)
|
| 843 |
worksheet.write(25+14,columnId,totalDialedOut,center_alignment)
|
849 |
worksheet.write(25+14,columnId,totalDialedOut,center_alignment)
|
| 844 |
conn.close()
|
850 |
conn.close()
|
| 845 |
|
851 |
|
| 846 |
name_query=AGENT_NAME_QUERY %(agentId)
|
852 |
name_query=AGENT_NAME_QUERY %(agentId)
|
| 847 |
conn = getDbConnection()
|
853 |
conn = getDbConnection()
|
| 848 |
column=agentId
|
854 |
column=agentId
|
| Line 1204... |
Line 1210... |
| 1204 |
generateAgentWiseFreshCallingReport()
|
1210 |
generateAgentWiseFreshCallingReport()
|
| 1205 |
generateFollowUpCallingReport()
|
1211 |
generateFollowUpCallingReport()
|
| 1206 |
generateAgentWiseFollowupCallingReport()
|
1212 |
generateAgentWiseFollowupCallingReport()
|
| 1207 |
generateOnBoardingCallingReport()
|
1213 |
generateOnBoardingCallingReport()
|
| 1208 |
generateAgentWiseOnboardingCallingReport()
|
1214 |
generateAgentWiseOnboardingCallingReport()
|
| 1209 |
sendmail(["manas.kapoor@shop2020.in","amit.sirohi@shop2020.in","rajneesh.arora@saholic.com","ritesh.chauhan@shop2020.in", "shailesh.kumar@shop2020.in"], "", TMP_FILE, SUBJECT)
|
1215 |
#sendmail(["manas.kapoor@shop2020.in","amit.sirohi@shop2020.in","rajneesh.arora@saholic.com","ritesh.chauhan@shop2020.in", "shailesh.kumar@shop2020.in"], "", TMP_FILE, SUBJECT)
|
| 1210 |
#sendmail(["manas.kapoor@shop2020.in"], "", TMP_FILE, SUBJECT)
|
1216 |
sendmail(["manas.kapoor@shop2020.in"], "", TMP_FILE, SUBJECT)
|
| 1211 |
|
1217 |
|
| 1212 |
def sendmail(email, message, fileName, title):
|
1218 |
def sendmail(email, message, fileName, title):
|
| 1213 |
if email == "":
|
1219 |
if email == "":
|
| 1214 |
return
|
1220 |
return
|
| 1215 |
mailServer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
|
1221 |
mailServer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
|
| Line 1231... |
Line 1237... |
| 1231 |
fileMsg.set_payload(file(TMP_FILE).read())
|
1237 |
fileMsg.set_payload(file(TMP_FILE).read())
|
| 1232 |
encoders.encode_base64(fileMsg)
|
1238 |
encoders.encode_base64(fileMsg)
|
| 1233 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
1239 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
| 1234 |
msg.attach(fileMsg)
|
1240 |
msg.attach(fileMsg)
|
| 1235 |
|
1241 |
|
| 1236 |
MAILTO = ['manas.kapoor@saholic.com','amit.sirohi@shop2020.in','rajneesh.arora@saholic.com', 'ritesh.chauhan@shop2020.in', 'shailesh.kumar@shop2020.in']
|
1242 |
#MAILTO = ['manas.kapoor@saholic.com','amit.sirohi@shop2020.in','rajneesh.arora@saholic.com', 'ritesh.chauhan@shop2020.in', 'shailesh.kumar@shop2020.in']
|
| 1237 |
#MAILTO = ['manas.kapoor@saholic.com']
|
1243 |
MAILTO = ['manas.kapoor@saholic.com']
|
| 1238 |
mailServer.login(SENDER, PASSWORD)
|
1244 |
mailServer.login(SENDER, PASSWORD)
|
| 1239 |
mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
|
1245 |
mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
|
| 1240 |
|
1246 |
|
| 1241 |
if __name__ == '__main__':
|
1247 |
if __name__ == '__main__':
|
| 1242 |
main()
|
1248 |
main()
|