Subversion Repositories SmartDukaan

Rev

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

Rev 18162 Rev 18201
Line 501... Line 501...
501
    worksheet.write(row, 7, 'DTV', boldStyle)
501
    worksheet.write(row, 7, 'DTV', boldStyle)
502
    worksheet.write(row, 8, 'DOWNORD', boldStyle)
502
    worksheet.write(row, 8, 'DOWNORD', boldStyle)
503
    worksheet.write(row, 9, 'DOWNVOL', boldStyle)
503
    worksheet.write(row, 9, 'DOWNVOL', boldStyle)
504
    worksheet.write(row, 10, 'DOWNVAL', boldStyle)
504
    worksheet.write(row, 10, 'DOWNVAL', boldStyle)
505
    worksheet.write(row, 11, 'DACCSU', boldStyle)
505
    worksheet.write(row, 11, 'DACCSU', boldStyle)
-
 
506
    worksheet.write(row, 12, 'DACCSCART', boldStyle)
506
    worksheet.write(row, 12, 'DACCSB', boldStyle)
507
    worksheet.write(row, 13, 'DACCSB', boldStyle)
507
    worksheet.write(row, 13, 'DACCSORD', boldStyle)
508
    worksheet.write(row, 14, 'DACCSORD', boldStyle)
508
    worksheet.write(row, 14, 'DACCSOVOL', boldStyle)
509
    worksheet.write(row, 15, 'DACCSOVOL', boldStyle)
509
    worksheet.write(row, 15, 'DACCSOVAL', boldStyle)
510
    worksheet.write(row, 16, 'DACCSOVAL', boldStyle)
510
    dateMap={}
511
    dateMap={}
511
    for r in result:
512
    for r in result:
512
        row += 1
513
        row += 1
513
        column = 0
514
        column = 0
514
        for data in r :
515
        for data in r :
Line 617... Line 618...
617
        worksheet.write(row, column, len(result))
618
        worksheet.write(row, column, len(result))
618
        row=row+1
619
        row=row+1
619
        if currentDay>breakDate:
620
        if currentDay>breakDate:
620
            break
621
            break
621
        
622
        
-
 
623
    row = 1
-
 
624
    column=12
-
 
625
    breakDate = to_java_date(datetime.now())
-
 
626
    currentDay = cutOff*1000
-
 
627
    while True:
-
 
628
        currentDay = currentDay + 86400000
-
 
629
        result = get_mongo_connection_new().User.browsinghistories.find({"$and":[{'created':{"$gte":currentDay-86400000}},{'created':{"$lte":currentDay}},{"url":{"$regex" : "http://api.profittill.com/cartdetails"}}]}).distinct('user_id')
-
 
630
        worksheet.write(row, column, len(result))
-
 
631
        row=row+1
-
 
632
        if currentDay>breakDate:
-
 
633
            break    
-
 
634
        
622
    row = 0            
635
    row = 0            
623
    cursor.execute(daccsbSql,(cutOffDate))
636
    cursor.execute(daccsbSql,(cutOffDate))
624
    result = cursor.fetchall()
637
    result = cursor.fetchall()
625
    for r in result:
638
    for r in result:
626
        column = 12
639
        column = 13
627
        row=dateMap.get(str(r[0]))
640
        row=dateMap.get(str(r[0]))
628
        if row:
641
        if row:
629
            worksheet.write(row, column, r[1])
642
            worksheet.write(row, column, r[1])
630
    
643
    
631
    row = 0            
644
    row = 0            
632
    cursor.execute(daccstoSql,(cutOffDate))
645
    cursor.execute(daccstoSql,(cutOffDate))
633
    result = cursor.fetchall()
646
    result = cursor.fetchall()
634
 
647
 
635
    for r in result:
648
    for r in result:
636
        column = 13
649
        column = 14
637
        row=dateMap.get(str(r[0]))
650
        row=dateMap.get(str(r[0]))
638
        if row:
651
        if row:
639
            worksheet.write(row, column, r[1])
652
            worksheet.write(row, column, r[1])
640
            
653
            
641
    row = 0            
654
    row = 0            
642
    cursor.execute(daccsoSql,(cutOffDate))
655
    cursor.execute(daccsoSql,(cutOffDate))
643
    result = cursor.fetchall()
656
    result = cursor.fetchall()
644
 
657
 
645
    for r in result:
658
    for r in result:
646
        column = 14
659
        column = 15
647
        row=dateMap.get(str(r[0]))
660
        row=dateMap.get(str(r[0]))
648
        if row:
661
        if row:
649
            worksheet.write(row, column, r[1])
662
            worksheet.write(row, column, r[1])
650
            column += 1
663
            column += 1
651
            worksheet.write(row, column, r[2])                                    
664
            worksheet.write(row, column, r[2])                                    
Line 688... Line 701...
688
    worksheet.write(row, 7, 'MTV', boldStyle)
701
    worksheet.write(row, 7, 'MTV', boldStyle)
689
    worksheet.write(row, 8, 'MOWNORD', boldStyle)
