Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
990f670c
authored
2021-06-23 11:28:41 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'feature/bs_excel' into feature/0611
2 parents
dc09a784
3802c621
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
src/apps/doc/ocr/wb.py
src/apps/doc/ocr/wb.py
View file @
990f670
...
...
@@ -339,6 +339,11 @@ class BSWorkbook(Workbook):
ms
=
self
.
create_sheet
(
'{0}{1}({2})'
.
format
(
self
.
meta_sheet_title
,
role_name
,
card
))
for
row
in
metadata_rows
:
ms
.
append
(
row
)
if
res_count_tuple
[
0
]
!=
res_count_tuple
[
1
]:
for
cell
in
ms
[
2
]:
cell
.
fill
=
self
.
amount_fill
for
cell
in
ms
[
3
]:
cell
.
fill
=
self
.
amount_fill
return
ms
@staticmethod
...
...
@@ -419,14 +424,20 @@ class BSWorkbook(Workbook):
for
i
in
range
(
max_column
-
src_header_len
):
header
.
append
(
None
)
add_col
=
[
'核对结果'
,
'合计'
]
# 3.6 金额合计列
add_col
=
[
'核对结果'
]
if
amount_cell_idx
is
None
:
if
income_cell_idx
is
not
None
or
outlay_cell_idx
is
not
None
:
add_col
=
[
'金额'
,
'核对结果'
,
'合计'
]
add_col
=
[
'金额'
,
'核对结果'
]
amount_cell_idx
=
len
(
header
)
amount_col_letter
=
get_column_letter
(
amount_cell_idx
+
1
)
if
isinstance
(
amount_cell_idx
,
int
)
else
None
amount_sum
=
'=SUBTOTAL(9,{0}:{0})'
.
format
(
amount_col_letter
)
if
isinstance
(
amount_cell_idx
,
int
)
else
''
add_col
.
append
(
'合计'
)
add_col
.
append
(
amount_sum
)
header
.
extend
(
add_col
)
result_idx
=
len
(
header
)
-
2
amount_sum_idx
=
len
(
header
)
-
1
result_idx
=
len
(
header
)
-
3
tmp_ws
=
self
.
create_sheet
(
'tmp_ws'
)
tmp2_ws
=
self
.
create_sheet
(
'tmp2_ws'
)
...
...
@@ -484,7 +495,7 @@ class BSWorkbook(Workbook):
row_num
=
2
for
cell
in
rows
:
row_num
=
cell
.
row
if
cell
.
value
==
role_name
:
if
isinstance
(
cell
.
value
,
str
)
and
cell
.
value
.
find
(
role_name
)
!=
-
1
:
fill_row
.
add
(
summary_cell
.
row
)
break
...
...
@@ -534,7 +545,6 @@ class BSWorkbook(Workbook):
amount_cell
.
value
,
set
())
.
add
(
amount_cell
.
row
)
# 3.5.核对结果
amount_col_letter
=
get_column_letter
(
amount_cell_idx
+
1
)
if
amount_success
and
over_success
and
amount_cell
.
row
>
2
:
over_col_letter
=
get_column_letter
(
over_cell_idx
+
1
)
if
is_reverse
:
...
...
@@ -544,11 +554,6 @@ class BSWorkbook(Workbook):
rows
[
result_idx
]
.
value
=
'=IF({2}{0}=ROUND(SUM({2}{1},{3}{0}),4), "{4}", "{5}")'
.
format
(
amount_cell
.
row
,
amount_cell
.
row
-
1
,
over_col_letter
,
amount_col_letter
,
*
self
.
proof_res
)
# 3.6 金额合计列
amount_sum_letter
=
get_column_letter
(
amount_sum_idx
+
1
)
rows
[
amount_sum_idx
]
.
value
=
'=SUM({0}{1},{2}{3})'
.
format
(
amount_sum_letter
,
row_num
-
1
,
amount_col_letter
,
row_num
)
# 3.2.提取信息、高亮
# row = summary_cell.row
if
summary_cell
is
not
None
:
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment