Skip to content

feat: dashboard kpi#1415

Merged
robinroy03 merged 3 commits into
feat/redesignfrom
feat/dashboard-kpi
Jun 3, 2026
Merged

feat: dashboard kpi#1415
robinroy03 merged 3 commits into
feat/redesignfrom
feat/dashboard-kpi

Conversation

@robinroy03
Copy link
Copy Markdown
Member

@robinroy03 robinroy03 commented Jun 1, 2026

Description

dashboard kpi
image

Relevant Technical Choices

  1. made an api to return the 3 kpi values

Testing Instructions

next_pms feat/dashboard-kpi* ≡
 ❯ curl -s -b 'sid=1e6d1c3ee70cdb5ff9fd0bdcffb92c1eed508f5c5b0d0952a83239a5' \
  'http://erp16.localhost/api/method/next_pms.api.dashboard.get_leadership_kpis?cur_start=2035-01-01&cur_end=2035-01-31&prev_start=2030-01-01&prev_end=2030-01-31' \
  | jq .
{
  "message": {
    "revenue": {
      "current": 96.0,
      "previous": 156.0,
      "change_pct": -38.46153846153847,
      "trend": "down"
    },
    "cost": {
      "current": 60.0,
      "previous": 65.00000000000401,
      "change_pct": -7.692307692313384,
      "trend": "down"
    },
    "profit_margin": {
      "current": 37.5,
      "previous": 58.33333333333076,
      "change_pct": -35.71428571428289,
      "trend": "down"
    }
  }
}

Checklist

  • I have carefully reviewed the code before submitting it for review.
  • This code is adequately covered by unit tests to validate its functionality.
  • I have conducted thorough testing to ensure it functions as intended.
  • A member of the QA team has reviewed and tested this PR (To be checked by QA or code reviewer)

Fixes #1139

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new backend API endpoint to power the Leadership dashboard KPI cards by aggregating revenue (Sales Invoices), cost (Timesheets), and profit margin across a current and comparison period, with currency conversion to USD.

Changes:

  • Introduces GET next_pms.api.dashboard.get_leadership_kpis (whitelisted) returning revenue, cost, and profit_margin KPI payloads.
  • Implements query-builder aggregations for Sales Invoice totals and Timesheet Detail costing amounts across two periods.
  • Adds helper functions to compute KPI deltas/trends and to convert per-currency rows into USD totals via exchange rates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
Comment thread next_pms/api/dashboard.py
@robinroy03 robinroy03 requested a review from wreckage0907 June 3, 2026 13:12
@robinroy03 robinroy03 requested a review from wreckage0907 June 3, 2026 14:47
@robinroy03 robinroy03 merged commit a1f48f3 into feat/redesign Jun 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants