Subversion Repositories SmartDukaan

Rev

Rev 11265 | Rev 12146 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11265 Rev 11772
Line 129... Line 129...
129
    response = br.open(url)
129
    response = br.open(url)
130
    dataform = str(response.read()).strip("'<>() ").replace('\'', '\"')
130
    dataform = str(response.read()).strip("'<>() ").replace('\'', '\"')
131
    struct = json.loads(dataform)
131
    struct = json.loads(dataform)
132
    sdObj = struct['rows'][0]
132
    sdObj = struct['rows'][0]
133
    print sdObj
133
    print sdObj
-
 
134
    if type(sdObj['catalogLive']) is None or not (sdObj['catalogLive']):
-
 
135
        raise
134
    snapdealInfo = __SnapdealInfo(None,None,None,None,None,None,sdObj['sellingPrice'],sdObj['netSellerPayable'],sdObj['fixedMarginAmount'],sdObj['fixedMarginPercent'],sdObj['collectionCharges'],sdObj['logisticCost'],sdObj['deadWeight'],supc,None, \
136
    snapdealInfo = __SnapdealInfo(None,None,None,None,None,None,sdObj['sellingPrice'],sdObj['netSellerPayable'],sdObj['fixedMarginAmount'],sdObj['fixedMarginPercent'],sdObj['collectionCharges'],sdObj['logisticCost'],sdObj['deadWeight'],supc,None, \
135
                    None, None, None, None, None, None, None,sdObj['woodenPackagingCost'])
137
                    None, None, None, None, None, None, None,sdObj['woodenPackagingCost'])
136
    return snapdealInfo
138
    return snapdealInfo
137
 
139
 
138
def filterData(fetchedItems):
140
def filterData(fetchedItems):
Line 228... Line 230...
228
            <td style="text-align:center">"""+str(round(data.logisticCostSnapdeal,2)+round(data.woodenPackagingCost,2))+"""</td>
230
            <td style="text-align:center">"""+str(round(data.logisticCostSnapdeal,2)+round(data.woodenPackagingCost,2))+"""</td>
229
            <td style="text-align:center">"""+getReason(data)+"""</td>
231
            <td style="text-align:center">"""+getReason(data)+"""</td>
230
            </tr>"""
232
            </tr>"""
231
    message+="""</tbody></table>"""
233
    message+="""</tbody></table>"""
232
    message+="""
234
    message+="""
-
 
235
            <h3 style="color:red;font-weight:bold">Please Check</h3>
233
            <h3>Unable To Fetch Items</h3>
236
            <h3>Items not live on Snapdeal</h3>
234
            <table border="1" style="width:100%;">
237
            <table border="1" style="width:100%;">
235
            <thead>
238
            <thead>
236
            <tr><th>Item Id</th>
239
            <tr><th>Item Id</th>
237
            <th>Product Name</th>
240
            <th>Product Name</th>
238
            <th>Our System Selling Price</th>
241
            <th>Our System Selling Price</th>
Line 443... Line 446...
443
        print e
446
        print e
444
        print "Unable to send report.Trying with local SMTP"
447
        print "Unable to send report.Trying with local SMTP"
445
        smtpServer = smtplib.SMTP('localhost')
448
        smtpServer = smtplib.SMTP('localhost')
446
        smtpServer.set_debuglevel(1)
449
        smtpServer.set_debuglevel(1)
447
        sender = 'support@shop2020.in'
450
        sender = 'support@shop2020.in'
448
        recipients = ['kshitij.sood@saholic.com']
451
        #recipients = ['kshitij.sood@saholic.com']
449
        msg = MIMEMultipart()
452
        msg = MIMEMultipart()
450
        msg['Subject'] = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
453
        msg['Subject'] = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
451
        msg['From'] = sender
454
        msg['From'] = sender
452
        #recipients = ['rajneesh.arora@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','sandeep.sachdeva@saholic.com']
455
        recipients = ['rajneesh.arora@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','sandeep.sachdeva@saholic.com']
453
        msg['To'] = ",".join(recipients)
456
        msg['To'] = ",".join(recipients)
454
        fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
457
        fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
455
        fileMsg.set_payload(file(filename).read())
458
        fileMsg.set_payload(file(filename).read())
456
        email.encoders.encode_base64(fileMsg)
459
        email.encoders.encode_base64(fileMsg)
457
        fileMsg.add_header('Content-Disposition','attachment;filename=snapdeal_tp_recon.xls')
460
        fileMsg.add_header('Content-Disposition','attachment;filename=snapdeal_tp_recon.xls')