# Create a discount component

## Overview

[Video: Create a discount component](https://www.youtube.com/watch?v=0CP455KxG9U)

This flow describes how to create a discount component in the [billing settings](https://docs.ohc.network/concepts/billing/billing-settings.md) of a facility.

A discount component is a named discount: a fixed amount or a percentage. It can carry a discount code and conditions.

Charge item definitions and invoice lines can use the discount components that have a discount code.

## Pre-requisites

* You are a member of the facility in any role, or of its geographic organization or an organization above it.
* The facility has saved a discount configuration. If it has not, [set the discount configuration](https://docs.ohc.network/flows/billing/billing-settings/set-discount-configuration.md) first.
* If the discount component carries a discount code of the facility, [create the discount code](https://docs.ohc.network/flows/billing/billing-settings/create-discount-code.md) first. The discount codes of the deployment are already in the list.
* You have the permissions listed below.

## Permissions

| Permission | Access |
| - | - |
| Can Update on Facility | Lets you save the billing settings of the facility. It counts when you hold it through a role in the facility's root organization, which Care names Administration. A role in the facility's geographic organization, or in an organization above it, also counts. A role that you hold only in a department or team of the facility does not count. By default, the Facility Admin, Administrator and Staff roles hold it. Every member of the facility can open the page and use its buttons. Without this permission, Care refuses the save with a message that contains "You do not have permission to create Facilities". |
| Can Read Tag Config | Needed only if you add a condition on a tag. It lets the tag picker show the tags. Care looks for it in any organization of the facility. By default, the Facility Admin, Administrator, Staff, Doctor, Nurse, Volunteer and Pharmacist roles hold it. |

## Steps

### 1. Open the discount components

In the facility sidebar, under **Administration**, select **Settings**.

Care shows the settings sidebar of the facility.

In the **Billing** group, select **Billing**.

Under **Discount**, select **Discount Components**.

The page title reads **Discount Monetary Components**.

The list shows the discount components of the deployment, marked **Instance**, and then the facility's own, marked **Facility**.

![The facility sidebar, with Settings outlined under Administration](/assets/images/create-discount-component-1-9fd35be0b8e26d50957e3b617117a6fc.webp)

### 2. Open the form

Select **Create Discount Component**.

Care opens a form titled **Create Discount Component**.

The form has these fields.

| Components | What it captures |
| - | - |
| **Name** | The name of the discount component. This field is required. |
| **Discount amount or factor** | The value of the discount: a fixed amount or a percentage. A value is required. |
| **Discount Code** | The discount code that the discount component carries. This field is optional. |
| **Conditions** | Rules that decide when the discount applies to a charge item. This section is optional. |

![The Discount Monetary Components page, with the Create Discount Component button outlined](/assets/images/create-discount-component-2-a823bbd92bd60ba89709bb4a2fa74c1b.webp)

### 3. Enter the name and the value

Enter the name of the discount in **Name**.

In **Discount amount or factor**, select **Amount** or **Factor**. A new discount component starts on **Amount**.

Enter the value in the box.

* **Amount** is a fixed amount of 0 or more. The box shows the ₹ sign.
* **Factor** is a percentage from 0 to 100. The box shows the % sign.

If you switch between **Amount** and **Factor**, Care clears the value that you entered. Care keeps only one of the two.

If the value is not correct, Care shows one of these messages:

* "Must be a valid number": the value is not a number.
* "Must be at least 0": the value is less than 0.
* "Must be at most 100": the percentage is more than 100.

![The Create Discount Component sheet, with the name Staff Discount, Factor selected and the value 15 percent](/assets/images/create-discount-component-3-7557b19404975caa26c9848be9025fc3.webp)

### 4. Choose a discount code

If you want to use the discount in charge item definitions or invoices, select a discount code in **Discount Code**.

The list shows the discount codes of the deployment and of the facility.

Each option shows the name of the discount code, with the code in brackets.

Note: The form says that the discount code is optional. A discount component without a discount code does not appear in the discount lists of charge item definitions or invoices.

![The Discount Code field, with Staff Discount (staff) selected](/assets/images/create-discount-component-4-663289b3d3824892bca00b4d4a12f569.webp)

### 5. Add conditions

Do this step only if the discount applies to some charge items and not to others.

Under **Conditions**, select **Add Condition**.

Select a **Metric**.

If the condition is on a tag, choose the tag in the tag picker.

Select **Add**.

Care checks the conditions when it makes a charge item from a charge item definition.

If the charge item does not meet the conditions, Care leaves the discount off.

![The Conditions card of the form, with the Add Condition button](/assets/images/create-discount-component-5-2b4decf5b095e55e955d4d95ff8dc2b3.webp)

### 6. Save the discount component

Select **Save**.

Note: **Save** stays disabled until you enter something in the form.

Care closes the form at once, before it saves the discount component.

If Care saves the discount component, it shows the message "Discount component created!"

If Care refuses the save, what you entered is lost. Open the form again. Enter the values again.

If Care shows an error message, use this table.

| If the message contains | What to do |
| - | - |
| All monetary components code must be defined. | The discount code that you chose is not a discount code of the deployment or of the facility. Open **Discount Codes**. Check that the code is in the list. Then create the discount component again. |
| Discount monetary components cannot be more than 100. | The facility already has 99 discount components, which is the most that Care accepts. [Delete a discount component](https://docs.ohc.network/flows/billing/billing-settings/edit-or-delete-discount-component.md) that the facility does not use. Then create the discount component again. |
| Field required | The facility has not saved a discount configuration. [Set the discount configuration](https://docs.ohc.network/flows/billing/billing-settings/set-discount-configuration.md) first. Then create the discount component again. |
| You do not have permission to create Facilities | You do not hold the permission listed above in the right organization. Ask for a role that has it in the facility's root organization, Administration. |

![The discount components list, with the new Staff Discount at 15 percent marked Facility](/assets/images/create-discount-component-6-34665737718af425858675041d8f66fe.webp)

## Expected Outcome

* The discount component appears in the list, marked **Facility**.
* If the discount component has a discount code, you can select it under **Discounts** in a charge item definition.
* If the discount component has a discount code, you can also select it in the lines of an invoice.

## Related

Concepts:

* [Billing settings](https://docs.ohc.network/concepts/billing/billing-settings.md)
* [Charge Item Definition](https://docs.ohc.network/concepts/definitions/charge-item-definition.md)
* [Charge Item](https://docs.ohc.network/concepts/billing/charge-item.md)

Flows:

* [Set the discount configuration](https://docs.ohc.network/flows/billing/billing-settings/set-discount-configuration.md)
* [Create a discount code](https://docs.ohc.network/flows/billing/billing-settings/create-discount-code.md)
* [Edit or delete a discount component](https://docs.ohc.network/flows/billing/billing-settings/edit-or-delete-discount-component.md)
* [Create a charge item definition](https://docs.ohc.network/flows/definitions/charge-item-definition/create-charge-item-definition.md)
* [Edit an invoice](https://docs.ohc.network/flows/billing/invoice/edit-invoice.md)
