Subversion Repositories SmartDukaan

Rev

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

Rev 7780 Rev 7821
Line 71... Line 71...
71
        processAuthorizedTransactions(options.txn_id)
71
        processAuthorizedTransactions(options.txn_id)
72
    if options.collection:
72
    if options.collection:
73
        d = datetime.datetime.now()
73
        d = datetime.datetime.now()
74
        d = d + timedelta(days = -1)
74
        d = d + timedelta(days = -1)
75
        compute_recharge_collection(d)
75
        compute_recharge_collection(d)
-
 
76
        compute_website_recharge_collection(d)
76
    if options.topup:
77
    if options.topup:
77
        topup_company_wallet(1,100000)
78
        topup_company_wallet(1,100000)
78
 
79
 
79
def processRefunds():
80
def processRefunds():
80
    todate = datetime.datetime.now()
81
    todate = datetime.datetime.now()
Line 213... Line 214...
213
 
214
 
214
        maildata += "<tr><td>" + store.hotspotId + "</td><td>" + str(data[2]) + "</td><td>" + str(data[3]) + "</td><td>" + str(data[4]) + "</td></tr>"
215
        maildata += "<tr><td>" + store.hotspotId + "</td><td>" + str(data[2]) + "</td><td>" + str(data[3]) + "</td><td>" + str(data[4]) + "</td></tr>"
215
        trecharge +=  data[2]
216
        trecharge +=  data[2]
216
 
217
 
217
    dit = session.query(func.sum(RechargeCollection.grossAmount)).one()
218
    dit = session.query(func.sum(RechargeCollection.grossAmount)).one()
218
    dit2 = session.query(func.sum(WalletHistoryForCompany.amount)).filter(WalletHistoryForCompany.amount >= 100000).one()
219
    dit2 = session.query(func.sum(WalletHistoryForCompany.amount)).filter(WalletHistoryForCompany.walletId == 1).filter(WalletHistoryForCompany.amount >= 100000).one()
219
    wamt = int(dit2[0])- int(dit[0])
220
    wamt = int(dit2[0])- int(dit[0])
220
    wallet.amount = wamt
221
    wallet.amount = wamt
221
    session.commit()
222
    session.commit()
222
 
223
 
223
    maildata += "</tbody></table></body></html>"
224
    maildata += "</tbody></table></body></html>"
224
    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","gagan.sharma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.tyagi@spiceretail.co.in"], "MIS   (Date - " + todate.strftime("%d-%m-%Y") + ")   (Wallet Amount - " + str(wallet.amount) + ")    (Total Recharge - " + str(trecharge) + ")", maildata, []) 
225
    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","gagan.sharma@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, []) 
225
    try:
226
    try:
226
        push_recharge_collection_to_ocr()
227
        push_recharge_collection_to_ocr()
227
    except:
228
    except:
228
        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", "", [])
229
        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", "", [])
229
         
230
         
Line 290... Line 291...
290
    wh.description = "Wallet Credited"
291
    wh.description = "Wallet Credited"
291
    
292
    
292
    wallet.amount += amount
293
    wallet.amount += amount
293
    session.commit()
294
    session.commit()
294
    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","gagan.sharma@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.", "", [], [], [])
295
    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","gagan.sharma@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.", "", [], [], [])
-
 
296
 
-
 
297
def compute_website_recharge_collection(cdate):
-
 
298
    todate = datetime.datetime(cdate.year, cdate.month, cdate.day)
-
 
299
    tomorrow = todate + timedelta(days=1)
-
 
300
    
-
 
301
    txns = session.query(RechargeOrder.status, func.sum(RechargeOrder.totalAmount)).filter(RechargeOrder.status.in_([RechargeOrderStatus.RECHARGE_SUCCESSFUL, RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.PAYMENT_SUCCESSFUL])).filter(RechargeOrder.creationTimestamp >= todate).filter(RechargeOrder.creationTimestamp < tomorrow).group_by(RechargeTransaction.status).all()
-
 
302
    
-
 
303
    tamount = 0
-
 
304
    for txn in txns:
-
 
305
        tamount += int(txn[1])
-
 
306
        
-
 
307
  
-
 
308
    reftxns = session.query(RechargeOrder.status, func.sum(RechargeOrder.totalAmount)).filter(RechargeOrder.status == RechargeOrderStatus.RECHARGE_FAILED_REFUNDED).filter(RechargeOrder.refundTimestamp >= todate).filter(RechargeOrder.refundTimestamp < tomorrow).group_by(RechargeTransaction.status).all()  
-
 
309
    for txn in reftxns:
-
 
310
        tamount -= int(txn[1])
-
 
311
        
-
 
312
    dit2 = session.query(func.sum(WalletHistoryForCompany.amount)).filter(WalletHistoryForCompany.walletId == 2).filter(WalletHistoryForCompany.amount >= 50000).one()
-
 
313
    wallet = WalletForCompany.query.filter(WalletForCompany.id == 2).with_lockmode("update").one()
-
 
314
    wallet.amount = int(dit2[0])- tamount 
-
 
315
    session.commit()
-
 
316
 
-
 
317
    maildata = ""
-
 
318
    mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in"], "MIS :- Saholic (Date - " + todate.strftime("%d-%m-%Y") + ")   (Wallet Amount - " + str(wallet.amount) + ")    (Total Recharge - " + str(tamount) + ")", maildata, []) 
-
 
319
 
295
    
320
    
296
if __name__ == '__main__':
321
if __name__ == '__main__':
297
    main()
322
    main()
298
323