Merge branch 'feature/SU2-20' of DAAntipenko/finreport-analyzer into develop

This commit is contained in:
Дмитрий Антипенко
2026-04-02 21:34:57 +03:00
committed by Gogs
3 changed files with 65 additions and 35 deletions
+5 -3
View File
@@ -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 {
+40 -17
View File
@@ -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
+20 -15
View File
@@ -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
= "Нет данных"