Uploaded image for project: 'mod-finance'
  1. mod-finance
  2. MODFIN-137

Define and implement GET /finance/groups/id/expense-classes-totals API

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed (View Workflow)
    • Priority: P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Labels:
      None
    • Template:
    • Sprint:
      ACQ Sprint 94, ACQ Sprint 95
    • Story Points:
      3
    • Development Team:
      Thunderjet

      Description

      Purpose/Overview:
      To support ability to summarize the amounts associated with an expense class for all funds in given group with that type we need to provide GET /finance/groups/id/expense-classes-totals API

      Requirements/Scope:

      1. create schema group_expense_class_totals
        • expenseClassName
        • expended
        • percentageExpended
      2. define and implement GET /finance/groups/id/expense-classes-totals API

      Approach:
      Retrieve group-fund-fiscal-year records by groupId
      Retrieve expense-classes for each budgetId from above request using GET /finance-storage/expense-classes?query=budgetExpenseClass.budgetId==id
      For each expense-class get transactions using GET /finance-storage/transactions?query=expenseClassId==expense-class.id AND
      Calculate for each expense-class:

      • expended sum of (transaction.amount where transactionType==Payment) and (-transaction.amount where transactionType==Credit)
      • percentageExpended = expended/ (sum of all expense classes expended related to given group) * 100

      Acceptance criteria:

      • schema created
      • GET /finance/groups/id/expense-classes-totals API defined and implemented
      • unit tests updated
      • API tests updated

        Attachments

        1. screenshot-1.png
          screenshot-1.png
          49 kB
        2. screenshot-2.png
          screenshot-2.png
          196 kB
        3. snapshot_test.png
          snapshot_test.png
          117 kB

          Issue Links

            Activity

              People

              Assignee:
              Andrei_Makaranka Andrei Makaranka
              Reporter:
              aliaksandr_pautau Aliaksandr Pautau
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: