Subversion Repositories SmartDukaan

Rev

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

Rev 17033 Rev 17053
Line 1227... Line 1227...
1227
    getUserOrders()
1227
    getUserOrders()
1228
    sendmail(["amit.gupta@shop2020.in","rajneesh.arora@saholic.com","manish.sharma@shop2020.in"], message, "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME, XLS_SC_FILENAME)
1228
    sendmail(["amit.gupta@shop2020.in","rajneesh.arora@saholic.com","manish.sharma@shop2020.in"], message, "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME, XLS_SC_FILENAME)
1229
    #sendmail(["amit.gupta@shop2020.in"], "", "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME, XLS_SC_FILENAME)
1229
    #sendmail(["amit.gupta@shop2020.in"], "", "Affiliate Reco", XLS_FILENAME, XLS_F_FILENAME, XLS_A_FILENAME, XLS_SC_FILENAME)
1230
    sendmail(["amit.gupta@shop2020.in", "rajneesh.arora@saholic.com", "chaitnaya.vats@saholic.com", "manoj.kumar@saholic.com", "manish.sharma@shop2020.in"], "", "All DTR Orders", XLS_O_FILENAME)
1230
    sendmail(["amit.gupta@shop2020.in", "rajneesh.arora@saholic.com", "chaitnaya.vats@saholic.com", "manoj.kumar@saholic.com", "manish.sharma@shop2020.in"], "", "All DTR Orders", XLS_O_FILENAME)
1231
    
1231
    
-
 
1232
def main3():
-
 
1233
    db = client.Dtr
-
 
1234
    #main()
-
 
1235
    mailBodyTemplate="""
-
 
1236
        <html>
-
 
1237
            <body>
-
 
1238
            <table cellspacing="0" border="1" style="text-align:right">
-
 
1239
                <thead>
-
 
1240
                    <tr>
-
 
1241
                        <th style="text-align:center">Date</th>
-
 
1242
                        <th  style="text-align:center">Sale</th>
-
 
1243
                        <th  style="text-align:center">Approved</th>
-
 
1244
                        <th  style="text-align:center">Approved %</th>
-
 
1245
                        <th  style="text-align:center">Rejected</th>
-
 
1246
                        <th  style="text-align:center">Rejected %</th>
-
 
1247
                        <th  style="text-align:center">Missing %</th>
-
 
1248
                        <th  style="text-align:center">Approved % against Sale</th>
-
 
1249
                    </tr>
-
 
1250
                </thead>
-
 
1251
                <tbody>
-
 
1252
                    {0}
-
 
1253
                </tbody>
-
 
1254
            </table>
-
 
1255
            </body>
-
 
1256
        </html>
1232
    
1257
    """
-
 
1258
    tbody=[]
-
 
1259
    rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td><td>{7}</td></tr>"
-
 
1260
    for offer in db.flSaleSnapshot.find().limit(61).sort("_id",-1):
-
 
1261
        approved = offer.get("approvedAmount")
-
 
1262
        rejected = offer.get("rejectedAmount")
-
 
1263
        sale = offer.get("paidAmount")
-
 
1264
        total = approved + rejected
-
 
1265
        if total ==0:
-
 
1266
            continue
-
 
1267
        tbody.append(rowtemplate.format(offer.get("_id"), sale, approved, int((approved*100/total)), rejected, int((rejected*100/total)), int((sale-approved-rejected)*100/sale),int((approved)*100/sale)))
-
 
1268
    message = mailBodyTemplate.format("".join(tbody))
-
 
1269
    print message
1233
def main2():
1270
def main2():
1234
    db = client.Dtr
1271
    db = client.Dtr
1235
    curs = getOrdersAfterDate(datetime.now() - timedelta(days=1), 3)
1272
    curs = getOrdersAfterDate(datetime.now() - timedelta(days=46), 3)
1236
    datemap={}
1273
    datemap={}
1237
    for row1 in curs:
1274
    for row1 in curs:
1238
        orderId = row1[0]
1275
        orderId = row1[0]
1239
        order = db.merchantOrder.find_one({"orderId":orderId})
1276
        order = db.merchantOrder.find_one({"orderId":orderId})
1240
        if order is None:
1277
        if order is None:
Line 1250... Line 1287...
1250
            
1287
            
1251
        obj = datemap.get(saleTime)
1288
        obj = datemap.get(saleTime)
1252
        obj['paidAmount'] += order["paidAmount"]
1289
        obj['paidAmount'] += order["paidAmount"]
1253
        obj['count'] += 1
1290
        obj['count'] += 1
1254
        
1291
        
1255
    for offer in db.snapdealOrderAffiliateInfo1.find({"saleDate":{"$gte":toTimeStamp(datetime.now() - timedelta(days=1))}}):
1292
    for offer in db.snapdealOrderAffiliateInfo1.find({"saleDate":{"$gte":toTimeStamp(datetime.now() - timedelta(days=46))}}):
1256
        saleTime =  utils.fromTimeStamp(offer.get('saleDate')).strftime("%Y-%m-%d")
1293
        saleTime =  utils.fromTimeStamp(offer.get('saleDate')).strftime("%Y-%m-%d")
1257
        obj = datemap.get(saleTime)
1294
        obj = datemap.get(saleTime)
1258
        if obj is not None:
1295
        if obj is not None:
1259
            try:
1296
            try:
1260
                if offer.get("payOut"):
1297
                if offer.get("payOut"):
Line 1272... Line 1309...
1272
        db.flSaleSnapshot.save(valmap)
1309
        db.flSaleSnapshot.save(valmap)
1273
 
1310
 
1274
if __name__ == '__main__':
1311
if __name__ == '__main__':
1275
    main2()
1312
    main2()
1276
    main()
1313
    main()
1277
 
-
 
1278
    
-
 
1279
1314