Subversion Repositories SmartDukaan

Rev

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

Rev 7163 Rev 7169
Line 4537... Line 4537...
4537
        status = None    
4537
        status = None    
4538
        
4538
        
4539
    query = RechargeTransaction.query
4539
    query = RechargeTransaction.query
4540
    if storeId is not None:
4540
    if storeId is not None:
4541
        query = query.filter(RechargeTransaction.storeId == storeId)
4541
        query = query.filter(RechargeTransaction.storeId == storeId)
4542
    if startdate is not None and enddate is not None:
-
 
4543
        startdate = to_py_date(startdate).date()
-
 
4544
        enddate = to_py_date(enddate).date()
-
 
4545
        if startdate == enddate:
-
 
4546
            query = query.filter(cast(RechargeTransaction.transactionTime, DATE) == enddate)
-
 
4547
        elif enddate < startdate:
-
 
4548
            query = query.filter(between(cast(RechargeTransaction.transactionTime, DATE), enddate, startdate))
-
 
4549
        else:
-
 
4550
            query = query.filter(between(cast(RechargeTransaction.transactionTime, DATE), startdate, enddate))
-
 
4551
    elif startdate is not None:
-
 
4552
        startdate = to_py_date(startdate).date()
-
 
4553
        query = query.filter(cast(RechargeTransaction.transactionTime, DATE) >= startdate)
-
 
4554
    elif enddate is not None:
-
 
4555
        enddate = to_py_date(enddate).date()
-
 
4556
        query = query.filter(cast(RechargeTransaction.transactionTime, DATE) <= enddate)
-
 
4557
    if status is not None:
4542
    if status is not None:
4558
        query = query.filter(RechargeTransaction.status == status)
4543
        query = query.filter(RechargeTransaction.status == status)
-
 
4544
        
-
 
4545
    if status == RechargeOrderStatus.RECHARGE_FAILED_REFUNDED :
-
 
4546
        query.filter(cast(RechargeTransaction.responseTime, DATE) == enddate)
4559
    
4547
    
-
 
4548
    else :
-
 
4549
        if startdate is not None and enddate is not None:
-
 
4550
            startdate = to_py_date(startdate).date()
-
 
4551
            enddate = to_py_date(enddate).date()
4560
    return query.all()    
4552
            if startdate == enddate:
-
 
4553
                query = query.filter(cast(RechargeTransaction.transactionTime, DATE) == enddate)
-
 
4554
            elif enddate < startdate:
-
 
4555
                query = query.filter(between(cast(RechargeTransaction.transactionTime, DATE), enddate, startdate))
4561
         
4556
            else:
-
 
4557
                query = query.filter(between(cast(RechargeTransaction.transactionTime, DATE), startdate, enddate))
-
 
4558
        elif startdate is not None:
-
 
4559
            startdate = to_py_date(startdate).date()
-
 
4560
            query = query.filter(cast(RechargeTransaction.transactionTime, DATE) >= startdate)
-
 
4561
        elif enddate is not None:
-
 
4562
            enddate = to_py_date(enddate).date()
-
 
4563
            query = query.filter(cast(RechargeTransaction.transactionTime, DATE) <= enddate)
4562
 
4564
 
4563
    
4565
    return query.all()    
4564
 
4566
 
4565
def update_recharge_transaction_status(id, status, refundTime):
4567
def update_recharge_transaction_status(id, status, refundTime):
4566
    rechargeTransaction = RechargeTransaction.get_by(id=id)
4568
    rechargeTransaction = RechargeTransaction.get_by(id=id)
4567
    if status in (RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.RECHARGE_FAILED):
4569
    if status in (RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.RECHARGE_FAILED):
4568
        rechargeTransaction.status = status
4570
        rechargeTransaction.status = status
Line 4778... Line 4780...
4778
    except:
4780
    except:
4779
        return bin(0)
4781
        return bin(0)
4780
    
4782
    
4781
    return pdfFile
4783
    return pdfFile
4782
 
4784
 
-
 
4785
def get_recharge_transactions_by_number(number):
-
 
4786
    query = RechargeTransaction.query.filter(RechargeTransaction.deviceNum == number)
-
 
4787
    return query.all()
-
 
4788
 
-
 
4789
def update_hotspot_store_password(storeId, password):
-
 
4790
    store = None
-
 
4791
    if password is None:
-
 
4792
        return False
-
 
4793
    if storeId:
-
 
4794
        store = HotspotStore.query.filter(HotspotStore.id == storeId).first()
-
 
4795
    if store:
-
 
4796
        store.password = password
-
 
4797
        session.commit()
-
 
4798
        return True
-
 
4799
    return False
-
 
4800
    
4783
if __name__ == '__main__':
4801
if __name__ == '__main__':
4784
    print 'helllo'
4802
    print 'helllo'
4785
4803