Убрать лишние символы при отображении отчетностей
This commit is contained in:
@@ -96,5 +96,16 @@ module ReportParsers
|
|||||||
.gsub(/[«»]/, '')
|
.gsub(/[«»]/, '')
|
||||||
.strip
|
.strip
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ module ReportParsers
|
|||||||
class Form11Parser < BaseParser
|
class Form11Parser < BaseParser
|
||||||
SHEET_NAME = 'Бухгалтерский баланс'
|
SHEET_NAME = 'Бухгалтерский баланс'
|
||||||
FORM_CODE = '1.1'
|
FORM_CODE = '1.1'
|
||||||
# Add line codes or names that should be skipped during parsing.
|
|
||||||
IGNORED_KEYS = [2].freeze
|
IGNORED_KEYS = [2].freeze
|
||||||
|
|
||||||
def call
|
def call
|
||||||
@@ -27,7 +26,7 @@ module ReportParsers
|
|||||||
end
|
end
|
||||||
|
|
||||||
all_rows = (header_row + 1).upto(sheet.last_row).filter_map do |row|
|
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
|
line_code = read_cell(sheet, row, columns[:code_column]).to_s.strip.presence
|
||||||
next if ignored_row?(line_name, line_code)
|
next if ignored_row?(line_name, line_code)
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module ReportParsers
|
|||||||
end
|
end
|
||||||
|
|
||||||
all_rows = (header_row + 1).upto(sheet.last_row).filter_map do |row|
|
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
|
line_code = read_cell(sheet, row, columns[:code_column]).to_s.strip.presence
|
||||||
next if ignored_row?(line_name, line_code)
|
next if ignored_row?(line_name, line_code)
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module ReportParsers
|
|||||||
end
|
end
|
||||||
|
|
||||||
all_rows = (header_row + 1).upto(sheet.last_row).filter_map do |row|
|
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
|
line_code = read_cell(sheet, row, columns[:code_column]).to_s.strip.presence
|
||||||
next if ignored_row?(line_name, line_code)
|
next if ignored_row?(line_name, line_code)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user