From eac67e5f899af95a265121097c74f1956d5c1a54 Mon Sep 17 00:00:00 2001 From: zakhy <=> Date: Wed, 23 Apr 2025 17:41:53 +0700 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BA=D1=80=D1=8B=D0=BB=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B6=D0=B5=D0=BB=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/apps/finance/models.py | 1 + .../finance/services/integration_1c/api.py | 5 +- .../services/integration_1c/service.py | 2 +- .../finance/templates/finance/fin_index.html | 131 ++++++++++++------ app/apps/util/base_view.py | 5 +- 5 files changed, 100 insertions(+), 44 deletions(-) diff --git a/app/apps/finance/models.py b/app/apps/finance/models.py index e140acb..35a7749 100644 --- a/app/apps/finance/models.py +++ b/app/apps/finance/models.py @@ -29,5 +29,6 @@ class Balance: place: str amount_balance: decimal.Decimal currency: str + percent: float account_number: str | None = None bank_name: str | None = None diff --git a/app/apps/finance/services/integration_1c/api.py b/app/apps/finance/services/integration_1c/api.py index 8c162df..03af908 100644 --- a/app/apps/finance/services/integration_1c/api.py +++ b/app/apps/finance/services/integration_1c/api.py @@ -38,11 +38,14 @@ class Finance1CAPI: amount_balance = balance_item['СуммаОстаток'] money_type = balance_item['ВидДенежныхСредств'].strip() currency_code = balance_item['Валюта'] + summary_for_obj = response_data['summary'][money_type][currency_code] + percent = amount_balance * 100 / summary_for_obj balance_object = Balance( money_type=money_type, place=balance_place, amount_balance=amount_balance, - currency=currency_code + currency=currency_code, + percent=percent ) if ',' in balance_place: mas = balance_place.split(',', maxsplit=1) diff --git a/app/apps/finance/services/integration_1c/service.py b/app/apps/finance/services/integration_1c/service.py index d3393c3..effb0e1 100644 --- a/app/apps/finance/services/integration_1c/service.py +++ b/app/apps/finance/services/integration_1c/service.py @@ -89,7 +89,7 @@ class Finance1CService(DashboardBaseService): result[money_type][balance_object['currency']]['data']['main'] = [] result[money_type][balance_object['currency']]['data']['other'] = [] - if percent > 3: + if percent > 2: result[money_type][balance_object['currency']]['data']['main'].append(balance_object) else: result[money_type][balance_object['currency']]['data']['other'].append(balance_object) diff --git a/app/apps/finance/templates/finance/fin_index.html b/app/apps/finance/templates/finance/fin_index.html index c9cf82e..0c7aaca 100644 --- a/app/apps/finance/templates/finance/fin_index.html +++ b/app/apps/finance/templates/finance/fin_index.html @@ -2,12 +2,17 @@ {% load humanize %} {% block content %} +