> ## Documentation Index
> Fetch the complete documentation index at: https://manual.muzemus.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Entitlement engine

> How MUZE decides what each employee is entitled to receive.

The entitlement engine is the logic that decides which uniform products each employee can receive, in what quantities, and whether they are company-paid or employee-paid. It runs automatically every time an entitlement view is opened and again when an order is submitted.

You do not interact with the engine directly. Understanding it helps you read entitlement balances and predict what an order will cost.

## How it works

<Steps>
  <Step title="Determine the phase">
    Based on the employee's **start date** and the **replacement cycle** of the matching rule set, the employee is in either the **initial phase** (first allocation) or the **replacement phase** (subsequent allocations). Stores with a rollout date anchor the cycle to that date. Whether the phase restricts which products appear depends on the client's enforcement setting (see [Entitlement enforcement](#entitlement-enforcement)).
  </Step>

  <Step title="Match the rule set">
    The engine finds the active rule sets that apply to the employee's **uniform category**, then picks the one whose **criteria** (department, store, employment type, job title) match the employee most specifically.
  </Step>

  <Step title="Calculate balances">
    For each product in the matched rule set: remaining = allowed quantity − consumed quantity in the current cycle. In free flow, a product that appears in both phases shows the larger quantity.
  </Step>

  <Step title="Split the order">
    Each line item is classified as **company-paid** (within the remaining allocation) or **employee-paid** (beyond it).
  </Step>

  <Step title="Flag exhaustion">
    When all balances are zero, the employee's period is marked as exhausted and new company-paid orders wait for the next cycle.
  </Step>
</Steps>

## Rule set matching

Rule sets are matched using a most-specific-wins strategy. When multiple rule sets could apply, the one with the most specific criteria takes precedence.

| Criteria        | Operators             | Example                              |
| --------------- | --------------------- | ------------------------------------ |
| Department      | IN, NOT\_IN, CONTAINS | Department IN \["Floor Staff"]       |
| Store           | IN, NOT\_IN           | Store IN \["Store 001", "Store 002"] |
| Employment Type | IN, NOT\_IN           | Employment Type IN \["Permanent"]    |
| Job Title       | IN, NOT\_IN, CONTAINS | Job Title CONTAINS \["Manager"]      |

Rule sets with no criteria act as a catch-all for the uniform category, but specific rule sets take priority when they match.

## Allocation items

Each rule set contains allocation items that define:

| Field                   | Description                                                     |
| ----------------------- | --------------------------------------------------------------- |
| **Product**             | The specific product (or "Any Product" for flexible allocation) |
| **Phase**               | When the item is available: Initial, Replacement, or Both       |
| **Quantity**            | How many the employee receives per cycle                        |
| **Payment Eligibility** | Whether the item is Company Paid or Employee Paid               |

## Phase timing

* The **initial phase** starts on the employee's start date (or the store's rollout date where set)
* The **replacement phase** begins once the replacement cycle in months has elapsed
* The rule set's effective period decides whether the rule applies at all

## Entitlement enforcement

The **Entitlement Enforcement** setting on the client record controls two things: which products appear in each employee's balances, and what happens when an order exceeds the company-paid allocation.

| Setting                          | Balances shown                                                                                                       | Over-allocation                      |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| **Off** (free flow, the default) | The employee sees every product in the matched rule set. A product defined in both phases shows the larger quantity. | The excess becomes **employee-paid** |
| **On** (strict)                  | Only products that apply in the employee's current phase (initial or replacement) are shown.                         | The excess is **blocked**            |

In free flow the phase is still calculated, so replacement dates and reporting stay accurate; only the product filter is relaxed. Existing clients typically run in free flow, while new clients can adopt strict phase-by-phase allocation.

The setting lives on the client record; see [Managing clients](/administrator/managing-clients).


## Related topics

- [Managing entitlement rules](/administrator/managing-entitlement-rules.md)
- [Ordering for employees (Store Manager)](/store-manager/ordering-for-employees.md)
- [Managing clients](/administrator/managing-clients.md)
- [Introduction](/getting-started/introduction.md)
- [Categories and products](/uniform-management/categories-products.md)
