{% extends "base.html" %} {% block title %}Account Health{% endblock %} {% block header %}Account Health (AM){% endblock %} {% block content %} {% set cluster_label = (cluster.name if cluster else "All Clusters") %}
Cluster: {{ cluster_label }}
Report date: {{ ref_date }}
Period: {{ start_date }} to {{ end_date }}
Scope: AM users only (team_role = AM)
Active Clients
{{ active_clients or 0 }}
Last invoice within 60 days.
Dormant Risk
{{ dormant_risk or 0 }}
Last invoice 61–90 days ago.
Inactive Accounts
{{ inactive_accounts or 0 }}
No invoice OR last invoice > 90 days.
Client Revenue & Activity
Revenue windows are based on invoice totals (excluding Cancelled).
{% for r in rows %} {% set row_cls = 'row-inactive' if r.status == 'Inactive' else ('row-risk' if r.status == 'Dormant Risk' else '') %} {% endfor %} {% if rows|length == 0 %} {% endif %}
AM Client Rev (30d) Rev (60d) Rev (90d) Trend Last Invoice Status
{{ r.am.name }}
{{ r.am.email }}
{{ r.client.company_name }}
Client ID: {{ r.client.id }}
{{ indian_amount(r.rev_30 or 0) }} {{ indian_amount(r.rev_60 or 0) }} {{ indian_amount(r.rev_90 or 0) }} {% if r.trend == 'Up' %} Up {% elif r.trend == 'Down' %} Down {% else %} Stable {% endif %} {{ r.last_invoice_date or "—" }} {% if r.status == 'Active' %} Active {% elif r.status == 'Dormant Risk' %} Dormant Risk {% else %} Inactive {% endif %}
No AM clients found for selected cluster
Notes:
  • AM → Client mapping is derived from Projects where Project.account_manager_user_id is set.
  • Trend compares last 30 days revenue vs previous 30 days (±10% band).
{% endblock %}