Subversion Repositories SmartDukaan

Rev

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

Rev 15506 Rev 15513
Line 607... Line 607...
607
                    loginTime=0
607
                    loginTime=0
608
                    for r in result:
608
                    for r in result:
609
                        #worksheet.write(25+22,columnId,r[0],center_alignment)
609
                        #worksheet.write(25+22,columnId,r[0],center_alignment)
610
                        converted=r[0]
610
                        converted=r[0]
611
                        worksheet.write(25+22,columnId,r[0],center_alignment)
611
                        worksheet.write(25+22,columnId,r[0],center_alignment)
-
 
612
                    
-
 
613
                    if totalVerifiedLinkSent==0:
-
 
614
                        worksheet.write(25+23,columnId,0,center_alignment)
-
 
615
                    else:
612
                    worksheet.write(25+23,columnId,totalVerifiedLinkSent-converted,center_alignment)    
616
                        worksheet.write(25+23,columnId,totalVerifiedLinkSent-converted,center_alignment)    
613
                    conn.close()
617
                    conn.close()
614
#                     datesql=AGENT_FRESH_QUERY_LINKS_NOT_CONVERTED%(agentId)
618
#                     datesql=AGENT_FRESH_QUERY_LINKS_NOT_CONVERTED%(agentId)
615
#                     conn = getDbConnection()
619
#                     conn = getDbConnection()
616
#                     
620
#                     
617
#                     cursor = conn.cursor()
621
#                     cursor = conn.cursor()
Line 946... Line 950...
946
    boldStyle.font = f
950
    boldStyle.font = f
947
    
951
    
948
    column = 0
952
    column = 0
949
    row = 0
953
    row = 0
950
    currentList=[]
954
    currentList=[]
951
    
955
    if len(result)==0:
952
    worksheet.write(0,0,'Call Disposition Type',style)
956
        print 'No Data'
953
    worksheet.write(0,1,'Count',style)
957
        pass
954
    worksheet.write(1, column, 'Call Later', newStyle)
958
    else:
955
    worksheet.write(2,column, 'Ringing No Answer', newStyle)
959
        worksheet.write(0,0,'Call Disposition Type',style)
956
    worksheet.write(3,column, 'Not Reachable', newStyle)
960
        worksheet.write(0,1,'Count',style)
957
    worksheet.write(4,column, 'Switched Off', newStyle)
961
        worksheet.write(1, column, 'Call Later', newStyle)
958
    worksheet.write(5,column, 'Successful', newStyle)
962
        worksheet.write(2,column, 'Ringing No Answer', newStyle)
959
    worksheet.write(6,column, 'Contactable Data', newStyle)
963
        worksheet.write(3,column, 'Not Reachable', newStyle)
960
    worksheet.write(7,column, 'Non Contactable Data', newStyle)
964
        worksheet.write(4,column, 'Switched Off', newStyle)
961
    worksheet.write(8,column, 'Agents Logged In', style)
965
        worksheet.write(5,column, 'Successful', newStyle)
962
    worksheet.write(9,column, 'Average Login Time (In Hrs)', style)
966
        worksheet.write(6,column, 'Contactable Data', newStyle)
963
    worksheet.write(10,column, 'Total Dialed Out', style)
967
        worksheet.write(7,column, 'Non Contactable Data', newStyle)
964
    worksheet.write(11,column, 'Average Dialed Out per agent', style)
968
        worksheet.write(8,column, 'Agents Logged In', style)
965
    worksheet.write(12,column, 'Average Call Duration (In Hrs)', style)
969
        worksheet.write(9,column, 'Average Login Time (In Hrs)', style)
966
    worksheet.write(13,column, 'Average Handling Time (In Hrs)', style)
970
        worksheet.write(10,column, 'Total Dialed Out', style)
967
    worksheet.write(14,column, 'Average Idle Time (In Hrs)', style)
971
        worksheet.write(11,column, 'Average Dialed Out per agent', style)
968
    
972
        worksheet.write(12,column, 'Average Call Duration (In Hrs)', style)
969
    contactableData=0
973
        worksheet.write(13,column, 'Average Handling Time (In Hrs)', style)
