| Line 249... |
Line 249... |
| 249 |
order = db.merchantOrder.find_one({"orderId":orderId})
|
249 |
order = db.merchantOrder.find_one({"orderId":orderId})
|
| 250 |
if order is None:
|
250 |
if order is None:
|
| 251 |
continue
|
251 |
continue
|
| 252 |
#saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
252 |
#saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
| 253 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
253 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
| - |
|
254 |
if len(aff) > 1:
|
| - |
|
255 |
aff = [f for f in aff if f.get("payOut")>0]
|
| 254 |
anotherrow += 1
|
256 |
anotherrow += 1
|
| 255 |
try:
|
257 |
try:
|
| 256 |
formattedTimestamp = order['placedOn']
|
258 |
formattedTimestamp = order['placedOn']
|
| 257 |
timestamp1 = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
259 |
timestamp1 = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
| 258 |
except:
|
260 |
except:
|
| 259 |
timestamp1 = int(time.mktime(row1[-4].timetuple()))
|
261 |
timestamp1 = int(time.mktime(row1[-4].timetuple()))
|
| 260 |
formattedTimestamp = datetime.strftime(fromTimeStamp(timestamp1), "%b %d, %Y, %I:%M %p")
|
262 |
formattedTimestamp = datetime.strftime(fromTimeStamp(timestamp1), "%b %d, %Y, %I:%M %p")
|
| 261 |
if len(aff) > 0 and order["subTagId"] not in matchedList and int(order["paidAmount"])==int(aff[0]["saleAmount"]):
|
263 |
if len(aff) > 0 and order["subTagId"] not in matchedList and int(order["paidAmount"])==int(aff[0]["saleAmount"]):
|
| - |
|
264 |
|
| 262 |
matchedList.append(order["subTagId"])
|
265 |
matchedList.append(order["subTagId"])
|
| 263 |
db.snapdealOrderAffiliateInfo.update({"adId":aff[0].get("adId")}, {"$set":{"reconciled":True, "orderId":orderId}}, multi=True)
|
266 |
db.snapdealOrderAffiliateInfo.update({"adId":aff[0].get("adId")}, {"$set":{"reconciled":True, "orderId":orderId}}, multi=True)
|
| 264 |
order['reconciled'] = True
|
267 |
order['reconciled'] = True
|
| 265 |
order['adId'] = aff[0].get("adId")
|
268 |
order['adId'] = aff[0].get("adId")
|
| 266 |
db.merchantOrder.save(order)
|
269 |
db.merchantOrder.save(order)
|
| Line 292... |
Line 295... |
| 292 |
worksheet1.write(anotherrow, i, aff[0]['saleAmount'])
|
295 |
worksheet1.write(anotherrow, i, aff[0]['saleAmount'])
|
| 293 |
worksheet.write(row, inc(), aff[0]['payOut'])
|
296 |
worksheet.write(row, inc(), aff[0]['payOut'])
|
| 294 |
worksheet1.write(anotherrow, i, aff[0]['payOut'])
|
297 |
worksheet1.write(anotherrow, i, aff[0]['payOut'])
|
| 295 |
worksheet.write(row, inc(), aff[0]['ip'])
|
298 |
worksheet.write(row, inc(), aff[0]['ip'])
|
| 296 |
worksheet1.write(anotherrow, i, aff[0]['ip'])
|
299 |
worksheet1.write(anotherrow, i, aff[0]['ip'])
|
| - |
|
300 |
worksheet.write(row, inc(), aff[0]['conversionStatus'])
|
| - |
|
301 |
worksheet1.write(anotherrow, i, aff[0]['conversionStatus'])
|
| 297 |
k = i
|
302 |
k = i
|
| 298 |
row -= 1
|
303 |
row -= 1
|
| 299 |
anotherrow -= 1
|
304 |
anotherrow -= 1
|
| 300 |
for subOrder in order['subOrders']:
|
305 |
for subOrder in order['subOrders']:
|
| 301 |
i = k
|
306 |
i = k
|
| Line 330... |
Line 335... |
| 330 |
notReconciled[orderId] = (anotherrow, i, int(order['paidAmount']), timestamp1, order["subTagId"])
|
335 |
notReconciled[orderId] = (anotherrow, i, int(order['paidAmount']), timestamp1, order["subTagId"])
|
| 331 |
inc()
|
336 |
inc()
|
| 332 |
inc()
|
337 |
inc()
|
| 333 |
inc()
|
338 |
inc()
|
| 334 |
inc()
|
339 |
inc()
|
| - |
|
340 |
inc()
|
| 335 |
k = i
|
341 |
k = i
|
| 336 |
anotherrow -= 1
|
342 |
anotherrow -= 1
|
| 337 |
for subOrder in order['subOrders']:
|
343 |
for subOrder in order['subOrders']:
|
| 338 |
anotherrow += 1
|
344 |
anotherrow += 1
|
| 339 |
i = k
|
345 |
i = k
|
| Line 640... |
Line 646... |
| 640 |
worksheet.write(row, inc(), 'Sale Amount', boldStyle)
|
646 |
worksheet.write(row, inc(), 'Sale Amount', boldStyle)
|
| 641 |
worksheet.write(row, inc(), 'Aff Sale Date', boldStyle)
|
647 |
worksheet.write(row, inc(), 'Aff Sale Date', boldStyle)
|
| 642 |
worksheet.write(row, inc(), 'Aff Sale Amt', boldStyle)
|
648 |
worksheet.write(row, inc(), 'Aff Sale Amt', boldStyle)
|
| 643 |
worksheet.write(row, inc(), 'Aff PayOut', boldStyle)
|
649 |
worksheet.write(row, inc(), 'Aff PayOut', boldStyle)
|
| 644 |
worksheet.write(row, inc(), 'IP', boldStyle)
|
650 |
worksheet.write(row, inc(), 'IP', boldStyle)
|
| - |
|
651 |
worksheet.write(row, inc(), 'Aff Status', boldStyle)
|
| 645 |
worksheet.write(row, inc(), 'Product Title', boldStyle)
|
652 |
worksheet.write(row, inc(), 'Product Title', boldStyle)
|
| 646 |
worksheet.write(row, inc(), 'Price', boldStyle)
|
653 |
worksheet.write(row, inc(), 'Price', boldStyle)
|
| 647 |
worksheet.write(row, inc(), 'Quantity', boldStyle)
|
654 |
worksheet.write(row, inc(), 'Quantity', boldStyle)
|
| 648 |
worksheet.write(row, inc(), 'Status', boldStyle)
|
655 |
worksheet.write(row, inc(), 'Status', boldStyle)
|
| 649 |
worksheet.write(row, inc(), 'Cashback Status', boldStyle)
|
656 |
worksheet.write(row, inc(), 'Cashback Status', boldStyle)
|
| Line 662... |
Line 669... |
| 662 |
worksheet1.write(row, inc(), 'Sale Amount', boldStyle)
|
669 |
worksheet1.write(row, inc(), 'Sale Amount', boldStyle)
|
| 663 |
worksheet1.write(row, inc(), 'Aff Sale Date', boldStyle)
|
670 |
worksheet1.write(row, inc(), 'Aff Sale Date', boldStyle)
|
| 664 |
worksheet1.write(row, inc(), 'Aff Sale Amt', boldStyle)
|
671 |
worksheet1.write(row, inc(), 'Aff Sale Amt', boldStyle)
|
| 665 |
worksheet1.write(row, inc(), 'Aff PayOut', boldStyle)
|
672 |
worksheet1.write(row, inc(), 'Aff PayOut', boldStyle)
|
| 666 |
worksheet1.write(row, inc(), 'IP', boldStyle)
|
673 |
worksheet1.write(row, inc(), 'IP', boldStyle)
|
| - |
|
674 |
worksheet1.write(row, inc(), 'Aff Status', boldStyle)
|
| 667 |
worksheet1.write(row, inc(), 'Product Title', boldStyle)
|
675 |
worksheet1.write(row, inc(), 'Product Title', boldStyle)
|
| 668 |
worksheet1.write(row, inc(), 'Price', boldStyle)
|
676 |
worksheet1.write(row, inc(), 'Price', boldStyle)
|
| 669 |
worksheet1.write(row, inc(), 'Quantity', boldStyle)
|
677 |
worksheet1.write(row, inc(), 'Quantity', boldStyle)
|
| 670 |
worksheet1.write(row, inc(), 'Status', boldStyle)
|
678 |
worksheet1.write(row, inc(), 'Status', boldStyle)
|
| 671 |
worksheet1.write(row, inc(), 'Cashback Status', boldStyle)
|
679 |
worksheet1.write(row, inc(), 'Cashback Status', boldStyle)
|
| Line 747... |
Line 755... |
| 747 |
worksheet1.write(row, i, 'Cashback Status', boldStyle)
|
755 |
worksheet1.write(row, i, 'Cashback Status', boldStyle)
|
| 748 |
worksheet.write(row, inc(), 'Reconciled', boldStyle)
|
756 |
worksheet.write(row, inc(), 'Reconciled', boldStyle)
|
| 749 |
worksheet1.write(row, i, 'Reconciled', boldStyle)
|
757 |
worksheet1.write(row, i, 'Reconciled', boldStyle)
|
| 750 |
worksheet.write(row, inc(), 'IP', boldStyle)
|
758 |
worksheet.write(row, inc(), 'IP', boldStyle)
|
| 751 |
worksheet1.write(row, i, 'IP', boldStyle)
|
759 |
worksheet1.write(row, i, 'IP', boldStyle)
|
| - |
|
760 |
worksheet.write(row, inc(), 'Aff Status', boldStyle)
|
| - |
|
761 |
worksheet1.write(row, i, 'Aff Status', boldStyle)
|
| 752 |
i=-1
|
762 |
i=-1
|
| 753 |
sh1.write(row, inc(), 'User Id', boldStyle)
|
763 |
sh1.write(row, inc(), 'User Id', boldStyle)
|
| 754 |
sh1.write(row, inc(), 'User name', boldStyle)
|
764 |
sh1.write(row, inc(), 'User name', boldStyle)
|
| 755 |
sh1.write(row, inc(), 'Order Id', boldStyle)
|
765 |
sh1.write(row, inc(), 'Order Id', boldStyle)
|
| 756 |
sh1.write(row, inc(), 'Created On', boldStyle)
|
766 |
sh1.write(row, inc(), 'Created On', boldStyle)
|
| Line 859... |
Line 869... |
| 859 |
worksheet.write(row, inc(), subOrder.get("detailedStatus"))
|
869 |
worksheet.write(row, inc(), subOrder.get("detailedStatus"))
|
| 860 |
worksheet.write(row, inc(), subOrder.get("cashBackStatus"))
|
870 |
worksheet.write(row, inc(), subOrder.get("cashBackStatus"))
|
| 861 |
worksheet.write(row, inc(), False if morder.get("reconciled") is None else True)
|
871 |
worksheet.write(row, inc(), False if morder.get("reconciled") is None else True)
|
| 862 |
if morder.get("reconciled") and morder.get("storeId")==3:
|
872 |
if morder.get("reconciled") and morder.get("storeId")==3:
|
| 863 |
try:
|
873 |
try:
|
| 864 |
worksheet.write(row, inc(), db.snapdealOrderAffiliateInfo.find_one({"adId":morder.get("adId"), "reconciled":True}).get("ip"))
|
874 |
snapdealafinfo = db.snapdealOrderAffiliateInfo.find_one({"adId":morder.get("adId"), "reconciled":True})
|
| - |
|
875 |
worksheet.write(row, inc(), snapdealafinfo.get("ip"))
|
| - |
|
876 |
worksheet.write(row, inc(), snapdealafinfo.get("conversionStatus"))
|
| 865 |
except:
|
877 |
except:
|
| 866 |
print "Could not find", morder.get("adId"), "that is reconcired for order", morder.get("orderId")
|
878 |
print "Could not find", morder.get("adId"), "that is reconciled for order", morder.get("orderId")
|
| 867 |
if result[8] >= 10:
|
879 |
if result[8] >= 10:
|
| 868 |
row2 +=1
|
880 |
row2 +=1
|
| 869 |
i=-1
|
881 |
i=-1
|
| 870 |
worksheet1.write(row2, inc(), result[0])
|
882 |
worksheet1.write(row2, inc(), result[0])
|
| 871 |
worksheet1.write(row2, inc(), result[7])
|
883 |
worksheet1.write(row2, inc(), result[7])
|
| Line 878... |
Line 890... |
| 878 |
worksheet1.write(row2, inc(), subOrder.get("cashBackAmount"))
|
890 |
worksheet1.write(row2, inc(), subOrder.get("cashBackAmount"))
|
| 879 |
worksheet1.write(row2, inc(), subOrder.get("status"))
|
891 |
worksheet1.write(row2, inc(), subOrder.get("status"))
|
| 880 |
worksheet1.write(row2, inc(), subOrder.get("detailedStatus"))
|
892 |
worksheet1.write(row2, inc(), subOrder.get("detailedStatus"))
|
| 881 |
worksheet1.write(row2, inc(), subOrder.get("cashBackStatus"))
|
893 |
worksheet1.write(row2, inc(), subOrder.get("cashBackStatus"))
|
| 882 |
worksheet1.write(row2, inc(), False if morder.get("reconciled") is None else True)
|
894 |
worksheet1.write(row2, inc(), False if morder.get("reconciled") is None else True)
|
| - |
|
895 |
worksheet1.write(row2, inc(), )
|
| 883 |
if morder.get("reconciled") and morder.get("storeId")==3:
|
896 |
if morder.get("reconciled") and morder.get("storeId")==3:
|
| 884 |
try:
|
897 |
try:
|
| 885 |
worksheet1.write(row2, inc(), db.snapdealOrderAffiliateInfo.find_one({"adId":morder.get("adId"), "reconciled":True}).get("ip"))
|
898 |
snapdealafinfo = db.snapdealOrderAffiliateInfo.find_one({"adId":morder.get("adId"), "reconciled":True})
|
| - |
|
899 |
worksheet.write(row2, inc(), snapdealafinfo.get("ip"))
|
| - |
|
900 |
worksheet.write(row2, inc(), snapdealafinfo.get("conversionStatus"))
|
| 886 |
except:
|
901 |
except:
|
| 887 |
print "Could not find", morder.get("adId"), "that is reconcired for order", morder.get("orderId")
|
902 |
print "Could not find", morder.get("adId"), "that is reconcired for order", morder.get("orderId")
|
| 888 |
|
903 |
|
| 889 |
flipkartOrders = session.query(FlipkartOrders).order_by(FlipkartOrders.created.desc()).all()
|
904 |
flipkartOrders = session.query(FlipkartOrders).order_by(FlipkartOrders.created.desc()).all()
|
| 890 |
flipkartOrders.reverse()
|
905 |
flipkartOrders.reverse()
|