| Line 119... |
Line 119... |
| 119 |
#saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
119 |
#saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
| 120 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
120 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
| 121 |
anotherrow += 1
|
121 |
anotherrow += 1
|
| 122 |
if len(aff) > 0 and order["subTagId"] not in matchedList and int(order["paidAmount"])==int(aff[0]["saleAmount"]):
|
122 |
if len(aff) > 0 and order["subTagId"] not in matchedList and int(order["paidAmount"])==int(aff[0]["saleAmount"]):
|
| 123 |
matchedList.append(order["subTagId"])
|
123 |
matchedList.append(order["subTagId"])
|
| 124 |
db.snapdealOrderAffiliateInfo.update({"adId":aff[0].get("adId")}, {"$set":{"reconciled":True}}, multi=True)
|
124 |
db.snapdealOrderAffiliateInfo.update({"adId":aff[0].get("adId")}, {"$set":{"reconciled":True, "orderId":orderId}}, multi=True)
|
| 125 |
order['reconciled'] = True
|
125 |
order['reconciled'] = True
|
| - |
|
126 |
order['adId'] = aff[0].get("adId")
|
| 126 |
db.merchantOrder.save(order)
|
127 |
db.merchantOrder.save(order)
|
| 127 |
row += 1
|
128 |
row += 1
|
| 128 |
i=-1
|
129 |
i=-1
|
| 129 |
worksheet.write(row, inc(), orderId)
|
130 |
worksheet.write(row, inc(), orderId)
|
| 130 |
worksheet1.write(anotherrow, i, orderId)
|
131 |
worksheet1.write(anotherrow, i, orderId)
|
| Line 215... |
Line 216... |
| 215 |
worksheet1.write(roww, inc(), offer.get("saleDate"))
|
216 |
worksheet1.write(roww, inc(), offer.get("saleDate"))
|
| 216 |
worksheet1.write(roww, inc(), offer.get("saleAmount"))
|
217 |
worksheet1.write(roww, inc(), offer.get("saleAmount"))
|
| 217 |
worksheet1.write(roww, inc(), offer.get("payOut"))
|
218 |
worksheet1.write(roww, inc(), offer.get("payOut"))
|
| 218 |
del notReconciled[order[0]]
|
219 |
del notReconciled[order[0]]
|
| 219 |
print "found match for user", order[1]
|
220 |
print "found match for user", order[1]
|
| 220 |
db.snapdealOrderAffiliateInfo.update({"adId":offer.get("adId")}, {"$set":{"reconciled":True}}, multi=True)
|
221 |
db.snapdealOrderAffiliateInfo.update({"adId":offer.get("adId")}, {"$set":{"reconciled":True, "orderId":order[0]}}, multi=True)
|
| 221 |
db.merchantOrder.update({"orderId":order[0]}, {"$set":{"reconciled":True}}, multi=True)
|
222 |
db.merchantOrder.update({"orderId":order[0]}, {"$set":{"reconciled":True, "adId":offer.get("adId")}}, multi=True)
|
| 222 |
break
|
223 |
break
|
| 223 |
|
224 |
|
| 224 |
unreconciledOrders = notReconciled.keys()
|
225 |
unreconciledOrders = notReconciled.keys()
|
| 225 |
row2=0
|
226 |
row2=0
|
| 226 |
for row1 in curs:
|
227 |
for row1 in curs:
|