Subversion Repositories SmartDukaan

Rev

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

Rev 13059 Rev 13060
Line 111... Line 111...
111
                and o.created_timestamp between CURDATE() - INTERVAL DAY(CURDATE())-1 DAY and CURDATE() order by orderedon desc, c.code 
111
                and o.created_timestamp between CURDATE() - INTERVAL DAY(CURDATE())-1 DAY and CURDATE() order by orderedon desc, c.code 
112
                """
112
                """
113
date_format = xlwt.XFStyle()
113
date_format = xlwt.XFStyle()
114
date_format.num_format_str = 'dd/mm/yyyy'
114
date_format.num_format_str = 'dd/mm/yyyy'
115
 
115
 
-
 
116
datetime_format = xlwt.XFStyle()
-
 
117
datetime_format.num_format_str = 'dd/mm/yyyy HH:MM AM/PM'
-
 
118
 
116
number_format = xlwt.XFStyle()
119
number_format = xlwt.XFStyle()
117
number_format.num_format_str = '#,##0'
120
number_format.num_format_str = '#,##0'
118
 
121
 
119
 
122
 
120
 
123
 
Line 249... Line 252...
249
    
252
    
250
        for r in result:
253
        for r in result:
251
            row += 1
254
            row += 1
252
            column = 0
255
            column = 0
253
            for data in r :
256
            for data in r :
254
                worksheet.write(row, column, int(data) if type(data) is float else data, date_format if type(data) is datetime.date else default_format)
257
                worksheet.write(row, column, int(data) if type(data) is float else data, date_format if type(data) is datetime.date else datetime_format if type(data) is datetime.datetime else default_format)
255
                column += 1
258
                column += 1
256
        workbook.save(TMP_FILE)
259
        workbook.save(TMP_FILE)
257
        
260
        
258
    except Exception:
261
    except Exception:
259
        traceback.print_exc()
262
        traceback.print_exc()
Line 311... Line 314...
311
        # Execute the SQL command
314
        # Execute the SQL command
312
        # Fetch source id.
315
        # Fetch source id.
313
        cursor.execute(selectSql)
316
        cursor.execute(selectSql)
314
        result = cursor.fetchall()
317
        result = cursor.fetchall()
315
        workbook = xlwt.Workbook()
318
        workbook = xlwt.Workbook()
316
        worksheet = workbook.add_sheet("Pending Orders")
319
        worksheet = workbook.add_sheet("Stock Aeging Orders")
317
        boldStyle = xlwt.XFStyle()
320
        boldStyle = xlwt.XFStyle()
318
        f = xlwt.Font()
321
        f = xlwt.Font()
319
        f.bold = True
322
        f.bold = True
320
        boldStyle.font = f
323
        boldStyle.font = f
321
        column = 0
324
        column = 0