# Margin items

## Margin items at a glance

A margin item is a named percentage definition that you maintain for sales margin
calculations. The Margin items page is the reference configuration for these definitions,
and it shares its configuration screen with other lists while you work only with this tab.

| If you need to… | Go to |
|---|---|
| Check the fields and list layout | [Understand the list and form](#understand-the-list-and-form) |
| Add, edit, or delete a definition | [Add, edit, and delete a margin item](#add-edit-and-delete-a-margin-item) |
| Resolve an access or validation message | [Handle access and validation branches](#handle-access-and-validation-branches) |
| Maintain additional cost definitions | [Cost items](doc:configuration-sales-cost-items) |

## Before you start

The configuration feature must be available for the grid to appear. Your access also
determines whether **New**, row editing, and row deletion are available. The list columns
come from the configuration used by your system, so work from the headers displayed in your
list.

Use the checks below before you choose an action.

| Check | What you need to see |
|---|---|
| Configuration access | The Margin items grid appears rather than the upgrade surface. |
| Add access | **New** appears above the list. |
| Edit access | Select a row to edit it. |
| Delete access | The row delete menu is available. |

## Find Margin items

Open the Margin items page to maintain these definitions.

### Open the list or a new item

Prerequisites

- You have opened the Margin items configuration page.
- The Margin items list is visible.

Steps

1. Choose the route that matches your task.

   | If you need to… | Action |
   |---|---|
   | Review or change an existing definition | Select its row. |
   | Add a definition | Select **New** above the list. |

The successful new-item view opens the New Marku up items dialog with **Item Description**,
**Ratio of**, **Default (%)**, and **OK**.

![Review the fields in the new margin-item dialog.](https://atloriaassets.blob.core.windows.net/assets/a438221c-c1af-407c-b9e6-a56c986db846/63de7278840d0472b86d75bb6d442aa3.png)

**Result:** The list or the new-item dialog is open for the task you chose.

## Understand the list and form

The list identifies each definition with its description, ratio basis, and default percentage.
The form uses the same three reader-facing labels.

### List fields

| Field | Form control | Required | List use |
|---|---|---|---|
| **Item Description** | Text box | Required | Visible and filterable. |
| **Ratio of** | Select box | Required | The displayed name is visible; its numeric value is hidden. |
| **Default (%)** | Percentage number box | Required | Visible and filterable. |

The configuration also carries hidden ordering, record-identity, and company values. They do
not appear as fields for you to enter.

The list has no column headers, paging, or header filtering. Its built-in grid editing,
adding, and deleting modes are off; use the page actions instead. Rows can be reordered by
dragging when editing is allowed.

## Add, edit, and delete a margin item

Use these procedures to maintain one definition at a time. Enter a description, choose the
ratio basis, and enter a percentage that follows the field rules before selecting **OK**.

Prerequisites

- The Margin items list is open.
- You know the description, ratio basis, and percentage to enter.

### Add or edit a definition

Steps

1. Select **New** to add a definition, or select its row to edit it.
2. Enter the definition name in **Item Description**.
3. Select the basis in **Ratio of**.
4. Enter a percentage from 0 through 100 in **Default (%)**.
5. Select **OK** to commit the new or edited definition.

**Result:** The definition is committed and the list is ready for review.

### Close without saving

Steps

1. Select **Cancel**.

**Result:** The form closes without saving.

### Delete a definition

Steps

1. Open the row delete menu.
2. Select **Delete**.

**Result:** The definition is removed from the list when deletion succeeds.

## Handle access and validation branches

The page changes what you can select according to configuration access and the state of the
list. The messages below are the messages associated with the fields and record actions.

| What you see | What to do |
|---|---|
| `Item Description is required` | Enter a value in **Item Description**. |
| `Ratio of is required` | Choose a value in **Ratio of**. |
| `Default (%) is required` | Enter a value in **Default (%)**. |
| `Range restricted from 0 - 100 %` | Enter a percentage from 0 through 100 in **Default (%)**. |
| `Forbidden characters detected. Please remove them and try again.` | Remove the forbidden characters and select **OK** again. |
| `Must have at least one item` | Keep at least one definition in the list. |
| `Related to Saved data, Can't be deleted` | Keep the definition because saved data refers to it. |
| `Failed to Delete` | Return to the list and retry the delete action. |
| `Data saved Successfully` | Continue from the list after adding a definition. |
| `Data updated Successfully` | Continue from the list after editing a definition. |
| `Data Deleted Successfully` | Continue from the list after deleting a definition. |

The grid appears when the configuration feature is included; otherwise the upgrade surface
appears. **New** is shown when the add action is available. Selecting a row for editing
requires edit access, and the delete menu requires delete access.

## After maintaining the list

After you select **Cancel**, the form closes and the list is the next place to review the
definitions. After **OK** or **Delete**, continue working from the list and confirm the
definition shown there before using it in later sales work.

The same configuration screen also contains import and export messages, but those flows belong
to their owning configuration pages rather than this Margin items reference.

| Shared flow | Message |
|---|---|
| Import | `Import inserted successfully`; `Data Importing completed` |
| Export | `Export to Excel` |

**Result:** The Margin items list is ready for the next definition you need to maintain.
