SU2-33 | Отображение пояснений
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class OrganisationsController < ApplicationController
|
||||
before_action :set_organisation, only: [:show, :destroy, :reload]
|
||||
before_action :set_organisation, :set_report_codes, only: [:show, :destroy, :reload]
|
||||
|
||||
DOC_TYPES = {
|
||||
0 => { title: 'Бухгалтерский баланс', form_code: '1.1' },
|
||||
@@ -37,7 +37,9 @@ class OrganisationsController < ApplicationController
|
||||
@doc_name = selected_doc[:title]
|
||||
@current_doc_info1 = grouped_rows[@doc_name]
|
||||
if !@current_doc_info1.values.first.nil?
|
||||
@current_doc_info = @info_about_organisation[@doc_name][0..@current_doc_info1.values.first.size + 1]
|
||||
number_of_columns = @current_doc_info1.values.first.size + 1
|
||||
number_of_columns += 1 if @type_doc < 2
|
||||
@current_doc_info = @info_about_organisation[@doc_name][0..number_of_columns]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,6 +61,10 @@ class OrganisationsController < ApplicationController
|
||||
@org = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def set_report_codes
|
||||
@report_codes = ReportCode.all.filter_map { |report_code| [report_code.code, report_code.description] if report_code.code.match?(/\A[12]/) }.to_h
|
||||
end
|
||||
|
||||
def build_organization_payload(years)
|
||||
russian_names = {
|
||||
'inn' => 'ИНН',
|
||||
@@ -77,7 +83,9 @@ class OrganisationsController < ApplicationController
|
||||
}
|
||||
|
||||
DOC_TYPES.each_value do |doc_type|
|
||||
payload[doc_type[:title]] = ['Наименование показателя', 'Код'] + years.map do |year|
|
||||
first_headers = ['Наименование показателя', 'Код']
|
||||
first_headers << 'Пояснения' if ['Бухгалтерский баланс', 'Отчёт о финансовых результатах'].include?(doc_type[:title])
|
||||
payload[doc_type[:title]] = first_headers + years.map do |year|
|
||||
column_header_for(doc_type[:form_code], year)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user