Subversion Repositories SmartDukaan

Rev

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

Rev 4070 Rev 4074
Line 41... Line 41...
41
def closeConnection(conn):
41
def closeConnection(conn):
42
    conn.close()
42
    conn.close()
43
 
43
 
44
def getProductSaleData():
44
def getProductSaleData():
45
    selectSql = '''select i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), IFNULL(i.model_number, ''), 
45
    selectSql = '''select i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), IFNULL(i.model_number, ''), 
46
                          i.color, d.monthname, d.monthnumber, d.dayofmonth, count(*) as quantity 
46
                          i.color, d.monthname, d.monthnumber, d.dayofmonth, sum(quantity) as quantity 
47
                          from sales s 
47
                          from sales s 
48
                          join item i on (i.id = s.item_id) 
48
                          join item i on (i.id = s.item_id) 
49
                          join datedim d on (d.date_id = s.date_id)
49
                          join datedim d on (d.date_id = s.date_id)
50
                          join orderstatus os on (s.status = os.status) 
50
                          join orderstatus os on (s.status = os.status) 
51
                          where d.monthnumber in (month(now()), month(now())-1)
51
                          where d.monthnumber in (month(now()), month(now())-1)
52
                          and os.isValid = 'valid'
52
                          and os.isValid = 'Valid'
-
 
53
                          and os.description != 'Refunded'
53
                          group by i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), 
54
                          group by i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), 
54
                                   IFNULL(i.model_number, ''), i.color, d.monthname, d.monthnumber, d.dayofmonth
55
                                   IFNULL(i.model_number, ''), i.color, d.monthname, d.monthnumber, d.dayofmonth
55
                '''
56
                '''
56
    conn = getDbConnection()
57
    conn = getDbConnection()
57
    monthdatesmap = {}
58
    monthdatesmap = {}