> 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/v2.1/design/architecture/field-app-architecture/ui-packages/inventory-management-package.md).

# Inventory Management Package

This enables the user to manage the stocks of a health campaign. The user can record the stocks received, issued, returned, damaged and lost.

To known more about Inventory Management, [click here.](https://health.digit.org/hcm-product-suite/health-products/frontline-workers-app/user-manual/common-functions/inventory-management)

Link to the Pub Package:

{% embed url="<https://pub.dev/packages/inventory_management>" %}

## Role

* DISTRIBUTOR, WAREHOUSE\_MANAGER

## Features

* Manage Stocks: Receipt, issued, returned, damaged, and loss of stocks.
* Stock Reconciliation: Reconcile the stock data.
* View Reports: View the reports of the stocks.

## Getting Started

To use this package, add the following dependency to your pubspec.yaml file:

```
dependencies:
  inventory_management: ^latest
  digit_scanner: ^latest
```

## Integrating with the HCM Application:&#x20;

1. To integrate this package with the HCM Application, run the main function located in `health-campaign-field-worker-app/tools/inventory_management_imports.dart.`&#x20;
   * This will automatically add the necessary imports, mapper initializers, route config, setting initial data, and repository initialization to the required files.

2. Make sure you are on the path `apps/health_campaign_field_worker_app` and run the command:

   ```dart
   dart run build_runner build --delete-conflicting-outputs
   ```

   This adds a package route to the `main router.gr.dart`&#x20;

3. Install the application and you should have Inventory Management integrated into your base app.

By following these steps, you can successfully integrate and use the Inventory Management module within your application.

## Sequence Diagram&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXf0lvNJIU-1hAxQpU5w5j-IOAphpJJcZ9ep4wECqF-jm4lF_4bZ4pP-cRa0kbXtmYgW-oLjf0iQmoY-xMBqMOZlhyvlwe7XKHF9pyJItv2TZvz2BRh0b4G5aQ22dMuYaHU-_xEHv6LfjpbLwHRK9L9MJ0TF?key=ywC-xFdrBsgjDW7J5HkN3w" alt=""><figcaption></figcaption></figure>

### Stock Enhancements — Accept/Reject + CDD Scan-to-Receive

#### What's new for users

* **Accept and Reject are now first-class actions.** When a facility or community distributor receives stock, they can explicitly **Accept** (which records the stock as received and acknowledges the inbound dispatch) or **Decline** (no stock is added, the sender is notified). Each side of the transaction has its own audit trail.
* **Scan-to-Receive for Community Distributors (CDDs).** A new role-gated **Scan** button lets CDDs receive stock by scanning a QR code presented at the LGA or warehouse. This unlocks the leaf-level distribution case where the CDD's device may be offline or hasn't yet synced the dispatch.
* **Smart QR at the LGA / Warehouse side.** The "View QR" popup on the dispatch card now encodes the full stock dispatch (product, quantity, batch, expiry, SKU, waybill, sender, receiver, comments) — so a single scan transfers the entire receipt context.
* **Confirmation screen with safety checks** before the CDD commits the receipt:
  * **Receiver match check** — blocks accidental scans of stock dispatched to another facility.
  * **Duplicate scan check** — blocks scanning the same dispatch twice.
* **Cleaner Receive list.** The incoming-transactions list automatically hides any dispatch the user has already received, even when the dispatch arrives via downsync *after* the user has already scanned and accepted it locally.
* **Campaign-scoped stock balance.** Balances are now tracked per campaign, so a worker who handles stock across multiple campaigns sees the right opening / closing numbers in each.

### Stock Receive Flow — UML Sequence Diagram<br>

<figure><img src="https://2077406040-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0KFbSBTySIQ7TCOKnJF%2Fuploads%2FlvIkXF0jmhOq0bVNyjJk%2Fimage%20(5).png?alt=media&amp;token=1a83efa1-de34-4247-b1f2-9abe976da8c6" alt=""><figcaption></figcaption></figure>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/health/v2.1/design/architecture/field-app-architecture/ui-packages/inventory-management-package.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
