Merge branch 'SU2-26' of DAAntipenko/finreport-analyzer into develop
This commit is contained in:
@@ -96,5 +96,16 @@ module ReportParsers
|
||||
.gsub(/[«»]/, '')
|
||||
.strip
|
||||
end
|
||||
|
||||
def normalize_line_name(value)
|
||||
text = value.to_s
|
||||
.tr("\u00A0", ' ')
|
||||
.gsub(/[⁰¹²³⁴⁵⁶⁷⁸⁹]/, '')
|
||||
.gsub(/(?<=\p{L})\d{1,2}(?=\s|\z)/u, '')
|
||||
.gsub(/\s+/, ' ')
|
||||
.strip
|
||||
|
||||
text.presence
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@ module ReportParsers
|
||||
class Form11Parser < BaseParser
|
||||
SHEET_NAME = 'Бухгалтерский баланс'
|
||||
FORM_CODE = '1.1'
|
||||
# Add line codes or names that should be skipped during parsing.
|
||||
IGNORED_KEYS = [2].freeze
|
||||
|
||||
def call
|
||||
@@ -27,7 +26,7 @@ module ReportParsers
|
||||
end
|
||||
|
||||
all_rows = (header_row + 1).upto(sheet.last_row).filter_map do |row|
|
||||
line_name = read_cell(sheet, row, columns[:name_column])
|
||||
line_name = normalize_line_name(read_cell(sheet, row, columns[:name_column]))
|
||||
line_code = read_cell(sheet, row, columns[:code_column]).to_s.strip.presence
|
||||
next if ignored_row?(line_name, line_code)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ module ReportParsers
|
||||
end
|
||||
|
||||
all_rows = (header_row + 1).upto(sheet.last_row).filter_map do |row|
|
||||
line_name = read_cell(sheet, row, columns[:name_column])
|
||||
line_name = normalize_line_name(read_cell(sheet, row, columns[:name_column]))
|
||||
line_code = read_cell(sheet, row, columns[:code_column]).to_s.strip.presence
|
||||
next if ignored_row?(line_name, line_code)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ module ReportParsers
|
||||
end
|
||||
|
||||
all_rows = (header_row + 1).upto(sheet.last_row).filter_map do |row|
|
||||
line_name = read_cell(sheet, row, columns[:name_column])
|
||||
line_name = normalize_line_name(read_cell(sheet, row, columns[:name_column]))
|
||||
line_code = read_cell(sheet, row, columns[:code_column]).to_s.strip.presence
|
||||
next if ignored_row?(line_name, line_code)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user