| Line 240... |
Line 240... |
| 240 |
message+="""<tr>
|
240 |
message+="""<tr>
|
| 241 |
<td style="text-align:center">"""+str(ds_item.id)+"""</td>
|
241 |
<td style="text-align:center">"""+str(ds_item.id)+"""</td>
|
| 242 |
<td style="text-align:center">"""+xstr(ds_item.brand)+" "+xstr(ds_item.model_name)+" "+xstr(ds_item.model_number)+" "+xstr(ds_item.color)+"""</td>
|
242 |
<td style="text-align:center">"""+xstr(ds_item.brand)+" "+xstr(ds_item.model_name)+" "+xstr(ds_item.model_number)+" "+xstr(ds_item.color)+"""</td>
|
| 243 |
<td style="text-align:center">"""+str(snapdealItem.sellingPrice)+"""</td>
|
243 |
<td style="text-align:center">"""+str(snapdealItem.sellingPrice)+"""</td>
|
| 244 |
<td style="text-align:center">"""+str(snapdealItem.transferPrice)+"""</td>
|
244 |
<td style="text-align:center">"""+str(snapdealItem.transferPrice)+"""</td>
|
| 245 |
<td style="text-align:center">"""+str(snapdealItem.commission*1.1236)+"""</td>
|
245 |
<td style="text-align:center">"""+str(round(snapdealItem.commission*1.1236,2))+"""</td>
|
| 246 |
<td style="text-align:center">"""+str(marketplaceItem.commission)+"%"+"""</td>
|
246 |
<td style="text-align:center">"""+str(marketplaceItem.commission)+"%"+"""</td>
|
| 247 |
<td style="text-align:center">"""+str(ds_item.weight*1000)+" gms"+"""</td>
|
247 |
<td style="text-align:center">"""+str(ds_item.weight*1000)+" gms"+"""</td>
|
| 248 |
<td style="text-align:center">"""+str(snapdealItem.courierCost*1.1236)+"""</td>
|
248 |
<td style="text-align:center">"""+str(round(snapdealItem.courierCost*1.1236,2))+"""</td>
|
| 249 |
</tr>"""
|
249 |
</tr>"""
|
| 250 |
message+="""</tbody></table></body></html>"""
|
250 |
message+="""</tbody></table></body></html>"""
|
| 251 |
print message
|
251 |
print message
|
| 252 |
mailServer = smtplib.SMTP("smtp.gmail.com", 587)
|
252 |
mailServer = smtplib.SMTP("smtp.gmail.com", 587)
|
| 253 |
mailServer.ehlo()
|
253 |
mailServer.ehlo()
|
| Line 415... |
Line 415... |
| 415 |
sheet.write(sheet_iterator, 5, snapdealItem.transferPrice)
|
415 |
sheet.write(sheet_iterator, 5, snapdealItem.transferPrice)
|
| 416 |
sheet.write(sheet_iterator, 6, round(snapdealItem.commission*1.1236,2))
|
416 |
sheet.write(sheet_iterator, 6, round(snapdealItem.commission*1.1236,2))
|
| 417 |
sheet.write(sheet_iterator, 7, marketplaceItem.commission)
|
417 |
sheet.write(sheet_iterator, 7, marketplaceItem.commission)
|
| 418 |
sheet.write(sheet_iterator, 8, (ds_item.weight*1000))
|
418 |
sheet.write(sheet_iterator, 8, (ds_item.weight*1000))
|
| 419 |
sheet.write(sheet_iterator, 9, round(snapdealItem.courierCost*1.1236,2))
|
419 |
sheet.write(sheet_iterator, 9, round(snapdealItem.courierCost*1.1236,2))
|
| - |
|
420 |
sheet_iterator+=1
|
| 420 |
|
421 |
|
| 421 |
filename = "/tmp/snapdeal-tp-reconciliation-" + str(datetime.now()) + ".xls"
|
422 |
filename = "/tmp/snapdeal-tp-reconciliation-" + str(datetime.now()) + ".xls"
|
| 422 |
wbk.save(filename)
|
423 |
wbk.save(filename)
|
| 423 |
|
424 |
|
| 424 |
try:
|
425 |
try:
|
| Line 437... |
Line 438... |
| 437 |
#recipients = ['rajneesh.arora@saholic.com','rajveer.singh@saholic.com','vikram.raghav@saholic.com','kshitij.sood@saholic.com','khushal.bhatia@saholic.com','chaitnaya.vats@saholic.com','chandan.kumar@saholic.com','manoj.kumar@saholic.com','yukti.jain@saholic.com','ankush.dhingra@saholic.com','manoj.pal@saholic.com']
|
438 |
#recipients = ['rajneesh.arora@saholic.com','rajveer.singh@saholic.com','vikram.raghav@saholic.com','kshitij.sood@saholic.com','khushal.bhatia@saholic.com','chaitnaya.vats@saholic.com','chandan.kumar@saholic.com','manoj.kumar@saholic.com','yukti.jain@saholic.com','ankush.dhingra@saholic.com','manoj.pal@saholic.com']
|
| 438 |
msg['To'] = ",".join(recipients)
|
439 |
msg['To'] = ",".join(recipients)
|
| 439 |
fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
|
440 |
fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
|
| 440 |
fileMsg.set_payload(file(filename).read())
|
441 |
fileMsg.set_payload(file(filename).read())
|
| 441 |
email.encoders.encode_base64(fileMsg)
|
442 |
email.encoders.encode_base64(fileMsg)
|
| 442 |
fileMsg.add_header('Content-Disposition','attachment;filename=snapdeal.xls')
|
443 |
fileMsg.add_header('Content-Disposition','attachment;filename=snapdeal_tp_recon.xls')
|
| 443 |
msg.attach(fileMsg)
|
444 |
msg.attach(fileMsg)
|
| 444 |
try:
|
445 |
try:
|
| 445 |
smtpServer.sendmail(sender, recipients, msg.as_string())
|
446 |
smtpServer.sendmail(sender, recipients, msg.as_string())
|
| 446 |
print "Successfully sent email"
|
447 |
print "Successfully sent email"
|
| 447 |
except:
|
448 |
except:
|