970
    nonContactableData=0
974
        worksheet.write(14,column, 'Average Idle Time (In Hrs)', style)
971
    totalDispositions=0
975
        
972
    for r in result:
976
        contactableData=0
973
        row = onBoardingDispositionMap.get(r[0])+1
977
        nonContactableData=0
974
        if onBoardingDispositionMap.get(r[0]) == 1 or onBoardingDispositionMap.get(r[0]) == 2 or onBoardingDispositionMap.get(r[0]) == 3:
978
        totalDispositions=0
975
            nonContactableData+=int(r[1])
979
        for r in result:
976
        else:
980
            row = onBoardingDispositionMap.get(r[0])+1
977
            contactableData+=r[1] 
981
            if onBoardingDispositionMap.get(r[0]) == 1 or onBoardingDispositionMap.get(r[0]) == 2 or onBoardingDispositionMap.get(r[0]) == 3:
978
        currentList.append(str(row))
982
                nonContactableData+=int(r[1])
979
        column = 1
983
            else:
980
        worksheet.write(row, column, r[1],center_alignment)
984
                contactableData+=r[1] 
981
    
985
            currentList.append(str(row))
982
    remainingList = list(set(onBoardingList) - set(currentList))
986
            column = 1
983
    
987
            worksheet.write(row, column, r[1],center_alignment)
984
    for i,val in enumerate(remainingList):
988
        
985
        row = int(val)
989
        remainingList = list(set(onBoardingList) - set(currentList))
986
        column = 1
990
        
987
        worksheet.write(row, column, 0,center_alignment)
991
        for i,val in enumerate(remainingList):
988
    totalDispositions=contactableData+nonContactableData
992
            row = int(val)
989
    worksheet.write(6,1,round((contactableData/float(totalDispositions))*100,2),center_alignment)
993
            column = 1
990
    worksheet.write(7,1,round((nonContactableData/float(totalDispositions))*100,2),center_alignment)
994
            worksheet.write(row, column, 0,center_alignment)
991
    
995
        totalDispositions=contactableData+nonContactableData
992
    
996
        worksheet.write(6,1,round((contactableData/float(totalDispositions))*100,2),center_alignment)
993
    conn.close()
997
        worksheet.write(7,1,round((nonContactableData/float(totalDispositions))*100,2),center_alignment)
994
    datesql=ONBOARDING_QUERY_LOGIN_TIME 
998
        
995
    conn = getDbConnection()
999
        
996
    
1000
        conn.close()
997
    cursor = conn.cursor()
1001
        datesql=ONBOARDING_QUERY_LOGIN_TIME 
998
    cursor.execute(datesql)
1002
        conn = getDbConnection()
999
    result = cursor.fetchall()
1003
        
1000
    agentLoginList=[]
1004
        cursor = conn.cursor()
1001
    averageLoginTime=0
1005
        cursor.execute(datesql)
1002
    loginTime=0
1006
        result = cursor.fetchall()
1003
    for r in result:
1007
        agentLoginList=[]
1004
        loginTime+=r[1].seconds
1008
        averageLoginTime=0
1005
        agentLoginList.append(str(r[0]))
1009
        loginTime=0
1006
    averageLoginTime=loginTime/len(list(set(agentLoginList)))
1010
        for r in result:
1007
    hours=averageLoginTime/3600
1011
            loginTime+=r[1].seconds
1008
    minutesLeft=(averageLoginTime%3600)/60
1012
            agentLoginList.append(str(r[0]))
1009
    worksheet.write(8,1,len(list(set(agentLoginList))),center_alignment)
1013
        averageLoginTime=loginTime/len(list(set(agentLoginList)))
1010
    worksheet.write(9,1,str(hours) + ':'+ str(minutesLeft),center_alignment)   
1014
        hours=averageLoginTime/3600
1011
    worksheet.write(10,1,totalDispositions,center_alignment)
1015
        minutesLeft=(averageLoginTime%3600)/60
1012
    worksheet.write(11,1,(contactableData+nonContactableData)/len(list(set(agentLoginList))),center_alignment)
