> 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/design/architecture/low-level-design/services/expense-calculator.md).

# Expense Calculator

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

### API Specifications <a href="#api-specifications" id="api-specifications"></a>

**Base path**: `/health-expense-calculator/v1/`

The API specification is available [here](https://github.com/egovernments/DIGIT-Specs/blob/c7e5b6efefbfb351fd123788a7f762673223952d/Domain%20Services/Health/Health-Expense-calculator-v1.0.0.yml). To view it in the Swagger editor, click below.

[Swagger Editor](https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/DIGIT-Specs/c7e5b6efefbfb351fd123788a7f762673223952d/Domain%20Services/Health/Health-Expense-calculator-v1.0.0.yml)

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

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

### Master Data

* Worker rates

### Sequence Diagrams

<figure><img src="https://content.gitbook.com/content/ugLvZh3s3IGcc8JYqNN7/blobs/VB3YtpGs9qlg7ZEVBmV6/ExpenseSequenceDiagram.png" alt=""><figcaption><p>Bill generation</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/ugLvZh3s3IGcc8JYqNN7/blobs/rNsa4YYkDGHWGXX1H8Ht/ExcelPdfSequenceDiagram.png" alt=""><figcaption><p>Excel/PDF generation</p></figcaption></figure>

### DB Diagram

<div align="left"><figure><img src="https://content.gitbook.com/content/ugLvZh3s3IGcc8JYqNN7/blobs/NoUqdUc57DwKiQcH9wTI/ExpenseCalculatorDB.png" alt=""><figcaption></figcaption></figure></div>

### MDMS data

{% embed url="<https://github.com/egovernments/egov-mdms-data/blob/UNIFIED-QA/data/mz/health/workerRates.json>" %}

### Related Topics

* [Expense calculator configuration](/health/ph-v1.7/deploy/configuration/service-configuration/expense-calculator.md)


---

# 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/design/architecture/low-level-design/services/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.
