Subversion Repositories SmartDukaan

Rev

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

Rev 14472 Rev 14513
Line 28... Line 28...
28
 
28
 
29
ORDERS_QUERY='''
29
ORDERS_QUERY='''
30
select o.*, u.username from order_view o join users u on u.id=o.user_id order by id desc limit %s offset %s
30
select o.*, u.username from order_view o join users u on u.id=o.user_id order by id desc limit %s offset %s
31
'''
31
'''
32
ORDERS_DATE_QUERY = '''
32
ORDERS_DATE_QUERY = '''
33
select o.*, u.username from order_view o join users u on u.id=o.user_id where o.created > %s and store_id = %s 
33
select o.*, u.username from order_view o join users u on u.id=o.user_id where o.created between %s and %s and store_id = %s 
34
'''
34
'''
35
ORDERS_DATE_QUERY1 = '''
35
ORDERS_DATE_QUERY1 = '''
36
select * from orders where created > %s and store_id = %s 
36
select * from orders where created > %s and store_id = %s 
37
'''
37
'''
38
 
38
 
Line 94... Line 94...
94
def getOrdersAfterDate(afterDate, storeId):
94
def getOrdersAfterDate(afterDate, storeId):
95
    try:
95
    try:
96
        conn = getDbConnection()
96
        conn = getDbConnection()
97
        cursor = conn.cursor()
97
        cursor = conn.cursor()
98
        afterDate = datetime.strftime(afterDate,"\'%Y-%m-%d\'")
98
        afterDate = datetime.strftime(afterDate,"\'%Y-%m-%d\'")
-
 
99
        beforeDate = datetime.strftime(datetime.now(),"\'%Y-%m-%d\'")
99
        cursor.execute(ORDERS_DATE_QUERY%(afterDate, storeId))
100
        cursor.execute(ORDERS_DATE_QUERY%(afterDate, beforeDate, storeId))
100
        result = cursor.fetchall()
101
        result = cursor.fetchall()
101
        return result
102
        return result
102
    finally:
103
    finally:
103
        conn.close() 
104
        conn.close() 
104
 
105