Subversion Repositories SmartDukaan

Rev

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

Rev 17160 Rev 17173
Line 216... Line 216...
216
        
216
        
217
        message_by_brand = mailBodyTemplate_brand.format("".join(tbody))
217
        message_by_brand = mailBodyTemplate_brand.format("".join(tbody))
218
        
218
        
219
        # Data by Store
219
        # 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;")
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;")
221
        cur.execute("select name, c.* from store left join (select a.*, b.mtdamount,b.mtdquantity, b.mtdorders from  (select store_id, sum(amount_paid), count(*),  count(distinct order_id)  from allorder where date(created_on)=curdate()-interval 1 day group by store_id) a join (select store_id, sum(amount_paid) mtdamount, count(*) mtdquantity,  count(distinct order_id) mtdorders  from allorder where created_on >= CURDATE() -  interval DAY(CURDATE()-INTERVAL 1 day) day group by store_id) b on a.store_id=b.store_id) as c on name = c.store_id")
221
        cur.execute("select name, c.* from store left join (select b.store_id, a.amount, a.quantity, a.orders, b.mtdamount,b.mtdquantity, b.mtdorders from   (select store_id, sum(amount_paid) mtdamount, count(*) mtdquantity,  count(distinct order_id) mtdorders  from allorder where created_on >= CURDATE() -  interval DAY(CURDATE()-INTERVAL 1 day) day group by store_id) b left join  (select store_id, sum(amount_paid) amount, count(*) quantity,  count(distinct order_id) orders  from allorder where date(created_on)=curdate()-interval 1 day group by store_id) a   on a.store_id=b.store_id) as c on name = c.store_id")
222
        rows = cur.fetchall()
222
        rows = cur.fetchall()
223
        tbody =[]
223
        tbody =[]
224
        rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>"
224
        rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>"
225
        for data in rows:
225
        for data in rows:
226
            tbody.append(rowtemplate.format(data[0],data[2] if data[2] else "-",data[3] if data[3] else "-",data[4] if data[4] else "-",
226
            tbody.append(rowtemplate.format(data[0],data[2] if data[2] else "-",data[3] if data[3] else "-",data[4] if data[4] else "-",