Subversion Repositories SmartDukaan

Rev

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

Rev 14578 Rev 14602
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.*, max(d.versioncode), u.username from order_view o join users u on u.id=o.user_id left 
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
join devices d on (d.user_id=o.user_id and o.created >= d.created) where o.created between '%s' and '%s' and store_id = %s group by o.id 
34
'''
35
'''
35
ORDERS_DATE_QUERY1 = '''
36
ORDERS_DATE_QUERY1 = '''
36
select * from orders where created > %s and store_id = %s 
37
select * from orders where created > %s and store_id = %s 
37
'''
38
'''
38
 
39
 
Line 93... Line 94...
93
 
94
 
94
def getOrdersAfterDate(afterDate, storeId):
95
def getOrdersAfterDate(afterDate, storeId):
95
    try:
96
    try:
96
        conn = getDbConnection()
97
        conn = getDbConnection()
97
        cursor = conn.cursor()
98
        cursor = conn.cursor()
98
        afterDate = datetime.strftime(afterDate,"\'%Y-%m-%d\'")
99
        afterDate = datetime.strftime(afterDate,"%Y-%m-%d")
99
        beforeDate = datetime.strftime(datetime.now(),"\'%Y-%m-%d %H\'")
100
        beforeDate = datetime.strftime(datetime.now(),"%Y-%m-%d %H")
100
        cursor.execute(ORDERS_DATE_QUERY%(afterDate, beforeDate, storeId))
101
        cursor.execute(ORDERS_DATE_QUERY%(afterDate, beforeDate, storeId))
101
        result = cursor.fetchall()
102
        result = cursor.fetchall()
102
        return result
103
        return result
103
    finally:
104
    finally:
104
        conn.close() 
105
        conn.close()