Subversion Repositories SmartDukaan

Rev

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

Rev 14494 Rev 14496
Line 61... Line 61...
61
    for row1 in curs:
61
    for row1 in curs:
62
        orderId = row1[0]
62
        orderId = row1[0]
63
        order = db.merchantOrder.find_one({"orderId":orderId})
63
        order = db.merchantOrder.find_one({"orderId":orderId})
64
        if order is None:
64
        if order is None:
65
            continue
65
            continue
66
        print order["subTagId"]
-
 
67
        print order
-
 
68
        saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%d %B, %Y %I:%M %p").replace(hour=0, minute=0, second=0, microsecond=0).timetuple()))
66
        saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%d %B, %Y %I:%M %p").replace(hour=0, minute=0, second=0, microsecond=0).timetuple()))
69
        #saleTime1 = int(time.mktime((datetime.strptime(order['placedOn'], "%b %d, %Y %I:%M %p") + timedelta(seconds=-60)).timetuple()))
67
        #saleTime1 = int(time.mktime((datetime.strptime(order['placedOn'], "%b %d, %Y %I:%M %p") + timedelta(seconds=-60)).timetuple()))
70
        
68
        
71
        for subOrder in order['subOrders']: 
69
        for subOrder in order['subOrders']: 
72
            affs = list(db.flipkartOrderAffiliateInfo.find({"subOrders.productCode":subOrder.get("productCode"), "saleDateInt":saleTime}))
70
            affs = list(db.flipkartOrderAffiliateInfo.find({"subOrders.productCode":subOrder.get("productCode"), "saleDateInt":saleTime}))
Line 128... Line 126...
128
    for row1 in curs:
126
    for row1 in curs:
129
        orderId = row1[0]
127
        orderId = row1[0]
130
        order = db.merchantOrder.find_one({"orderId":orderId})
128
        order = db.merchantOrder.find_one({"orderId":orderId})
131
        if order is None:
129
        if order is None:
132
            continue
130
            continue
133
        print order["subTagId"]
-
 
134
        saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
131
        #saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
135
        aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
132
        aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
136
        gotCashBack = False
133
        matchedSubTag = False
137
        if len(aff) > 0 and order["subTagId"] not in matchedList: 
134
        if len(aff) > 0 and order["subTagId"] not in matchedList: 
138
            gotCashBack = True
135
            matchedSubTag = True
139
        once = True        
136
        once = True        
140
        for subOrder in order['subOrders']:
137
        for subOrder in order['subOrders']:
141
            i=-1 
138
            i=-1 
142
            row += 1
139
            row += 1
143
            worksheet.write(row, inc(), orderId)
140
            worksheet.write(row, inc(), orderId)
Line 151... Line 148...
151
            worksheet.write(row, inc(), subOrder['detailedStatus'])
148
            worksheet.write(row, inc(), subOrder['detailedStatus'])
152
            worksheet.write(row, inc(), subOrder['cashBackStatus'])
149
            worksheet.write(row, inc(), subOrder['cashBackStatus'])
153
            worksheet.write(row, inc(), subOrder['cashBackAmount'])
150
            worksheet.write(row, inc(), subOrder['cashBackAmount'])
154
            worksheet.write(row, inc(), subOrder['placedOn'])
151
            worksheet.write(row, inc(), subOrder['placedOn'])
155
            worksheet.write(row, inc(), order['subTagId'])
152
            worksheet.write(row, inc(), order['subTagId'])
156
            if gotCashBack:
153
            if matchedSubTag:
157
                worksheet.write(row, inc(), aff[0]['adId'])
154
                worksheet.write(row, inc(), aff[0]['adId'])
158
                worksheet.write(row, inc(), aff[0]['saleDate'])
155
                worksheet.write(row, inc(), aff[0]['saleDate'])
159
                if once:
156
                if once:
160
                    worksheet.write(row, inc(), aff[0]['payOut'])
157
                    worksheet.write(row, inc(), aff[0]['payOut'])
161
                    worksheet.write(row, inc(), aff[0]['saleAmount'])
158
                    worksheet.write(row, inc(), aff[0]['saleAmount'])