amount sum col
Showing
1 changed file
with
12 additions
and
4 deletions
... | @@ -417,13 +417,14 @@ class BSWorkbook(Workbook): | ... | @@ -417,13 +417,14 @@ class BSWorkbook(Workbook): |
417 | for i in range(max_column - src_header_len): | 417 | for i in range(max_column - src_header_len): |
418 | header.append(None) | 418 | header.append(None) |
419 | 419 | ||
420 | add_col = ['核对结果'] | 420 | add_col = ['核对结果', '合计'] |
421 | if amount_cell_idx is None: | 421 | if amount_cell_idx is None: |
422 | if income_cell_idx is not None or outlay_cell_idx is not None: | 422 | if income_cell_idx is not None or outlay_cell_idx is not None: |
423 | add_col = ['金额', '核对结果'] | 423 | add_col = ['金额', '核对结果', '合计'] |
424 | amount_cell_idx = len(header) | 424 | amount_cell_idx = len(header) |
425 | header.extend(add_col) | 425 | header.extend(add_col) |
426 | result_idx = len(header) - 1 | 426 | result_idx = len(header) - 2 |
427 | amount_sum_idx = len(header) - 1 | ||
427 | 428 | ||
428 | tmp_ws = self.create_sheet('tmp_ws') | 429 | tmp_ws = self.create_sheet('tmp_ws') |
429 | tmp2_ws = self.create_sheet('tmp2_ws') | 430 | tmp2_ws = self.create_sheet('tmp2_ws') |
... | @@ -478,7 +479,9 @@ class BSWorkbook(Workbook): | ... | @@ -478,7 +479,9 @@ class BSWorkbook(Workbook): |
478 | fill_row.add(summary_cell.row) | 479 | fill_row.add(summary_cell.row) |
479 | 480 | ||
480 | # 户名高亮 | 481 | # 户名高亮 |
482 | row_num = 2 | ||
481 | for cell in rows: | 483 | for cell in rows: |
484 | row_num = cell.row | ||
482 | if cell.value == role_name: | 485 | if cell.value == role_name: |
483 | fill_row.add(summary_cell.row) | 486 | fill_row.add(summary_cell.row) |
484 | break | 487 | break |
... | @@ -529,8 +532,8 @@ class BSWorkbook(Workbook): | ... | @@ -529,8 +532,8 @@ class BSWorkbook(Workbook): |
529 | amount_cell.value, set()).add(amount_cell.row) | 532 | amount_cell.value, set()).add(amount_cell.row) |
530 | 533 | ||
531 | # 3.5.核对结果 | 534 | # 3.5.核对结果 |
535 | amount_col_letter = get_column_letter(amount_cell_idx + 1) | ||
532 | if amount_success and over_success and amount_cell.row > 2: | 536 | if amount_success and over_success and amount_cell.row > 2: |
533 | amount_col_letter = get_column_letter(amount_cell_idx + 1) | ||
534 | over_col_letter = get_column_letter(over_cell_idx + 1) | 537 | over_col_letter = get_column_letter(over_cell_idx + 1) |
535 | if is_reverse: | 538 | if is_reverse: |
536 | rows[result_idx].value = '=IF({2}{0}=ROUND(SUM({2}{1},{3}{0}),4), "{4}", "{5}")'.format( | 539 | rows[result_idx].value = '=IF({2}{0}=ROUND(SUM({2}{1},{3}{0}),4), "{4}", "{5}")'.format( |
... | @@ -539,6 +542,11 @@ class BSWorkbook(Workbook): | ... | @@ -539,6 +542,11 @@ class BSWorkbook(Workbook): |
539 | rows[result_idx].value = '=IF({2}{0}=ROUND(SUM({2}{1},{3}{0}),4), "{4}", "{5}")'.format( | 542 | rows[result_idx].value = '=IF({2}{0}=ROUND(SUM({2}{1},{3}{0}),4), "{4}", "{5}")'.format( |
540 | amount_cell.row, amount_cell.row - 1, over_col_letter, amount_col_letter, *self.proof_res) | 543 | amount_cell.row, amount_cell.row - 1, over_col_letter, amount_col_letter, *self.proof_res) |
541 | 544 | ||
545 | # 3.6 金额合计列 | ||
546 | amount_sum_letter = get_column_letter(amount_sum_idx + 1) | ||
547 | rows[amount_sum_idx].value = '=SUM({0}{1},{2}{3})'.format( | ||
548 | amount_sum_letter, row_num - 1, amount_col_letter, row_num) | ||
549 | |||
542 | # 3.2.提取信息、高亮 | 550 | # 3.2.提取信息、高亮 |
543 | # row = summary_cell.row | 551 | # row = summary_cell.row |
544 | if summary_cell is not None: | 552 | if summary_cell is not None: | ... | ... |
-
Please register or sign in to post a comment