diff --git a/atst/routes/portfolios/index.py b/atst/routes/portfolios/index.py index c0fea654..795d4b70 100644 --- a/atst/routes/portfolios/index.py +++ b/atst/routes/portfolios/index.py @@ -34,10 +34,17 @@ def create_portfolio(): @user_can(Permissions.VIEW_PORTFOLIO_REPORTS, message="view portfolio reports") def reports(portfolio_id): portfolio = Portfolios.get(g.current_user, portfolio_id) + spending = Reports.get_portfolio_spending(portfolio) + obligated = portfolio.total_obligated_funds + remaining = obligated - (spending["invoiced"] + spending["estimated"]) - current_obligated_funds = Reports.obligated_funds_by_JEDI_clin(portfolio) + current_obligated_funds = { + **spending, + "obligated": obligated, + "remaining": remaining, + } - if any(map(lambda clin: clin["remaining"] < 0, current_obligated_funds)): + if current_obligated_funds["remaining"] < 0: flash("insufficient_funds") return render_template( @@ -47,6 +54,5 @@ def reports(portfolio_id): total_portfolio_value=str(portfolio.total_obligated_funds), current_obligated_funds=current_obligated_funds, expired_task_orders=Reports.expired_task_orders(portfolio), - monthly_spending=Reports.monthly_spending(portfolio), retrieved=datetime.now(), # mocked datetime of reporting data retrival ) diff --git a/templates/portfolios/reports/expired_task_orders.html b/templates/portfolios/reports/expired_task_orders.html index dcde6683..f55bb57e 100644 --- a/templates/portfolios/reports/expired_task_orders.html +++ b/templates/portfolios/reports/expired_task_orders.html @@ -16,13 +16,12 @@ PoP CLIN Value Amount Obligated - Amount Unspent {% for task_order in expired_task_orders %} - + Task Order {{ task_order.number }} {{ Icon("caret_right", classes="icon--tiny icon--blue" ) }} @@ -39,9 +38,8 @@ - {{ clin.end_date | formattedDate(formatter="%b %d, %Y") }} - {{ clin.total_amount | dollars }} - {{ clin.obligated_amount | dollars }} - {{ 0 | dollars }} + {{ clin.total_amount | dollars }} + {{ clin.obligated_amount | dollars }} {% endfor %} {% endfor %} diff --git a/templates/portfolios/reports/index.html b/templates/portfolios/reports/index.html index 747610d9..51364bf7 100644 --- a/templates/portfolios/reports/index.html +++ b/templates/portfolios/reports/index.html @@ -13,7 +13,5 @@
{% include "portfolios/reports/obligated_funds.html" %} {% include "portfolios/reports/expired_task_orders.html" %} -
- {% include "portfolios/reports/application_and_env_spending.html" %} {% endblock %} diff --git a/templates/portfolios/reports/obligated_funds.html b/templates/portfolios/reports/obligated_funds.html index e0f11792..0b41b16f 100644 --- a/templates/portfolios/reports/obligated_funds.html +++ b/templates/portfolios/reports/obligated_funds.html @@ -7,61 +7,56 @@
- {% for JEDI_clin in current_obligated_funds | sort(attribute='name')%} -
-

- {{ "JEDICLINType.{}".format(JEDI_clin.name) | translate }} -

-

Total obligated amount: {{ JEDI_clin.obligated | dollars }}

-
- {% if JEDI_clin.remaining < 0 %} - - {% else %} - {% set invoiced_width = (JEDI_clin.invoiced, JEDI_clin.obligated) | obligatedFundingGraphWidth %} - {% if invoiced_width %} - - - {% endif %} - - {% set estimated_width = (JEDI_clin.estimated, JEDI_clin.obligated) | obligatedFundingGraphWidth %} - {% if estimated_width %} - - - {% endif %} - +
+

+ Total obligated amount: {{ current_obligated_funds.obligated | dollars }} +

+
+ {% if current_obligated_funds.remaining < 0 %} + + {% else %} + {% set invoiced_width = (current_obligated_funds.invoiced, current_obligated_funds.obligated) | obligatedFundingGraphWidth %} + {% if invoiced_width %} + {% endif %} - + {% set estimated_width = (current_obligated_funds.estimated, current_obligated_funds.obligated) | obligatedFundingGraphWidth %} + {% if estimated_width %} + + + {% endif %} + + + {% endif %} +
+
+
+

+ + Invoiced expended funds: +

+

{{ current_obligated_funds.invoiced | dollars }}

-
-
-

- - Invoiced expended funds: -

-

{{ JEDI_clin.invoiced | dollars }}

-
-
-

- - Estimated expended funds: -

-

{{ JEDI_clin.estimated | dollars }}

-
-
-

- 0 else "insufficient"}}"> - Remaining funds: -

-

{{ JEDI_clin.remaining | dollars }}

-
+
+

+ + Estimated expended funds: +

+

{{ current_obligated_funds.estimated | dollars }}

+
+
+

+ 0 else "insufficient"}}"> + Remaining funds: +

+

{{ current_obligated_funds.remaining | dollars }}

- {% endfor %} +

Active Task Orders