| Line 21... |
Line 21... |
| 21 |
|
21 |
|
| 22 |
# KEY NAMES
|
22 |
# KEY NAMES
|
| 23 |
MONTHNAME = 'monthname'
|
23 |
MONTHNAME = 'monthname'
|
| 24 |
DATES = 'dates'
|
24 |
DATES = 'dates'
|
| 25 |
|
25 |
|
| - |
|
26 |
MAILTO = ['anupam.singh@shop2020.in']
|
| 26 |
MAILTO = ['rajneesharora@spiceretail.co.in', 'pankaj.kankar@shop2020.in', 'ashutosh.saxena@shop2020.in', 'anupam.singh@shop2020.in']
|
27 |
#['rajneesharora@spiceretail.co.in', 'pankaj.kankar@shop2020.in', 'ashutosh.saxena@shop2020.in', 'anupam.singh@shop2020.in']
|
| 27 |
SENDER = "cnc.center@shop2020.in"
|
28 |
SENDER = "cnc.center@shop2020.in"
|
| 28 |
PASSWORD = "5h0p2o2o"
|
29 |
PASSWORD = "5h0p2o2o"
|
| 29 |
SUBJECT = "Previous Day Accessory Sales Report"
|
30 |
SUBJECT = "Previous Day Accessory Sales Report"
|
| 30 |
SMTP_SERVER = "smtp.gmail.com"
|
31 |
SMTP_SERVER = "smtp.gmail.com"
|
| 31 |
SMTP_PORT = 587
|
32 |
SMTP_PORT = 587
|
| Line 43... |
Line 44... |
| 43 |
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
|
| 44 |
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)
|
| 45 |
JOIN datedim d on (d.date_id = s.date_id)
|
46 |
JOIN datedim d on (d.date_id = s.date_id)
|
| 46 |
JOIN orderstatus os on (s.status = os.status)
|
47 |
JOIN orderstatus os on (s.status = os.status)
|
| 47 |
WHERE d.fulldate in (DATE_SUB(curdate(), INTERVAL 1 DAY))
|
48 |
WHERE d.fulldate in (DATE_SUB(curdate(), INTERVAL 1 DAY))
|
| 48 |
AND os.statusGroup in ('In process', 'Delivered', 'Cancelled', 'Return in process', 'Reshipped', 'Refunded')
|
49 |
AND os.statusGroup in ('Delivered', 'Refunded', 'Return in process', 'Unused')
|
| 49 |
AND i.parent_category = 'Mobile Accessories'
|
50 |
AND i.parent_category = 'Mobile Accessories'
|
| 50 |
AND os.statusSubGroup != 'Cod verification failed'
|
51 |
AND os.statusSubGroup in ('In process', 'Lost in transit', 'Low inventory', 'Shipped')
|
| 51 |
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
|
| 52 |
ORDER BY i.parent_category, i.brand;
|
53 |
ORDER BY i.parent_category, i.brand;
|
| 53 |
'''
|
54 |
'''
|
| 54 |
|
55 |
|
| 55 |
|
- |
|
| 56 |
conn = getDbConnection()
|
56 |
conn = getDbConnection()
|
| 57 |
monthdatesmap = {}
|
57 |
monthdatesmap = {}
|
| 58 |
prodsalesmap = {}
|
58 |
prodsalesmap = {}
|
| 59 |
try:
|
59 |
try:
|
| 60 |
# prepare a cursor object using cursor() method
|
60 |
# prepare a cursor object using cursor() method
|