| Line 41... |
Line 41... |
| 41 |
#wb = xlwt.Workbook()
|
41 |
#wb = xlwt.Workbook()
|
| 42 |
row = 0
|
42 |
row = 0
|
| 43 |
worksheet = wb.add_sheet("Flipkart")
|
43 |
worksheet = wb.add_sheet("Flipkart")
|
| 44 |
worksheet.write(row, inc(), 'Order Id', boldStyle)
|
44 |
worksheet.write(row, inc(), 'Order Id', boldStyle)
|
| 45 |
worksheet.write(row, inc(), 'User Id', boldStyle)
|
45 |
worksheet.write(row, inc(), 'User Id', boldStyle)
|
| - |
|
46 |
worksheet.write(row, inc(), 'Username', boldStyle)
|
| 46 |
worksheet.write(row, inc(), 'Merchant Order Id', boldStyle)
|
47 |
worksheet.write(row, inc(), 'Merchant Order Id', boldStyle)
|
| 47 |
worksheet.write(row, inc(), 'Product Title', boldStyle)
|
48 |
worksheet.write(row, inc(), 'Product Title', boldStyle)
|
| 48 |
worksheet.write(row, inc(), 'Price', boldStyle)
|
49 |
worksheet.write(row, inc(), 'Price', boldStyle)
|
| 49 |
worksheet.write(row, inc(), 'Quantity', boldStyle)
|
50 |
worksheet.write(row, inc(), 'Quantity', boldStyle)
|
| 50 |
worksheet.write(row, inc(), 'Status', boldStyle)
|
51 |
worksheet.write(row, inc(), 'Status', boldStyle)
|
| Line 72... |
Line 73... |
| 72 |
row += 1
|
73 |
row += 1
|
| 73 |
global i
|
74 |
global i
|
| 74 |
i=-1
|
75 |
i=-1
|
| 75 |
worksheet.write(row, inc(), orderId)
|
76 |
worksheet.write(row, inc(), orderId)
|
| 76 |
worksheet.write(row, inc(), row1[1])
|
77 |
worksheet.write(row, inc(), row1[1])
|
| - |
|
78 |
worksheet.write(row, inc(), row1[-1])
|
| 77 |
worksheet.write(row, inc(), order['merchantOrderId'])
|
79 |
worksheet.write(row, inc(), order['merchantOrderId'])
|
| 78 |
worksheet.write(row, inc(), subOrder['productTitle'])
|
80 |
worksheet.write(row, inc(), subOrder['productTitle'])
|
| 79 |
worksheet.write(row, inc(), subOrder['amountPaid'])
|
81 |
worksheet.write(row, inc(), subOrder['amountPaid'])
|
| 80 |
worksheet.write(row, inc(), subOrder['quantity'])
|
82 |
worksheet.write(row, inc(), subOrder['quantity'])
|
| 81 |
worksheet.write(row, inc(), subOrder['status'])
|
83 |
worksheet.write(row, inc(), subOrder['status'])
|
| Line 100... |
Line 102... |
| 100 |
|
102 |
|
| 101 |
workbook = xlwt.Workbook()
|
103 |
workbook = xlwt.Workbook()
|
| 102 |
worksheet = workbook.add_sheet("Snapdeal")
|
104 |
worksheet = workbook.add_sheet("Snapdeal")
|
| 103 |
column = 0
|
105 |
column = 0
|
| 104 |
row = 0
|
106 |
row = 0
|
| - |
|
107 |
global i
|
| 105 |
|
108 |
i=-1
|
| 106 |
worksheet.write(row, 0, 'Order Id', boldStyle)
|
109 |
worksheet.write(row, inc(), 'Order Id', boldStyle)
|
| 107 |
worksheet.write(row, 1, 'User Id', boldStyle)
|
110 |
worksheet.write(row, inc(), 'User Id', boldStyle)
|
| - |
|
111 |
worksheet.write(row, inc(), 'Username', boldStyle)
|
| 108 |
worksheet.write(row, 2, 'Merchant Order Id', boldStyle)
|
112 |
worksheet.write(row, inc(), 'Merchant Order Id', boldStyle)
|
| 109 |
worksheet.write(row, 3, 'Product Title', boldStyle)
|
113 |
worksheet.write(row, inc(), 'Product Title', boldStyle)
|
| 110 |
worksheet.write(row, 4, 'Price', boldStyle)
|
114 |
worksheet.write(row, inc(), 'Price', boldStyle)
|
| 111 |
worksheet.write(row, 5, 'Quantity', boldStyle)
|
115 |
worksheet.write(row, inc(), 'Quantity', boldStyle)
|
| 112 |
worksheet.write(row, 6, 'Status', boldStyle)
|
116 |
worksheet.write(row, inc(), 'Status', boldStyle)
|
| 113 |
worksheet.write(row, 7, 'Detailed Status', boldStyle)
|
117 |
worksheet.write(row, inc(), 'Detailed Status', boldStyle)
|
| 114 |
worksheet.write(row, 8, 'Cashback Status', boldStyle)
|
118 |
worksheet.write(row, inc(), 'Cashback Status', boldStyle)
|
| 115 |
worksheet.write(row, 9, 'Our CashBack', boldStyle)
|
119 |
worksheet.write(row, inc(), 'Our CashBack', boldStyle)
|
| 116 |
worksheet.write(row, 10, 'Sale Date', boldStyle)
|
120 |
worksheet.write(row, inc(), 'Sale Date', boldStyle)
|
| 117 |
worksheet.write(row, 11, 'SubtagId', boldStyle)
|
121 |
worksheet.write(row, inc(), 'SubtagId', boldStyle)
|
| 118 |
worksheet.write(row, 12, 'Ad Id', boldStyle)
|
122 |
worksheet.write(row, inc(), 'Ad Id', boldStyle)
|
| 119 |
worksheet.write(row, 13, 'Affiliate PayOut', boldStyle)
|
123 |
worksheet.write(row, inc(), 'Affiliate PayOut', boldStyle)
|
| 120 |
worksheet.write(row, 14, 'Affiliate Sale Amount', boldStyle)
|
124 |
worksheet.write(row, inc(), 'Affiliate Sale Amount', boldStyle)
|
| 121 |
worksheet.write(row, 15, 'Affiliate Sale Date', boldStyle)
|
125 |
worksheet.write(row, inc(), 'Affiliate Sale Date', boldStyle)
|
| 122 |
|
126 |
|
| 123 |
for row1 in curs:
|
127 |
for row1 in curs:
|
| 124 |
orderId = row1[0]
|
128 |
orderId = row1[0]
|
| 125 |
order = db.merchantOrder.find_one({"orderId":orderId})
|
129 |
order = db.merchantOrder.find_one({"orderId":orderId})
|
| 126 |
if order is None:
|
130 |
if order is None:
|
| Line 128... |
Line 132... |
| 128 |
print order["subTagId"]
|
132 |
print order["subTagId"]
|
| 129 |
print order
|
133 |
print order
|
| 130 |
saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
134 |
saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
| 131 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
135 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
| 132 |
|
136 |
|
| 133 |
for subOrder in order['subOrders']:
|
137 |
for subOrder in order['subOrders']:
|
| - |
|
138 |
i=-1
|
| 134 |
row += 1
|
139 |
row += 1
|
| 135 |
worksheet.write(row, 0, orderId)
|
140 |
worksheet.write(row, inc(), orderId)
|
| 136 |
worksheet.write(row, 1, row1[1])
|
141 |
worksheet.write(row, inc(), row1[1])
|
| - |
|
142 |
worksheet.write(row, inc(), row1[-1])
|
| 137 |
worksheet.write(row, 2, order['merchantOrderId'])
|
143 |
worksheet.write(row, inc(), order['merchantOrderId'])
|
| 138 |
worksheet.write(row, 3, subOrder['productTitle'])
|
144 |
worksheet.write(row, inc(), subOrder['productTitle'])
|
| 139 |
worksheet.write(row, 4, subOrder['amountPaid'])
|
145 |
worksheet.write(row, inc(), subOrder['amountPaid'])
|
| 140 |
worksheet.write(row, 5, subOrder['quantity'])
|
146 |
worksheet.write(row, inc(), subOrder['quantity'])
|
| 141 |
worksheet.write(row, 6, subOrder['status'])
|
147 |
worksheet.write(row, inc(), subOrder['status'])
|
| 142 |
worksheet.write(row, 7, subOrder['detailedStatus'])
|
148 |
worksheet.write(row, inc(), subOrder['detailedStatus'])
|
| 143 |
worksheet.write(row, 8, subOrder['cashBackStatus'])
|
149 |
worksheet.write(row, inc(), subOrder['cashBackStatus'])
|
| 144 |
worksheet.write(row, 9, subOrder['cashBackAmount'])
|
150 |
worksheet.write(row, inc(), subOrder['cashBackAmount'])
|
| 145 |
worksheet.write(row, 10, subOrder['placedOn'])
|
151 |
worksheet.write(row, inc(), subOrder['placedOn'])
|
| 146 |
worksheet.write(row, 11, order['subTagId'])
|
152 |
worksheet.write(row, inc(), order['subTagId'])
|
| 147 |
if len(aff) and abs(saleTime-aff[0]['saleTime']) < 60:
|
153 |
if len(aff) and abs(saleTime-aff[0]['saleTime']) < 60:
|
| 148 |
worksheet.write(row, 12, aff[0]['adId'])
|
154 |
worksheet.write(row, inc(), aff[0]['adId'])
|
| 149 |
worksheet.write(row, 13, aff[0]['payOut'])
|
155 |
worksheet.write(row, inc(), aff[0]['payOut'])
|
| 150 |
worksheet.write(row, 14, aff[0]['saleAmount'])
|
156 |
worksheet.write(row, inc(), aff[0]['saleAmount'])
|
| 151 |
worksheet.write(row, 15, aff[0]['saleDate'])
|
157 |
worksheet.write(row, inc(), aff[0]['saleDate'])
|
| 152 |
workbook.save(XLS_FILENAME)
|
158 |
workbook.save(XLS_FILENAME)
|
| 153 |
|
159 |
|
| 154 |
def sendmail(email, message, title):
|
160 |
def sendmail(email, message, title):
|
| 155 |
if email == "":
|
161 |
if email == "":
|
| 156 |
return
|
162 |
return
|