| Line 44... |
Line 44... |
| 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, count(*) 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 |
where d.monthnumber in (month(now()), month(now())-1)
|
51 |
where d.monthnumber in (month(now()), month(now())-1)
|
| - |
|
52 |
and os.isValid = 'valid'
|
| 51 |
group by i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''),
|
53 |
group by i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''),
|
| 52 |
IFNULL(i.model_number, ''), i.color, d.monthname, d.monthnumber, d.dayofmonth
|
54 |
IFNULL(i.model_number, ''), i.color, d.monthname, d.monthnumber, d.dayofmonth
|
| 53 |
'''
|
55 |
'''
|
| 54 |
conn = getDbConnection()
|
56 |
conn = getDbConnection()
|
| 55 |
monthdatesmap = {}
|
57 |
monthdatesmap = {}
|