From 7c390e9a696e84d195f33f171ae71f76fc5886f2 Mon Sep 17 00:00:00 2001 From: ARLakhin Date: Wed, 1 Apr 2026 15:06:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B5=D1=80=D0=B0=20Organization=20=D0=B8=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B=20Show=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=202=D1=85=20=D1=84=D0=BE=D1=80=D0=BC=20?= =?UTF-8?q?=D0=BE=D1=82=D1=87=D0=B5=D1=82=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D0=91=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/main.scss | 8 +-- app/controllers/organisations_controller.rb | 57 +++++++++++++++------ app/views/organisations/show.html.slim | 35 +++++++------ 3 files changed, 65 insertions(+), 35 deletions(-) diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index 0a79815..b70cad6 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -28,15 +28,17 @@ a.link:hover { .main-container { height: 100vh; + padding-bottom: 15px; } .informations-data { display: flex; flex-direction: column; - width: 80%; + width: 90%; min-width: 300px; - max-width: 1200px; - margin: 0 auto 10px; + max-width: 1400px; + margin: 0 auto; + padding-bottom: inherit; } .informations-data h2 { diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 6837851..7e68472 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -1,4 +1,6 @@ class OrganisationsController < ApplicationController + before_action :set_organisation, only: [:show] + def index organizations = Organization.all @@ -17,38 +19,59 @@ class OrganisationsController < ApplicationController end def show - org = Organization.find(params[:id]) - @org_id = org.id - doc_types = { 0 => 'Бухгалтерский баланс', 1 => 'Отчёт о финансовых результатах', 2 => 'Отчёт об изменении капитала', 3 => 'Отчет о движении денежных средств' } + @type_doc = params[:type_doc].present? ? params[:type_doc].to_i : 0 + data = doc_types.each_with_object({}) do |(key, value), hash| + hash[value] = Hash.new() + end + + doc_types.keys.each do |key| + financial_statements = @org.financial_statements.order(sheet_number: :desc).where(document_type_id: key + 1) + financial_statements.each do |financial_statement| + financial_statement.data['rows'].each_with_index do |row, index| + if index != 0 + if data[doc_types[key]][[row['line_name'], row['line_code']]].nil? + data[doc_types[key]][[row['line_name'], row['line_code']]] = [] + end + data[doc_types[key]][[row['line_name'], row['line_code']]] << row['value'] + end + end + end + end + @info_about_organisation = { "Сведения об организации" => { - "ИНН" => org.inn, - "Полное наименование юридического лица" => org.full_name, - "КПП" => org.kpp, - "Код по ОКПО" => org.okpo, - "Форма собственности (по ОКФС)" => org.okfs, - "Организационно-правовая форма (по ОКОПФ)" => org.okopf, - "Вид экономической деятельности по ОКВЭД 2" => org.okved2, - "Местонахождение (адрес)" => org.address + "ИНН" => @org.inn, + "Полное наименование юридического лица" => @org.full_name, + "КПП" => @org.kpp, + "Код по ОКПО" => @org.okpo, + "Форма собственности (по ОКФС)" => @org.okfs, + "Организационно-правовая форма (по ОКОПФ)" => @org.okopf, + "Вид экономической деятельности по ОКВЭД 2" => @org.okved2, + "Местонахождение (адрес)" => @org.address }, - "Бухгалтерский баланс" => [["Наименование показателя", "На 31 декабря 2024 г.", "На 31 декабря 2023 г."], \ - ["Нематериальные активы", 10457, 9925], \ - ["Результаты исследований и разработок", 6969, 428571]], - "Отчёт о финансовых результатах" => [["Наименование показателя", "За 2024 г.", "За 2023 г."], \ - ["Выручка", 301837283, 238834307], \ - ["Себестоимость продаж", -228706983, -178449438]] + "Бухгалтерский баланс" => ["Наименование показателя", "Код", "На 31 декабря 2024 г.", "На 31 декабря 2023 г.", "На 31 декабря 2022 г.", "На 31 декабря 2021 г.", "На 31 декабря 2020 г.", "На 31 декабря 2019 г."], + "Отчёт о финансовых результатах" => ["Наименование показателя", "Код", "За 2024 г.", "За 2023 г.", "За 2022 г.", "За 2021 г.", "За 2020 г."] } + @doc_name = doc_types[@type_doc] @current_doc_info = @info_about_organisation[@doc_name] + @current_doc_info1 = data[@doc_name] + end + + + private + + def set_organisation + @org = Organization.find(params[:id]) end end \ No newline at end of file diff --git a/app/views/organisations/show.html.slim b/app/views/organisations/show.html.slim index 9b6e682..7a0fd0c 100644 --- a/app/views/organisations/show.html.slim +++ b/app/views/organisations/show.html.slim @@ -12,20 +12,25 @@ - @info_about_organisation["Сведения об организации"].each do |key, value| .information-elem = "#{key}: #{value}" - = render 'organisations/templates/type_doc', target: "type_doc_#{@type_doc}", org_id: "#{@org_id}" + = render 'organisations/templates/type_doc', target: "type_doc_#{@type_doc}", org_id: "#{@org.id}" h2 = "#{@doc_name}" - .information-table - table - thead - tr - - @current_doc_info[0].each do |value| - th - = value - - tbody - - @current_doc_info[1..-1].each do |values| - tr - - values.each do |value| - td - = value + - if @current_doc_info.present? + .information-table + table + thead + tr + - @current_doc_info.each do |header| + th = header + tbody + - @current_doc_info1.keys.each do |key| + tr + td = key[0] + td = key[1] + - @current_doc_info1[key].each do |value| + td = value + + - else + h3 + = "Нет данных" + \ No newline at end of file