|
@@ -674,23 +674,26 @@ class serveManagement(View):
|
|
|
rd_sheet = rd_book.sheet_by_index(0)
|
|
|
# wt_book = copy(rd_book)
|
|
|
# wt_sheet = wt_book.get_sheet(0)
|
|
|
- wt_book = openpyxl.Workbook()
|
|
|
- wt_sheet = wt_book.create_sheet('对账结果', 0)
|
|
|
+ wt_book = xlwt.Workbook(encoding='utf8')
|
|
|
+ wt_sheet = wt_book.add_sheet('对账结果', cell_overwrite_ok=True)
|
|
|
+ row_start = 7
|
|
|
for row in range(rd_sheet.nrows):
|
|
|
if row == 0:
|
|
|
- wt_sheet.cell(8, 1, '是否匹配账单')
|
|
|
+ wt_sheet.write(row_start, 0, '是否匹配账单')
|
|
|
for col in range(rd_sheet.ncols):
|
|
|
value = rd_sheet.cell_value(row, col)
|
|
|
- temp_col = col + 2
|
|
|
- wt_sheet.cell(8, temp_col, value)
|
|
|
+ temp_col = col + 1
|
|
|
+ wt_sheet.write(row_start, temp_col, value)
|
|
|
+ row_start += 1
|
|
|
continue
|
|
|
transaction_id = rd_sheet.cell_value(row, 9)
|
|
|
order_qs = Order_Model.objects.filter(trade_no=transaction_id)
|
|
|
if not order_qs.exists():
|
|
|
col_value_list = rd_sheet.row_values(row)
|
|
|
col_value_list.insert(0, '否')
|
|
|
- wt_sheet.append(col_value_list)
|
|
|
-
|
|
|
+ for index, value in enumerate(col_value_list):
|
|
|
+ wt_sheet.write(row_start, index, value)
|
|
|
+ row_start += 1
|
|
|
res = HttpResponse(content_type='application/vnd.ms-excel')
|
|
|
res['Content-Disposition'] = 'attachment; filename={}'.format(escape_uri_path(file.name))
|
|
|
output = BytesIO()
|