702
    worksheet.write(row, 8, 'MOWNORD', boldStyle)
690
    worksheet.write(row, 9, 'MOWNVOL', boldStyle)
703
    worksheet.write(row, 9, 'MOWNVOL', boldStyle)
691
    worksheet.write(row, 10, 'MOWNVAL', boldStyle)
704
    worksheet.write(row, 10, 'MOWNVAL', boldStyle)
692
    worksheet.write(row, 11, 'MACCSU', boldStyle)
705
    worksheet.write(row, 11, 'MACCSU', boldStyle)
-
 
706
    worksheet.write(row, 12, 'MACCSCART', boldStyle)
693
    worksheet.write(row, 12, 'MACCSB', boldStyle)
707
    worksheet.write(row, 13, 'MACCSB', boldStyle)
694
    worksheet.write(row, 13, 'MACCSORD', boldStyle)
708
    worksheet.write(row, 14, 'MACCSORD', boldStyle)
695
    worksheet.write(row, 14, 'MACCSOVOL', boldStyle)
709
    worksheet.write(row, 15, 'MACCSOVOL', boldStyle)
696
    worksheet.write(row, 15, 'MACCSOVAL', boldStyle)
710
    worksheet.write(row, 16, 'MACCSOVAL', boldStyle)
697
 
711
 
698
    monthMapDb = {}
712
    monthMapDb = {}
699
    for r in result:
713
    for r in result:
700
        row += 1
714
        row += 1
701
        column = 0
715
        column = 0
Line 805... Line 819...
805
        worksheet.write(row,column,len(result))
819
        worksheet.write(row,column,len(result))
806
        row=row+1
820
        row=row+1
807
        if currentDay>breakDate:
821
        if currentDay>breakDate:
808
            break
822
            break
809
    
823
    
-
 
824
    row=1
-
 
825
    column=12
-
 
826
    breakDate = to_java_date(datetime.now())
-
 
827
    currentDay = cutOff*1000
-
 
828
    while True:
-
 
829
        currentDay = currentDay + (monthMap.get(month_get(currentDay))*86400000)
-
 
830
        result = get_mongo_connection_new().User.browsinghistories.find({"$and":[{'created':{"$gte":currentDay- (monthMap.get(month_get(currentDay))*86400000)}},{'created':{"$lte":currentDay}},{"url":{"$regex" : "http://api.profittill.com/cartdetails"}}]}).distinct('user_id')
-
 
831
        currentDay = currentDay+ 86400000
-
 
832
        worksheet.write(row,column,len(result))
-
 
833
        row=row+1
-
 
834
        if currentDay>breakDate:
-
 
835
            break
810
    
836
    
811
    row = 0            
837
    row = 0            
812
    cursor.execute(maccsbSql,(cutOffDate))
838
    cursor.execute(maccsbSql,(cutOffDate))
813
    result = cursor.fetchall()
839
    result = cursor.fetchall()
814
    for r in result:
840
    for r in result:
815
        column = 12
841
        column = 13
816
        row=monthMapDb.get(str(r[0]))
842
        row=monthMapDb.get(str(r[0]))
817
        if row:
843
        if row:
818
            worksheet.write(row, column, r[1])
844
            worksheet.write(row, column, r[1])
819
 
845
 
820
    row = 0            
846
    row = 0            
821
    cursor.execute(maccstoSql,(cutOffDate))
847
    cursor.execute(maccstoSql,(cutOffDate))
822
    result = cursor.fetchall()
848
    result = cursor.fetchall()
823
 
849
 
824
    for r in result:
850
    for r in result:
825
        column = 13
851
        column = 14
826
        row=monthMapDb.get(str(r[0]))
852
        row=monthMapDb.get(str(r[0]))
827
        if row:
853
        if row:
828
            worksheet.write(row, column, r[1])
854
            worksheet.write(row, column, r[1])
829
    
855
    
830
    row = 0            
856
    row = 0            
831
    cursor.execute(maccsoSql,(cutOffDate))
857
    cursor.execute(maccsoSql,(cutOffDate))
832
    result = cursor.fetchall()
858
    result = cursor.fetchall()
833
 
859
 
834
    for r in result:
860
    for r in result:
835
        column = 14
861
        column = 15
836
        row=monthMapDb.get(str(r[0]))
862
        row=monthMapDb.get(str(r[0]))
837
        if row:
863
        if row:
838
            worksheet.write(row, column, r[1])
864
            worksheet.write(row, column, r[1])
839
            column += 1
865
            column += 1
840
            worksheet.write(row, column, r[2])                                    
866
            worksheet.write(row, column, r[2])                                    
Line 879... Line 905...
879
    worksheet.write(row, 7, 'WTV', boldStyle)
905
    worksheet.write(row, 7, 'WTV', boldStyle)
880
    worksheet.write(row, 8, 'WOWNORD', boldStyle)
906
    worksheet.write(row, 8, 'WOWNORD', boldStyle)
881
    worksheet.write(row, 9, 'WOWNVOL', boldStyle)
