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 %} +