1016
        worksheet.write(8,1,len(list(set(agentLoginList))),center_alignment)
1013
    conn.close()
1017
        worksheet.write(9,1,str(hours) + ':'+ str(minutesLeft),center_alignment)   
1014
    datesql=ONBOARDING_QUERY_DURATION
1018
        worksheet.write(10,1,totalDispositions,center_alignment)
1015
    conn = getDbConnection()
1019
        worksheet.write(11,1,(contactableData+nonContactableData)/len(list(set(agentLoginList))),center_alignment)
1016
    
1020
        conn.close()
1017
    cursor = conn.cursor()
1021
        datesql=ONBOARDING_QUERY_DURATION
1018
    cursor.execute(datesql)
1022
        conn = getDbConnection()
1019
    result = cursor.fetchall()
1023
        
1020
    for r in result:
1024
        cursor = conn.cursor()
1021
        totalCallDuration= r[0]
1025
        cursor.execute(datesql)
1022
    averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))    
1026
        result = cursor.fetchall()
1023
    hours=averageCallDuration/3600
1027
        for r in result:
1024
    minutesLeft=(averageCallDuration%3600)/60    
1028
            totalCallDuration= r[0]
1025
    worksheet.write(12,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
1029
        averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))    
1026
    
1030
        hours=averageCallDuration/3600
1027
    conn.close()
1031
        minutesLeft=(averageCallDuration%3600)/60    
1028
    datesql=ONBOARDING_QUERY_AHT
1032
        worksheet.write(12,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
1029
    conn = getDbConnection()
1033
        
1030
    
1034
        conn.close()
1031
    cursor = conn.cursor()
1035
        datesql=ONBOARDING_QUERY_AHT
1032
    cursor.execute(datesql)
1036
        conn = getDbConnection()
1033
    result = cursor.fetchall()
1037
        
1034
    for r in result:
1038
        cursor = conn.cursor()
1035
        totalCallDuration= r[0]
1039
        cursor.execute(datesql)
1036
    averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))    
1040
        result = cursor.fetchall()
1037
    hours=averageCallDuration/3600
1041
        for r in result:
1038
    minutesLeft=(averageCallDuration%3600)/60    
1042
            totalCallDuration= r[0]
1039
    worksheet.write(13,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
1043
        averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))    
1040
    conn.close()
1044
        hours=averageCallDuration/3600
1041
    datesql=ONBOARDING_QUERY_AIT
1045
        minutesLeft=(averageCallDuration%3600)/60    
1042
    conn = getDbConnection()
1046
        worksheet.write(13,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
1043
    
1047
        conn.close()
1044
    cursor = conn.cursor()
1048
        datesql=ONBOARDING_QUERY_AIT
1045
    cursor.execute(datesql)
1049
        conn = getDbConnection()
1046
    result = cursor.fetchall()
1050
        
1047
    for r in result:
1051
        cursor = conn.cursor()
1048
        totalCallDuration= r[0]
1052
        cursor.execute(datesql)
1049
    averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))
1053
        result = cursor.fetchall()
1050
    hours=averageCallDuration/3600
1054
        for r in result:
1051
    minutesLeft=(averageCallDuration%3600)/60    
1055
            totalCallDuration= r[0]
1052
    worksheet.write(14,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
1056
        averageCallDuration=totalCallDuration/len(list(set(agentLoginList)))
1053
    workbook.save(TMP_FILE)
1057
        hours=averageCallDuration/3600
-
 
1058
        minutesLeft=(averageCallDuration%3600)/60    
-
 
1059
        worksheet.write(14,1,str(int(hours))+':'+str(int(minutesLeft)),center_alignment)
-
 
1060
        workbook.save(TMP_FILE)
1054
    
1061
    
1055
    #sendmail(["manas.kapoor@shop2020.in"], "", TMP_FILE, SUBJECT)        
1062
    #sendmail(["manas.kapoor@shop2020.in"], "", TMP_FILE, SUBJECT)        
1056
 
1063
 
1057
 
1064
 
1058
def generateAgentWiseOnboardingCallingReport():
1065
def generateAgentWiseOnboardingCallingReport():