| Line 426... |
Line 426... |
| 426 |
affNotReconciledSheet.write(row, inc(), offer.get("saleAmount"))
|
426 |
affNotReconciledSheet.write(row, inc(), offer.get("saleAmount"))
|
| 427 |
affNotReconciledSheet.write(row, inc(), offer.get("payOut"))
|
427 |
affNotReconciledSheet.write(row, inc(), offer.get("payOut"))
|
| 428 |
affNotReconciledSheet.write(row, inc(), offer.get("conversionStatus"))
|
428 |
affNotReconciledSheet.write(row, inc(), offer.get("conversionStatus"))
|
| 429 |
affNotReconciledSheet.write(row, inc(), offer.get("ip"))
|
429 |
affNotReconciledSheet.write(row, inc(), offer.get("ip"))
|
| 430 |
|
430 |
|
| 431 |
# for offer in db.snapdealOrderAffiliateInfo1.find({}):
|
431 |
for offer in db.snapdealOrderAffiliateInfo1.find({}):
|
| 432 |
# saleTime = utils.fromTimeStamp(offer.get('saleDate')).strftime("%Y-%m-%d")
|
432 |
saleTime = utils.fromTimeStamp(offer.get('saleDate')).strftime("%Y-%m-%d")
|
| 433 |
# obj = datemap.get(saleTime)
|
433 |
obj = datemap.get(saleTime)
|
| 434 |
# if offer.get("payOut"):
|
434 |
if offer.get("payOut"):
|
| 435 |
# obj['approvedAmount'] += order["approvedAmount"]
|
435 |
obj['approvedAmount'] += order["approvedAmount"]
|
| 436 |
# else:
|
436 |
else:
|
| 437 |
# obj['rejectedAmount'] += order["rejectedAmount"]
|
437 |
obj['rejectedAmount'] += order["rejectedAmount"]
|
| 438 |
|
438 |
|
| - |
|
439 |
message=""
|
| - |
|
440 |
for key,valmap in datemap.iteritems():
|
| - |
|
441 |
valmap['_id'] = key
|
| - |
|
442 |
db.flSaleSnapshot.save(valmap)
|
| - |
|
443 |
|
| - |
|
444 |
mailBodyTemplate="""
|
| - |
|
445 |
<html>
|
| - |
|
446 |
<body>
|
| - |
|
447 |
<table cellspacing="0" border="1" style="text-align:right">
|
| - |
|
448 |
<thead>
|
| - |
|
449 |
<tr>
|
| - |
|
450 |
<th style="text-align:center">Date</th>
|
| - |
|
451 |
<th style="text-align:center">Sale</th>
|
| - |
|
452 |
<th style="text-align:center">Approved</th>
|
| - |
|
453 |
<th style="text-align:center">Rejected</th>
|
| - |
|
454 |
</tr>
|
| - |
|
455 |
</thead>
|
| - |
|
456 |
<tbody>
|
| - |
|
457 |
{10}
|
| - |
|
458 |
</tbody>
|
| - |
|
459 |
</table>
|
| - |
|
460 |
</body>
|
| - |
|
461 |
</html>
|
| 439 |
|
462 |
"""
|
| - |
|
463 |
tbody=[]
|
| - |
|
464 |
rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>"
|
| - |
|
465 |
for offer in db.flSaleSnapshot.find({}):
|
| - |
|
466 |
tbody.append(rowtemplate.format(offer.get("_id"), offer.get("paidAmount"), offer.get("saleAmount"), offer.get("rejectedAmount")))
|
| - |
|
467 |
message = mailBodyTemplate.format("".join(tbody))
|
| 440 |
workbook.save(XLS_FILENAME)
|
468 |
workbook.save(XLS_FILENAME)
|
| 441 |
|
469 |
|
| - |
|
470 |
return message
|
| - |
|
471 |
|
| 442 |
def generateShopcluesReco():
|
472 |
def generateShopcluesReco():
|
| 443 |
global i
|
473 |
global i
|
| 444 |
curs = getOrdersAfterDate(datetime.now() - timedelta(days=30), 5)
|
474 |
curs = getOrdersAfterDate(datetime.now() - timedelta(days=30), 5)
|
| 445 |
db = client.Dtr
|
475 |
db = client.Dtr
|
| 446 |
notReconciled = {}
|
476 |
notReconciled = {}
|
| Line 1018... |
Line 1048... |
| 1018 |
global i
|
1048 |
global i
|
| 1019 |
i = 0
|
1049 |
i = 0
|
| 1020 |
sheet.write(0, inc(), )
|
1050 |
sheet.write(0, inc(), )
|
| 1021 |
def main():
|
1051 |
def main():
|
| 1022 |
|
1052 |
|
| 1023 |
generateSnapDealReco()
|
1053 |
message = generateSnapDealReco()
|
| 1024 |
generateFlipkartReco()
|
1054 |
generateFlipkartReco()
|
| 1025 |
generateShopcluesReco()
|
1055 |
generateShopcluesReco()
|
| 1026 |
generateAmazonReco(XLS_A_FILENAME)
|
1056 |
generateAmazonReco(XLS_A_FILENAME)
|
| 1027 |
getUserOrders()
|
1057 |
getUserOrders()
|
| 1028 |
sendmail(["amit.gupta@shop2020.in","rajneesh.arora@saholic.com","manish.sharma@shop2020.in"], "", "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME, XLS_SC_FILENAME)
|
1058 |
sendmail(["amit.gupta@shop2020.in","rajneesh.arora@saholic.com","manish.sharma@shop2020.in"], message, "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME, XLS_SC_FILENAME)
|
| 1029 |
#sendmail(["amit.gupta@shop2020.in"], "", "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME)
|
1059 |
#sendmail(["amit.gupta@shop2020.in"], "", "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME)
|
| 1030 |
sendmail(["amit.gupta@shop2020.in", "rajneesh.arora@saholic.com", "chaitnaya.vats@saholic.com", "manoj.kumar@saholic.com", "manish.sharma@shop2020.in"], "", "All DTR Orders", XLS_O_FILENAME)
|
1060 |
sendmail(["amit.gupta@shop2020.in", "rajneesh.arora@saholic.com", "chaitnaya.vats@saholic.com", "manoj.kumar@saholic.com", "manish.sharma@shop2020.in"], "", "All DTR Orders", XLS_O_FILENAME)
|
| 1031 |
|
1061 |
|
| 1032 |
if __name__ == '__main__':
|
1062 |
if __name__ == '__main__':
|
| 1033 |
#info = client.Dtr.flipkartOrderAffiliateInfo.find()
|
1063 |
#info = client.Dtr.flipkartOrderAffiliateInfo.find()
|