Subversion Repositories SmartDukaan

Rev

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

Rev 17211 Rev 17218
Line 94... Line 94...
94
                        product_title= subOrder.get("productTitle")
94
                        product_title= subOrder.get("productTitle")
95
                        referrer =  result[9]
95
                        referrer =  result[9]
96
                        amount_paid = int(subOrder.get("amountPaid"))
96
                        amount_paid = int(subOrder.get("amountPaid"))
97
                        quantity=int(subOrder.get("quantity"))
97
                        quantity=int(subOrder.get("quantity"))
98
                        skuData = getSkuData(morder.get("storeId"), subOrder.get("productCode"))
98
                        skuData = getSkuData(morder.get("storeId"), subOrder.get("productCode"))
99
                        if morder.get("storeId") in (1,2,4,5):
-
 
100
                            skuData = db1.MasterData.find_one({'identifier':subOrder.get("productCode").strip(), 'source_id':morder.get("storeId")})
-
 
101
                        elif morder.get("storeId") == 3:
99
                        if morder.get("storeId") == 3:
102
                            skuData = db1.MasterData.find_one({'secondaryIdentifier':subOrder.get("productCode").strip(), 'source_id':morder.get("storeId")})
100
                            skuData = db1.MasterData.find_one({'secondaryIdentifier':subOrder.get("productCode").strip(), 'source_id':morder.get("storeId")})
-
 
101
                        else:
-
 
102
                            skuData = db1.MasterData.find_one({'identifier':subOrder.get("productCode").strip(), 'source_id':morder.get("storeId")})
103
                        if skuData is not None:
103
                        if skuData is not None:
104
                            catalog_id = skuData.get("skuBundleId")
104
                            catalog_id = skuData.get("skuBundleId")
105
                            brand= skuData.get("brand")
105
                            brand= skuData.get("brand")
106
                            model = skuData.get("model_name")
106
                            model = skuData.get("model_name")
107
                            category = skuData.get("category")
107
                            category = skuData.get("category")
Line 130... Line 130...
130
                        print user_id
130
                        print user_id
131
                        values = (user_id, user_name, order_id, created_on, store_id, merchant_order_id, status, detailed_status, product_title, referrer, amount_paid, catalog_id, brand, model,category, deal_rank, max_nlc, min_nlc, dp, item_status, city, state, pincode,merchant_suborder_id,cashback_status,cashback_amount, quantity)
131
                        values = (user_id, user_name, order_id, created_on, store_id, merchant_order_id, status, detailed_status, product_title, referrer, amount_paid, catalog_id, brand, model,category, deal_rank, max_nlc, min_nlc, dp, item_status, city, state, pincode,merchant_suborder_id,cashback_status,cashback_amount, quantity)
132
                        cur.execute(query,values)     
132
                        cur.execute(query,values)     
133
                        con.commit()
133
                        con.commit()
134
    except _mysql.Error, e:
134
    except _mysql.Error, e:
135
       
-
 
136
        print "Error %d: %s" % (e.args[0], e.args[1])
135
        print "Error %d: %s" % (e.args[0], e.args[1])
137
        sys.exit(1)
136
        sys.exit(1)
138
     
137
     
139
    finally:
138
    finally:
140
         
139
         
Line 219... Line 218...
219
        # Data by Store
218
        # Data by Store
220
        # cur.execute("select store_id store,sum(amount_paid) amount,count(store_id) quantity ,count(distinct order_id) from allorder group by store_id order by store_id ASC;")
219
        # cur.execute("select store_id store,sum(amount_paid) amount,count(store_id) quantity ,count(distinct order_id) from allorder group by store_id order by store_id ASC;")
221
        cur.execute('''
220
        cur.execute('''
222
            select name, c.* from store left join (select b.store_id, a.amount, a.quantity, a.orders, b.mtdamount,b.mtdquantity, b.mtdorders from   
221
            select name, c.* from store left join (select b.store_id, a.amount, a.quantity, a.orders, b.mtdamount,b.mtdquantity, b.mtdorders from   
223
            (select ifnull(store_id, 'total') as store_id, sum(amount_paid) mtdamount, count(*) mtdquantity,  count(distinct order_id) mtdorders  from allorder 
222
            (select ifnull(store_id, 'total') as store_id, sum(amount_paid) mtdamount, count(*) mtdquantity,  count(distinct order_id) mtdorders  from allorder 
224
                where created_on >= CURDATE() -  interval DAY(CURDATE()-INTERVAL 1 day) day and created_on < CURDATE() - interval 1 day group by store_id with rollup) b 
223
                where created_on >= CURDATE() -  interval DAY(CURDATE()-INTERVAL 1 day) day and created_on < CURDATE() group by store_id with rollup) b 
225
            left join  
224
            left join  
226
            (select ifnull(store_id, 'total') as store_id, sum(amount_paid) amount, count(*) quantity,  count(distinct order_id) orders  from allorder 
225
            (select ifnull(store_id, 'total') as store_id, sum(amount_paid) amount, count(*) quantity,  count(distinct order_id) orders  from allorder 
227
                where date(created_on)=curdate()-interval 1 day group by store_id with rollup) a   
226
                where date(created_on)=curdate() day group by store_id with rollup) a   
228
            on a.store_id=b.store_id) as c on name = c.store_id''')
227
            on a.store_id=b.store_id) as c on name = c.store_id''')
229
        rows = cur.fetchall()
228
        rows = cur.fetchall()
230
        tbody =[]
229
        tbody =[]
231
        rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>"
230
        rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>"
232
        for data in rows:
231
        for data in rows: