Subversion Repositories SmartDukaan

Rev

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

Rev 17153 Rev 17154
Line 223... Line 223...
223
        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")
223
        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")
224
        rows = cur.fetchall()
224
        rows = cur.fetchall()
225
        tbody =[]
225
        tbody =[]
226
        rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>"
226
        rowtemplate="<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>"
227
        for data in rows:
227
        for data in rows:
228
            tbody.append(rowtemplate.format(data[4],data[1],data[2],data[3],data[5],data[6],data[7]))
228
            tbody.append(rowtemplate.format(data[0],data[2],data[3],data[4],data[5],data[6],data[7]))
229
                        
229
                        
230
        # book.save("/home/manish/Desktop/Summary.xls")
230
        # book.save("/home/manish/Desktop/Summary.xls")
231
        
231
        
232
        mailBodyTemplate="""
232
        mailBodyTemplate="""
233
                <html>
233
                <html>
Line 236... Line 236...
236
                        <thead>
236
                        <thead>
237
                            <tr>
237
                            <tr>
238
                                <th colspan='7' style="text-align:center">Summary by Store</th>
238
                                <th colspan='7' style="text-align:center">Summary by Store</th>
239
                            </tr>
239
                            </tr>
240
                            <tr>
240
                            <tr>
241
                                <th style="text-align:center">Brand</th>
241
                                <th style="text-align:center">Store</th>
242
                                <th  style="text-align:center">Amount</th>
242
                                <th  style="text-align:center">Amount</th>
243
                                <th  style="text-align:center">Quantity</th>
243
                                <th  style="text-align:center">Quantity</th>
244
                                <th  style="text-align:center">Number of Order</th>
244
                                <th  style="text-align:center">Number of Order</th>
245
                                <th  style="text-align:center">MTD Amount</th>
245
                                <th  style="text-align:center">MTD Amount</th>
246
                                <th  style="text-align:center">MTD Quantity</th>
246
                                <th  style="text-align:center">MTD Quantity</th>