| Line 128... |
Line 128... |
| 128 |
order = db.merchantOrder.find_one({"orderId":orderId})
|
128 |
order = db.merchantOrder.find_one({"orderId":orderId})
|
| 129 |
if order is None:
|
129 |
if order is None:
|
| 130 |
continue
|
130 |
continue
|
| 131 |
#saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
131 |
#saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))
|
| 132 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
132 |
aff = list(db.snapdealOrderAffiliateInfo.find({"subTagId":order["subTagId"]}))
|
| 133 |
matchedSubTag = False
|
133 |
matched = False
|
| 134 |
if len(aff) > 0 and order["subTagId"] not in matchedList:
|
134 |
if len(aff) > 0 and order["subTagId"] not in matchedList:
|
| 135 |
matchedSubTag = True
|
135 |
if int(order["paidAmount"]) == aff[0]["saleAmount"]:
|
| 136 |
matchedList.append(order["subTagId"])
|
136 |
matchedList.append(order["subTagId"])
|
| - |
|
137 |
aff[0]['reconciled'] = True
|
| - |
|
138 |
db.snapdealOrderAffiliateInfo.save(aff[0])
|
| - |
|
139 |
order['reconciled'] = True
|
| - |
|
140 |
db.merchantOrder.save(order)
|
| 137 |
once = True
|
141 |
once = True
|
| 138 |
for subOrder in order['subOrders']:
|
142 |
for subOrder in order['subOrders']:
|
| 139 |
i=-1
|
143 |
i=-1
|
| 140 |
row += 1
|
144 |
row += 1
|
| 141 |
worksheet.write(row, inc(), orderId)
|
145 |
worksheet.write(row, inc(), orderId)
|
| 142 |
worksheet.write(row, inc(), row1[1])
|
146 |
worksheet.write(row, inc(), row1[1])
|
| 143 |
worksheet.write(row, inc(), row1[-1])
|
147 |
worksheet.write(row, inc(), row1[-1])
|
| 144 |
worksheet.write(row, inc(), order['merchantOrderId'])
|
148 |
worksheet.write(row, inc(), order['merchantOrderId'])
|
| 145 |
worksheet.write(row, inc(), subOrder['productTitle'])
|
149 |
worksheet.write(row, inc(), subOrder['productTitle'])
|
| 146 |
worksheet.write(row, inc(), subOrder['amountPaid'])
|
150 |
worksheet.write(row, inc(), subOrder['amountPaid'])
|
| 147 |
worksheet.write(row, inc(), subOrder['quantity'])
|
151 |
worksheet.write(row, inc(), subOrder['quantity'])
|
| 148 |
worksheet.write(row, inc(), subOrder['status'])
|
152 |
worksheet.write(row, inc(), subOrder['status'])
|
| 149 |
worksheet.write(row, inc(), subOrder['detailedStatus'])
|
153 |
worksheet.write(row, inc(), subOrder['detailedStatus'])
|
| 150 |
worksheet.write(row, inc(), subOrder['cashBackStatus'])
|
154 |
worksheet.write(row, inc(), subOrder['cashBackStatus'])
|
| 151 |
worksheet.write(row, inc(), subOrder['cashBackAmount'])
|
155 |
worksheet.write(row, inc(), subOrder['cashBackAmount'])
|
| 152 |
worksheet.write(row, inc(), subOrder['placedOn'])
|
156 |
worksheet.write(row, inc(), subOrder['placedOn'])
|
| 153 |
worksheet.write(row, inc(), order['subTagId'])
|
157 |
worksheet.write(row, inc(), order['subTagId'])
|
| 154 |
if matchedSubTag:
|
- |
|
| 155 |
worksheet.write(row, inc(), aff[0]['adId'])
|
158 |
worksheet.write(row, inc(), aff[0]['adId'])
|
| 156 |
worksheet.write(row, inc(), aff[0]['saleDate'])
|
159 |
worksheet.write(row, inc(), aff[0]['saleDate'])
|
| 157 |
if once:
|
160 |
if once:
|
| 158 |
worksheet.write(row, inc(), aff[0]['payOut'])
|
161 |
worksheet.write(row, inc(), aff[0]['payOut'])
|
| 159 |
worksheet.write(row, inc(), aff[0]['saleAmount'])
|
162 |
worksheet.write(row, inc(), aff[0]['saleAmount'])
|
| 160 |
once = False
|
163 |
once = False
|
| 161 |
workbook.save(XLS_FILENAME)
|
164 |
workbook.save(XLS_FILENAME)
|
| 162 |
|
165 |
|
| 163 |
def sendmail(email, message, title):
|
166 |
def sendmail(email, message, title):
|
| 164 |
if email == "":
|
167 |
if email == "":
|
| 165 |
return
|
168 |
return
|