| Line 224... |
Line 224... |
| 224 |
maildata = maildata + "<br><br><b>Spice Orders</b><br><br>"
|
224 |
maildata = maildata + "<br><br><b>Spice Orders</b><br><br>"
|
| 225 |
for id in spiceOrders.keys():
|
225 |
for id in spiceOrders.keys():
|
| 226 |
maildata = maildata + str(id) + " : " + str(spiceOrders.get(id)) + "<br>"
|
226 |
maildata = maildata + str(id) + " : " + str(spiceOrders.get(id)) + "<br>"
|
| 227 |
|
227 |
|
| 228 |
maildata = maildata + "</body></html>"
|
228 |
maildata = maildata + "</body></html>"
|
| 229 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in"], "Mobisoc Recharge Reconciliation for Date:- " + startTime.strftime("%d-%m-%Y"), maildata, [])
|
229 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in"], "Mobisoc Recharge Reconciliation for Date:- " + startTime.strftime("%d-%m-%Y"), maildata, [])
|
| 230 |
|
230 |
|
| 231 |
|
231 |
|
| 232 |
def processRecon():
|
232 |
def processRecon():
|
| 233 |
cdate = datetime.datetime.now() + timedelta(days = -1)
|
233 |
cdate = datetime.datetime.now() + timedelta(days = -1)
|
| 234 |
startTime = datetime.datetime(cdate.year, cdate.month, cdate.day)
|
234 |
startTime = datetime.datetime(cdate.year, cdate.month, cdate.day)
|
| Line 340... |
Line 340... |
| 340 |
for mismatch in mismatches:
|
340 |
for mismatch in mismatches:
|
| 341 |
maildata += "<tr><td>" + str(mismatch.id) + "</td><td>" + str(mismatch.totalAmount) + "</td><td>" + str(mismatch.walletAmount) + "</td><td>" + str(mismatch.couponAmount) + "</td><td>" + str(mismatch.creationTimestamp) + "</td><td>" + str(mismatch.responseTimestamp) + "</td></tr>"
|
341 |
maildata += "<tr><td>" + str(mismatch.id) + "</td><td>" + str(mismatch.totalAmount) + "</td><td>" + str(mismatch.walletAmount) + "</td><td>" + str(mismatch.couponAmount) + "</td><td>" + str(mismatch.creationTimestamp) + "</td><td>" + str(mismatch.responseTimestamp) + "</td></tr>"
|
| 342 |
maildata += "</tbody></table>"
|
342 |
maildata += "</tbody></table>"
|
| 343 |
|
343 |
|
| 344 |
maildata += "</body></html>"
|
344 |
maildata += "</body></html>"
|
| 345 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Customer Recharge Reconciliation for Date:- " + startTime.strftime("%d-%m-%Y"), maildata, [])
|
345 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "rajneesh.arora@shop2020.in"], "Customer Recharge Reconciliation for Date:- " + startTime.strftime("%d-%m-%Y"), maildata, [])
|
| 346 |
|
346 |
|
| 347 |
|
347 |
|
| 348 |
def processRefunds():
|
348 |
def processRefunds():
|
| 349 |
todate = datetime.datetime.now()
|
349 |
todate = datetime.datetime.now()
|
| 350 |
for i in range(10):
|
350 |
for i in range(10):
|
| Line 457... |
Line 457... |
| 457 |
wallet = WalletForCompany.query.filter(WalletForCompany.id == 1).one()
|
457 |
wallet = WalletForCompany.query.filter(WalletForCompany.id == 1).one()
|
| 458 |
|
458 |
|
| 459 |
dt = session.query(func.sum(RechargeTransaction.amount)).filter(RechargeTransaction.status.in_([RechargeOrderStatus.RECHARGE_SUCCESSFUL])).one()
|
459 |
dt = session.query(func.sum(RechargeTransaction.amount)).filter(RechargeTransaction.status.in_([RechargeOrderStatus.RECHARGE_SUCCESSFUL])).one()
|
| 460 |
|
460 |
|
| 461 |
# if int(dt[0]) != wallet.amount:
|
461 |
# if int(dt[0]) != wallet.amount:
|
| 462 |
# mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in"], "Wallet amount: " + str(wallet.amount) + " does not match with transaction amount: " + str(int(dt[0])) , "", [], [], [])
|
462 |
# mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in"], "Wallet amount: " + str(wallet.amount) + " does not match with transaction amount: " + str(int(dt[0])) , "", [], [], [])
|
| 463 |
|
463 |
|
| 464 |
maildata = "<html><body><table border='1'><thead><th>StoreId</th><th>Gross</th><th>Discount</th><th>Net</th></thead><tbody>"
|
464 |
maildata = "<html><body><table border='1'><thead><th>StoreId</th><th>Gross</th><th>Discount</th><th>Net</th></thead><tbody>"
|
| 465 |
trecharge = 0
|
465 |
trecharge = 0
|
| 466 |
hotspotServiceMatrices = HotspotServiceMatrix.query.all()
|
466 |
hotspotServiceMatrices = HotspotServiceMatrix.query.all()
|
| 467 |
hotspotServiceMatrixMap = {}
|
467 |
hotspotServiceMatrixMap = {}
|
| Line 498... |
Line 498... |
| 498 |
wamt = int(dit2[0])- int(dit[0])
|
498 |
wamt = int(dit2[0])- int(dit[0])
|
| 499 |
wallet.amount = wamt
|
499 |
wallet.amount = wamt
|
| 500 |
session.commit()
|
500 |
session.commit()
|
| 501 |
|
501 |
|
| 502 |
maildata += "</tbody></table></body></html>"
|
502 |
maildata += "</tbody></table></body></html>"
|
| 503 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","adarsh.verma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.tyagi@spiceretail.co.in"], "MIS :- SpiceRetail (Date - " + todate.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(trecharge) + ")", maildata, [])
|
503 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","adarsh.verma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.tyagi@spiceretail.co.in"], "MIS :- SpiceRetail (Date - " + todate.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(trecharge) + ")", maildata, [])
|
| 504 |
try:
|
504 |
try:
|
| 505 |
push_recharge_collection_to_ocr()
|
505 |
push_recharge_collection_to_ocr()
|
| 506 |
except:
|
506 |
except:
|
| 507 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", "", [])
|
507 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", "", [])
|
| 508 |
finally:
|
508 |
finally:
|
| 509 |
msg = "<html><body>"
|
509 |
msg = "<html><body>"
|
| 510 |
for storeId in hotspotServiceMatrixMap.keys():
|
510 |
for storeId in hotspotServiceMatrixMap.keys():
|
| 511 |
if hotspotServiceMatrixMap.get(storeId).rechargeService:
|
511 |
if hotspotServiceMatrixMap.get(storeId).rechargeService:
|
| 512 |
store = HotspotStore.get_by(id = storeId)
|
512 |
store = HotspotStore.get_by(id = storeId)
|
| 513 |
msg = msg + str(store.hotspotId) + ' - ' + str(store.email) + '<br>'
|
513 |
msg = msg + str(store.hotspotId) + ' - ' + str(store.email) + '<br>'
|
| 514 |
msg = msg + '</body></html>'
|
514 |
msg = msg + '</body></html>'
|
| 515 |
helper_client = HelperClient().get_client()
|
515 |
helper_client = HelperClient().get_client()
|
| 516 |
helper_client.saveUserEmailForSending(["adarsh.verma@spiceretail.co.in"], "cnc.center@shop2020.in", "No Recharge happened for these stores on " + str(date.today()-timedelta(days=1)), msg, "NRM", "NoRechargeMail", ["anupam.singh@shop2020.in"], ["anupam.singh@shop2020.in"], 1)
|
516 |
helper_client.saveUserEmailForSending(["adarsh.verma@spiceretail.co.in"], "cnc.center@shop2020.in", "No Recharge happened for these stores on " + str(date.today()-timedelta(days=1)), msg, "NRM", "NoRechargeMail", ["kshitij.sood@shop2020.in"], ["kshitij.sood@shop2020.in"], 1)
|
| 517 |
|
517 |
|
| 518 |
|
518 |
|
| 519 |
|
519 |
|
| 520 |
def push_recharge_collection_to_ocr():
|
520 |
def push_recharge_collection_to_ocr():
|
| 521 |
rcs = RechargeCollection.query.filter(RechargeCollection.pushedToOcr == False).all()
|
521 |
rcs = RechargeCollection.query.filter(RechargeCollection.pushedToOcr == False).all()
|
| Line 559... |
Line 559... |
| 559 |
if "Saved Successfully" in resp:
|
559 |
if "Saved Successfully" in resp:
|
| 560 |
rc.pushedAt = datetime.datetime.now()
|
560 |
rc.pushedAt = datetime.datetime.now()
|
| 561 |
rc.pushedToOcr = True
|
561 |
rc.pushedToOcr = True
|
| 562 |
session.commit()
|
562 |
session.commit()
|
| 563 |
elif "Error in Saving Data" in resp:
|
563 |
elif "Error in Saving Data" in resp:
|
| 564 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", resp, [])
|
564 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", resp, [])
|
| 565 |
else:
|
565 |
else:
|
| 566 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", resp, [])
|
566 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", resp, [])
|
| 567 |
|
567 |
|
| 568 |
|
568 |
|
| 569 |
|
569 |
|
| 570 |
def topup_company_wallet(companyId, amount):
|
570 |
def topup_company_wallet(companyId, amount):
|
| 571 |
wallet = WalletForCompany.query.filter(WalletForCompany.id == companyId).with_lockmode("update").one()
|
571 |
wallet = WalletForCompany.query.filter(WalletForCompany.id == companyId).with_lockmode("update").one()
|
| Line 579... |
Line 579... |
| 579 |
wh.referenceNumber = get_next_invoice_number(OrderType.WALLETCREDIT)
|
579 |
wh.referenceNumber = get_next_invoice_number(OrderType.WALLETCREDIT)
|
| 580 |
wh.description = "Wallet Credited"
|
580 |
wh.description = "Wallet Credited"
|
| 581 |
|
581 |
|
| 582 |
wallet.amount += amount
|
582 |
wallet.amount += amount
|
| 583 |
session.commit()
|
583 |
session.commit()
|
| 584 |
mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","adarsh.verma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.tyagi@spiceretail.co.in"] , company.name + " wallet topped up by " + str(amount) + " rupees.", "", [], [], [])
|
584 |
mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","adarsh.verma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.tyagi@spiceretail.co.in"] , company.name + " wallet topped up by " + str(amount) + " rupees.", "", [], [], [])
|
| 585 |
|
585 |
|
| 586 |
def compute_website_recharge_collection(cdate, oldBalance, newBalance):
|
586 |
def compute_website_recharge_collection(cdate, oldBalance, newBalance):
|
| 587 |
startTime = datetime.datetime(cdate.year, cdate.month, cdate.day)
|
587 |
startTime = datetime.datetime(cdate.year, cdate.month, cdate.day)
|
| 588 |
endTime = startTime + timedelta(days=1)
|
588 |
endTime = startTime + timedelta(days=1)
|
| 589 |
tamount = 0
|
589 |
tamount = 0
|
| Line 615... |
Line 615... |
| 615 |
wallet.amount = wallet.amount - tamount
|
615 |
wallet.amount = wallet.amount - tamount
|
| 616 |
session.commit()
|
616 |
session.commit()
|
| 617 |
|
617 |
|
| 618 |
|
618 |
|
| 619 |
maildata = ""
|
619 |
maildata = ""
|
| 620 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["pardeep.panwar@spiceretail.co.in>", "amit.tyagi@spiceretail.co.in", "rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Saholic (Date - " + startTime.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(tamount) + ")", maildata, [])
|
620 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["pardeep.panwar@spiceretail.co.in>", "amit.tyagi@spiceretail.co.in", "rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Saholic (Date - " + startTime.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(tamount) + ")", maildata, [])
|
| 621 |
|
621 |
|
| 622 |
rAmount = 0
|
622 |
rAmount = 0
|
| 623 |
ramount = session.query(func.sum(WalletHistoryForCompany.amount)).filter(WalletHistoryForCompany.transactionTime >= startTime).filter(WalletHistoryForCompany.amount >= 100000).one()
|
623 |
ramount = session.query(func.sum(WalletHistoryForCompany.amount)).filter(WalletHistoryForCompany.transactionTime >= startTime).filter(WalletHistoryForCompany.amount >= 100000).one()
|
| 624 |
if ramount[0]:
|
624 |
if ramount[0]:
|
| 625 |
rAmount = int(ramount[0])
|
625 |
rAmount = int(ramount[0])
|
| 626 |
rcs = session.query(func.sum(RechargeCollection.grossAmount)).filter(RechargeCollection.reconDate == int(startTime.strftime("%Y%m%d"))).one()
|
626 |
rcs = session.query(func.sum(RechargeCollection.grossAmount)).filter(RechargeCollection.reconDate == int(startTime.strftime("%Y%m%d"))).one()
|
| 627 |
hamount = int(rcs[0])
|
627 |
hamount = int(rcs[0])
|
| 628 |
|
628 |
|
| 629 |
maildata = "(A) Old Wallet Amount is : " + str(oldBalance) + "<br>(B) New Wallet Amount is : " + str(newBalance) + "<br>(C) Recharge Amount is : " + str(rAmount) + "<br>---------------------------<br>(D) Total Debit Amount for Recharge(A-B+C) is : " + str(oldBalance - newBalance + rAmount) + "<br><br><br>(E) Saholic Recharge Amount is :" + str(tamount) + "<br>(F) Hotspot Recharge Amount is :" + str(hamount) + "<br>---------------------------<br>(G) Total Recharge Amount (E+F) is : " + str(tamount + hamount)
|
629 |
maildata = "(A) Old Wallet Amount is : " + str(oldBalance) + "<br>(B) New Wallet Amount is : " + str(newBalance) + "<br>(C) Recharge Amount is : " + str(rAmount) + "<br>---------------------------<br>(D) Total Debit Amount for Recharge(A-B+C) is : " + str(oldBalance - newBalance + rAmount) + "<br><br><br>(E) Saholic Recharge Amount is :" + str(tamount) + "<br>(F) Hotspot Recharge Amount is :" + str(hamount) + "<br>---------------------------<br>(G) Total Recharge Amount (E+F) is : " + str(tamount + hamount)
|
| 630 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["pardeep.panwar@spiceretail.co.in>", "amit.tyagi@spiceretail.co.in", "rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Wallet and Recharge (Date - " + startTime.strftime("%d-%m-%Y") + ")", maildata, [])
|
630 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["pardeep.panwar@spiceretail.co.in>", "amit.tyagi@spiceretail.co.in", "rajveer.singh@shop2020.in", "kshitij.sood@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Wallet and Recharge (Date - " + startTime.strftime("%d-%m-%Y") + ")", maildata, [])
|
| 631 |
|
631 |
|
| 632 |
if __name__ == '__main__':
|
632 |
if __name__ == '__main__':
|
| 633 |
main()
|
633 |
main()
|
| 634 |
|
634 |
|