Subversion Repositories SmartDukaan

Rev

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

Rev 8790 Rev 8795
Line 96... Line 96...
96
def processRecon():
96
def processRecon():
97
    cdate = datetime.datetime.now() + timedelta(days = -1)
97
    cdate = datetime.datetime.now() + timedelta(days = -1)
98
    startTime = datetime.datetime(cdate.year, cdate.month, cdate.day)
98
    startTime = datetime.datetime(cdate.year, cdate.month, cdate.day)
99
    endTime = startTime + timedelta(days=1)
99
    endTime = startTime + timedelta(days=1)
100
 
100
 
-
 
101
    startTime = datetime.datetime.strptime('2012-10-10 00:00:00', "%Y-%m-%d %H:%M:%S");
-
 
102
    endTime = datetime.datetime.strptime('2013-11-13 17:43:43', "%Y-%m-%d %H:%M:%S");
-
 
103
 
101
    '''
104
    '''
102
    A - All such orders for which we have attempted the recharge and recharge is either successful or unknown.
105
    A - All such orders for which we have attempted the recharge and recharge is either successful or unknown.
103
    B - All such orders for which we have attempted the recharge and we received the refund after this time window.
106
    B - All such orders for which we have attempted the recharge and we received the refund after this time window.
104
    C - All such orders for which we have received the refund in this time window, although the recharge was attempted before this window.
107
    C - All such orders for which we have received the refund in this time window, although the recharge was attempted before this window.
105
    X1 = A + B - C         Net amount debited for all the customers in this time window.
108
    X1 = A + B - C         Net amount debited for all the customers in this time window.
Line 149... Line 152...
149
        
152
        
150
    uw = session.query(func.sum(UserWalletHistory.amount)).filter(UserWalletHistory.timestamp.between(startTime,endTime)).first()
153
    uw = session.query(func.sum(UserWalletHistory.amount)).filter(UserWalletHistory.timestamp.between(startTime,endTime)).first()
151
    if uw and uw[0]:
154
    if uw and uw[0]:
152
        X4 = int(uw[0])
155
        X4 = int(uw[0])
153
    
156
    
154
    
157
    #X4 = 191497
155
    
158
    
156
    pc = PaymentClient().get_client()
159
    pc = PaymentClient().get_client()
157
    payments = pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 2, 1) + pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 2, 2) + pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 8, 1) + pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 8, 2)
160
    payments = pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 2, 1) + pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 2, 2) + pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 8, 1) + pc.getPayments(to_java_date(startTime - datetime.timedelta(minutes = 30)), to_java_date(endTime + datetime.timedelta(minutes = 30)), 8, 2)
158
    for payment in payments:
161
    for payment in payments:
159
        if payment.isDigital and to_py_date(payment.successTimestamp) >= startTime and to_py_date(payment.successTimestamp) <= endTime:  
162
        if payment.isDigital and to_py_date(payment.successTimestamp) >= startTime and to_py_date(payment.successTimestamp) <= endTime:  
Line 201... Line 204...
201
            for mismatch in mismatches:
204
            for mismatch in mismatches:
202
                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>"        
205
                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>"        
203
            maildata += "</tbody></table>"
206
            maildata += "</tbody></table>"
204
    
207
    
205
    maildata += "</body></html>"
208
    maildata += "</body></html>"
206
    mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in"], "Customer Recharge Reconciliation for Date:- " + startTime.strftime("%d-%m-%Y"), maildata, [])
209
    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, [])
207
    
210
    
208
    #, "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"
-
 
209
 
211
 
210
def processRefunds():
212
def processRefunds():
211
    todate = datetime.datetime.now()
213
    todate = datetime.datetime.now()
212
    for i in range(10):
214
    for i in range(10):
213
        orderDate = todate + datetime.timedelta(days= -i)
215
        orderDate = todate + datetime.timedelta(days= -i)