Subversion Repositories SmartDukaan

Rev

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

Rev 2330 Rev 4023
Line 214... Line 214...
214
        session.commit()
214
        session.commit()
215
    
215
    
216
    print "Successfully updated the item list information."
216
    print "Successfully updated the item list information."
217
 
217
 
218
def write_report(filename, items, sheet, is_item):
218
def write_report(filename, items, sheet, is_item):
-
 
219
    '''
-
 
220
    Iterates through the items list and writes all the values to the specified
-
 
221
    filename in the CSV format. 'is_item' indicates whether the list consists
-
 
222
    of row numbers or complete row data.
-
 
223
    '''
219
    items_writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_ALL)
224
    items_writer = csv.writer(open(filename, "wb"), delimiter=',', quoting=csv.QUOTE_ALL)
220
    items_writer.writerow(sheet.row_values(0) + ['Old MRP', 'Old DP', 'Old TP'])
225
    items_writer.writerow(sheet.row_values(0) + ['Old MRP', 'Old DP', 'Old TP'])
221
    if is_item:
226
    if is_item:
-
 
227
        #The list contains the complete rows.
222
        for item in items:
228
        for item in items:
223
            print item
229
            print item
224
            items_writer.writerow([str(value) for value in item])
230
            items_writer.writerow([str(value) for value in item])
225
    else:
231
    else:
-
 
232
        #The list only has row numbers. We've to fetch the data ourselves.
226
        for i in items:
233
        for i in items:
227
            print sheet.row_values(i)
234
            print sheet.row_values(i)
228
            items_writer.writerow([str(value) for value in sheet.row_values(i)])
235
            items_writer.writerow([str(value) for value in sheet.row_values(i)])
229
 
236
 
230
def main():
237
def main():