907
    worksheet.write(row, 9, 'WOWNVOL', boldStyle)
882
    worksheet.write(row, 10, 'WOWNVAL', boldStyle)
908
    worksheet.write(row, 10, 'WOWNVAL', boldStyle)
883
    worksheet.write(row, 11, 'WACCSU', boldStyle)
909
    worksheet.write(row, 11, 'WACCSU', boldStyle)
-
 
910
    worksheet.write(row, 12, 'WACCSCART', boldStyle)
884
    worksheet.write(row, 12, 'WACCSB', boldStyle)
911
    worksheet.write(row, 13, 'WACCSB', boldStyle)
885
    worksheet.write(row, 13, 'WACCSORD', boldStyle)
912
    worksheet.write(row, 14, 'WACCSORD', boldStyle)
886
    worksheet.write(row, 14, 'WACCSVOL', boldStyle)
913
    worksheet.write(row, 15, 'WACCSVOL', boldStyle)
887
    worksheet.write(row, 15, 'WACCSVAL', boldStyle)
914
    worksheet.write(row, 16, 'WACCSVAL', boldStyle)
888
    
915
    
889
    weekMap={}
916
    weekMap={}
890
    
917
    
891
    for r in result:
918
    for r in result:
892
        row += 1
919
        row += 1
Line 994... Line 1021...
994
        result = get_mongo_connection_new().User.browsinghistories.find({"$and":[{'created':{"$gte":currentDay-(6*86400000)}},{'created':{"$lte":currentDay}},{"url":{"$regex" : "http://api.profittill.com/category/6"}}]}).distinct('user_id')
1021
        result = get_mongo_connection_new().User.browsinghistories.find({"$and":[{'created':{"$gte":currentDay-(6*86400000)}},{'created':{"$lte":currentDay}},{"url":{"$regex" : "http://api.profittill.com/category/6"}}]}).distinct('user_id')
995
        worksheet.write(row,column,len(result))
1022
        worksheet.write(row,column,len(result))
996
        row=row+1
1023
        row=row+1
997
        if currentDay>breakDate:
1024
        if currentDay>breakDate:
998
            break
1025
            break
-
 
1026
    
-
 
1027
    
-
 
1028
    row=1
-
 
1029
    column=12       
-
 
1030
    breakDate = to_java_date(datetime.now())
-
 
1031
    currentDay = to_java_date(last_day(cutOffDate, 'sunday'))
-
 
1032
    while True:
-
 
1033
        currentDay = currentDay + (7*86400000)
-
 
1034
        result = get_mongo_connection_new().User.browsinghistories.find({"$and":[{'created':{"$gte":currentDay-(6*86400000)}},{'created':{"$lte":currentDay}},{"url":{"$regex" : "http://api.profittill.com/cartdetails"}}]}).distinct('user_id')
-
 
1035
        worksheet.write(row,column,len(result))
-
 
1036
        row=row+1
-
 
1037
        if currentDay>breakDate:
-
 
1038
            break
999
        
1039
            
1000
    row = 0            
1040
    row = 0            
1001
    cursor.execute(waccsbSql,(cutOffDate))
1041
    cursor.execute(waccsbSql,(cutOffDate))
1002
    result = cursor.fetchall()
1042
    result = cursor.fetchall()
1003
    for r in result:
1043
    for r in result:
1004
        column = 12
1044
        column = 13
1005
        row=weekMap.get(str(r[0]))
1045
        row=weekMap.get(str(r[0]))
1006
        if row:
1046
        if row:
1007
            worksheet.write(row, column, r[1])
1047
            worksheet.write(row, column, r[1])
1008
 
1048
 
1009
    row = 0            
1049
    row = 0            
1010
    cursor.execute(waccstoSql,(cutOffDate))
1050
    cursor.execute(waccstoSql,(cutOffDate))
1011
    result = cursor.fetchall()
1051
    result = cursor.fetchall()
1012
 
1052
 
1013
    for r in result:
1053
    for r in result:
1014
        column = 13
1054
        column = 14
1015
        row=weekMap.get(str(r[0]))
1055
        row=weekMap.get(str(r[0]))
1016
        if row:
1056
        if row:
1017
            worksheet.write(row, column, r[1])
1057
            worksheet.write(row, column, r[1])
1018
            
1058
            
1019
    row = 0            
1059
    row = 0            
1020
    cursor.execute(waccsoSql,(cutOffDate))
1060
    cursor.execute(waccsoSql,(cutOffDate))
1021
    result = cursor.fetchall()
1061
    result = cursor.fetchall()
1022
 
1062
 
1023
    for r in result:
1063
    for r in result:
1024
        column = 14
1064
        column = 15
1025
        row=weekMap.get(str(r[0]))
1065
        row=weekMap.get(str(r[0]))
1026
        if row:
1066
        if row:
1027
            worksheet.write(row, column, r[1])
1067
            worksheet.write(row, column, r[1])
1028
            column += 1
1068
            column += 1
1029
            worksheet.write(row, column, r[2])
1069
            worksheet.write(row, column, r[2])