Subversion Repositories SmartDukaan

Rev

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

Rev 19160 Rev 19551
Line 115... Line 115...
115
                'product_availability':9,
115
                'product_availability':9,
116
                'return_replacement':10,
116
                'return_replacement':10,
117
                'product_quality_issue':11,
117
                'product_quality_issue':11,
118
                'delayed_delivery':12,
118
                'delayed_delivery':12,
119
                'other_complaint':13,
119
                'other_complaint':13,
120
                'not_dealing_accessories':14
120
                'not_dealing_accessories':14,
-
 
121
                'scheme_not_clear':15
121
              }
122
              }
122
# FRESH_QUERY="""
123
# FRESH_QUERY="""
123
# select call_disposition,count(1) from 
124
# select call_disposition,count(1) from 
124
# (select * from (select * from callhistory where date(created)=date(now()) 
125
# (select * from (select * from callhistory where date(created)=date(now()) 
125
# and call_type ='fresh' order by created desc) 
126
# and call_type ='fresh' order by created desc) 
Line 296... Line 297...
296
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='accs_cart' and date(created)=date(now() - interval 1 day);
297
select agent_id,TIMEDIFF(logoutTime,loginTime) from agentlogintimings where role='accs_cart' and date(created)=date(now() - interval 1 day);
297
"""
298
"""
298
ACCS_CART_DISPOSITION_DESCRIPTION="""
299
ACCS_CART_DISPOSITION_DESCRIPTION="""
299
select user_id,call_disposition,disposition_description,disposition_comments 
300
select user_id,call_disposition,disposition_description,disposition_comments 
300
from callhistorycrm where call_disposition not in ('ringing_no_answer','not_reachable','switch_off','call_later') 
301
from callhistorycrm where call_disposition not in ('ringing_no_answer','not_reachable','switch_off','call_later') 
301
and date(created)=date(now() - interval 1 day)"""
302
and date(created)=date(now() - interval 1 day) and project_id=1"""
302
 
303
 
303
ACCS_CART_PRODUCT_PRICING="""
304
ACCS_CART_PRODUCT_PRICING="""
304
select user_id,call_disposition,product_input,pricing_input from productpricinginputs where 
305
select user_id,call_disposition,product_input,pricing_input from productpricinginputs where 
305
date(created)=date(now() - interval 1 day) and product_input not like '';
306
date(created)=date(now() - interval 1 day) and product_input not like '' and project_id=1;
306
"""
307
"""
307
 
308
 
