| Line 44... |
Line 44... |
| 44 |
IFNULL(i.model_number, ''), i.color, sum(quantity) AS quantity, sum(total_amount) AS totalAmount
|
44 |
IFNULL(i.model_number, ''), i.color, sum(quantity) AS quantity, sum(total_amount) AS totalAmount
|
| 45 |
FROM sales s join item i on (i.id = s.item_id)
|
45 |
FROM sales s join item i on (i.id = s.item_id)
|
| 46 |
JOIN datedim d on (d.date_id = s.date_id)
|
46 |
JOIN datedim d on (d.date_id = s.date_id)
|
| 47 |
JOIN orderstatus os on (s.status = os.status)
|
47 |
JOIN orderstatus os on (s.status = os.status)
|
| 48 |
WHERE d.fulldate in (DATE_SUB(curdate(), INTERVAL 1 DAY))
|
48 |
WHERE d.fulldate in (DATE_SUB(curdate(), INTERVAL 1 DAY))
|
| 49 |
AND os.statusGroup in ('Delivered', 'Refunded', 'Return in process', 'Unused')
|
49 |
AND os.statusGroup in ('Delivered', 'In process', 'Refunded', 'Return in process', 'Unused')
|
| 50 |
AND i.parent_category = 'Mobile Accessories'
|
50 |
AND i.parent_category = 'Mobile Accessories'
|
| 51 |
AND os.statusSubGroup in ('In process', 'Lost in transit', 'Low inventory', 'Shipped')
|
51 |
AND os.statusSubGroup not in ('Cancellation pending', 'Cod verification pending')
|
| 52 |
GROUP BY i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), IFNULL(i.model_number, ''), i.color
|
52 |
GROUP BY i.parent_category, i.category, i.brand, IFNULL(i.model_name, ''), IFNULL(i.model_number, ''), i.color
|
| 53 |
ORDER BY i.parent_category, i.brand;
|
53 |
ORDER BY i.parent_category, i.brand;
|
| 54 |
'''
|
54 |
'''
|
| 55 |
|
55 |
|
| 56 |
conn = getDbConnection()
|
56 |
conn = getDbConnection()
|