> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/health/ph-v1.7/deploy/configuration/service-configuration/expense-calculator.md).

# Expense calculator

## Overview

The expense calculator is an implementation-specific service that works in tandem with the expense service. This service holds all the specific business logic for computing expenses and calls the billing service with the correct payload to create a bill. Once the bill is generated, Excel and PDF are generated by the calculator service.

There are three types of bills in HCM:

* Wage bill - generated from an approved muster roll and to be paid to wage seekers on completion of work

### Dependencies <a href="#dependency" id="dependency"></a>

* DIGIT backbone services
* Persister
* MDMS
* Attendance
* Muster roll
* Project
* Individual
* Expense
* Localization
* PdfService
* Filestore

## Functionalities

**Calculate API:** This API fetches the attendance registers and calculates the amount to be paid based on the rates and roles present in MDMS and individual skills, respectively.

## Deployment Details

Here is a list of variables that need to be configured in the Helm environment file before deploying the muster roll service. This file can typically be found under a specific directory or location as given below:

`https://github.com/`<mark style="color:red;">`{{ORG}}`</mark>`/DIGIT-DevOps/deploy-as-code/helm/environments/`<mark style="color:red;">`{{EnvironmentFile}}`</mark>`.yaml`

Refer to the [sample here](https://github.com/egovernments/DIGIT-DevOps/blob/digit-works/deploy-as-code/helm/environments/works-dev.yaml).

* Add these ‘db-host’,’db-name’,’db-url’, ’domain’ and all the digit core platform services configurations (Idgen, workflow, user, etc.) in the respective environments yaml file.
* Add expense-calculator related environment variables’ value like the way it's done in the[ ‘dev](https://github.com/egovernments/DIGIT-DevOps/blob/5a9eb4c6141e19bd747238889ceed9bc9fffdc6f/deploy-as-code/helm/environments/works-dev.yaml#L175)’ environment yaml file.
  * <https://github.com/egovernments/DIGIT-DevOps/blob/47594728968d9551990b0da81294f7898aceada2/deploy-as-code/helm/environments/unified-health-qa.yaml#L167>
  * <https://github.com/egovernments/DIGIT-DevOps/blob/07bdd11e0c91053cb434cd2a79f785e59e2785c8/deploy-as-code/helm/environments/unified-health-qa.yaml#L345-L353>
  * <https://github.com/egovernments/DIGIT-DevOps/tree/07bdd11e0c91053cb434cd2a79f785e59e2785c8/deploy-as-code/helm/charts/health-services/health-expense-calculator>
* environment secret YAML file as per the steps outlined[ here](https://github.com/egovernments/DIGIT-DevOps/blob/e742a292f2966bb1affb3b03edd643a777917ba1/deploy-as-code/helm/environments/works-dev-secrets.yaml#L3).
* Make sure to add the digit core services-related secrets that are configured in the respective environment secret file as per the steps outlined[ here](https://github.com/egovernments/DIGIT-DevOps/blob/digit-works/deploy-as-code/helm/environments/works-dev-secrets.yaml).

## Configuration Details

### Configure Actions

Add all the APIs exposed (refer to the table below for actual APIs) to the actions.json file in MDMS

**Module name:** ACCESSCONTROL-ACTIONS-TEST

**Master name:** actions-test

### Configure Roles

Configure roles based on the roles column below in roles.json file.&#x20;

**Module name:** ACCESSCONTROL-ROLES

**Master name:** roles

### Configure Role-Action

Role-action mapping is configured in MDMS per the table below.&#x20;

**Module name:** ACCESSCONTROL-ROLEACTIONS

**Master name:** roleactions.json

<table><thead><tr><th width="302">Roles</th><th>API Endpoints</th></tr></thead><tbody><tr><td>CAMPAIGN_SUPERVISOR</td><td>/health-expense-calculator/v1/_calculator</td></tr></tbody></table>

#### Other masters to be added

Other muster roll masters are configured in the **`common-masters`** folder:

[workerRates.json](https://github.com/egovernments/egov-mdms-data/blob/UNIFIED-QA/data/mz/health/workerRates.json)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digit.org/health/ph-v1.7/deploy/configuration/service-configuration/expense-calculator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