308
ACCS_TAB_QUERY="""
309
ACCS_TAB_QUERY="""
309
select call_disposition,count(1) from 
310
select call_disposition,count(1) from 
310
(select * from (select * from callhistorycrm where date(created)=date(now() - interval 1 day) 
311
(select * from (select * from callhistorycrm where date(created)=date(now() - interval 1 day) 
Line 691... Line 692...
691
    worksheet.write(10,column, 'Return or replacement pending', newStyle)
692
    worksheet.write(10,column, 'Return or replacement pending', newStyle)
692
    worksheet.write(11,column, 'Product Quality issue', newStyle)
693
    worksheet.write(11,column, 'Product Quality issue', newStyle)
693
    worksheet.write(12,column, 'Delayed delivery', newStyle)
694
    worksheet.write(12,column, 'Delayed delivery', newStyle)
694
    worksheet.write(13,column, 'Other complaint with Profitmandi', newStyle)
695
    worksheet.write(13,column, 'Other complaint with Profitmandi', newStyle)
695
    worksheet.write(14,column, 'Not Dealing in Accessories/Not Interested', newStyle)
696
    worksheet.write(14,column, 'Not Dealing in Accessories/Not Interested', newStyle)
-
 
697
    worksheet.write(15,column, 'Scheme Not Clear to the user', newStyle)
696
    worksheet.write(15,column, 'Contactable Data (%)', newStyle)
698
    worksheet.write(16,column, 'Contactable Data (%)', newStyle)
697
    worksheet.write(16,column, 'Non Contactable Data (%)', newStyle)
699
    worksheet.write(17,column, 'Non Contactable Data (%)', newStyle)
698
    worksheet.write(17,column, 'Agents Logged In', style)
700
    worksheet.write(18,column, 'Agents Logged In', style)
699
    worksheet.write(18,column, 'Average Login Time (In Hrs)', style)
701
    worksheet.write(19,column, 'Average Login Time (In Hrs)', style)
700
    worksheet.write(19,column, 'Total Dialed Out', style)
702
    worksheet.write(20,column, 'Total Dialed Out', style)
701
    worksheet.write(20,column, 'Average Dialed Out per agent', style)
703
    worksheet.write(21,column, 'Average Dialed Out per agent', style)
702
 
704
 
703
    contactableData=0
705
    contactableData=0
704
    nonContactableData=0
706
    nonContactableData=0
705
    for r in result:
707
    for r in result:
706
        row = accsDispositionOrdersMap.get(r[0])
708
        row = accsDispositionOrdersMap.get(r[0])
707
        if accsDispositionOrdersMap.get(r[0]) == 2 or accsDispositionOrdersMap.get(r[0]) == 3 or accsDispositionOrdersMap.get(r[0]) == 4:
709
        if accsDispositionOrdersMap.get(r[0]) == 2 or accsDispositionOrdersMap.get(r[0]) == 3 or accsDispositionOrdersMap.get(r[0]) == 4:
Line 721... Line 723...
721
    global ACCS_ORDER_TOTAL
723
    global ACCS_ORDER_TOTAL
722
    global ACCS_ORDER_SUCCESSFUL
724
    global ACCS_ORDER_SUCCESSFUL
723
    ACCS_ORDER_TOTAL = totalDispositions
725
    ACCS_ORDER_TOTAL = totalDispositions
724
    ACCS_ORDER_SUCCESSFUL=contactableData
726
    ACCS_ORDER_SUCCESSFUL=contactableData
725
    if totalDispositions > 0:
727
    if totalDispositions > 0:
726
        worksheet.write(15,1,round((contactableData/float(totalDispositions))*100,2),center_alignment)
728
        worksheet.write(16,1,round((contactableData/float(totalDispositions))*100,2),center_alignment)
727
        worksheet.write(16,1,round((nonContactableData/float(totalDispositions))*100,2),center_alignment)
729
        worksheet.write(17,1,round((nonContactableData/float(totalDispositions))*100,2),center_alignment)
728
    
730
    
729
    conn.close()
731
    conn.close()
730
    
732
    
731
    datesql=ACCS_ORDER_AGENTS_CALLED_COUNT 
733
    datesql=ACCS_ORDER_AGENTS_CALLED_COUNT 
732
    conn = getDbConnection()
734
    conn = getDbConnection()
Line 749... Line 751...
749
        for r in result:
751
        for r in result:
750
            loginTime+=r[1].seconds
752
            loginTime+=r[1].seconds
751
        averageLoginTime=loginTime/len(list(set(agentLoginList)))
753
        averageLoginTime=loginTime/len(list(set(agentLoginList)))
752
        hours=averageLoginTime/3600
754
        hours=averageLoginTime/3600
753
        minutesLeft=(averageLoginTime%3600)/60
755
        minutesLeft=(averageLoginTime%3600)/60
754
        worksheet.write(17,1,len(list(set(agentLoginList))),center_alignment)
756
        worksheet.write(18,1,len(list(set(agentLoginList))),center_alignment)
755
        worksheet.write(18,1,str(hours) + ':'+ str(minutesLeft),center_alignment)   
757
        worksheet.write(19,1,str(hours) + ':'+ str(minutesLeft),center_alignment)   
756
        worksheet.write(19,1,totalDispositions,center_alignment)
758
        worksheet.write(20,1,totalDispositions,center_alignment)
757
        worksheet.write(20,1,totalDispositions/float(len(list(set(agentLoginList)))),center_alignment)
759
        worksheet.write(21,1,totalDispositions/float(len(list(set(agentLoginList)))),center_alignment)
758
        conn.close()
760
        conn.close()
759
    
761
    
760
    
762
    
761
    worksheet.write(0,5, 'User Id', style)
763
    worksheet.write(0,5, 'User Id', style)
762
    worksheet.write(0,6, 'Call Disposition', style)
764
    worksheet.write(0,6, 'Call Disposition', style)
Line 774... Line 776...
774
        for data in r:
776
        for data in r:
775
            worksheet.write(row,column,data)
777
            worksheet.write(row,column,data)
776
            column+=1
778
            column+=1
777
    conn.close()
779
    conn.close()
778
    
780
    
779
    worksheet.write(22,0, 'User Id', style)
781
    worksheet.write(23,0, 'User Id', style)
780
    worksheet.write(22,1, 'Call Disposition', style)
782
    worksheet.write(23,1, 'Call Disposition', style)
781
    worksheet.write(22,2, 'Product Inputs', style)
783
    worksheet.write(23,2, 'Product Inputs', style)
782
    worksheet.write(22,3, 'Pricing Inputs', style)    
784
    worksheet.write(23,3, 'Pricing Inputs', style)    
783
    datesql = ACCS_ORDER_PRODUCT_PRICING
785
    datesql = ACCS_ORDER_PRODUCT_PRICING
784
    conn = getDbConnection()
786
    conn = getDbConnection()
785
    cursor = conn.cursor()
787
    cursor = conn.cursor()
786
    cursor.execute(datesql)
788
    cursor.execute(datesql)
787
    result = cursor.fetchall()
789
    result = cursor.fetchall()
788
    row=20
790
    row=23
789
    for r in result:
791
    for r in result:
790
        row=row+1
792
        row=row+1
791
        column =0
793
        column =0
792
        for data in r:
794
        for data in r:
793
            worksheet.write(row,column,data)
795
            worksheet.write(row,column,data)