> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/payroll/push/record-employee-discount.md).

# Record Employee Discount

Records a **discount given to an employee** under Logic ERP's **Employee Discount Program**, so that it counts against the employee's yearly, monthly and per-bill limits. Use it when your app or online store gives an employee a discount on an order: Logic ERP checks the limits, saves the discount against your order number and answers with the employee's scheme and limits. To only read an employee's limits and balance, use **Get Employee Discount Balance**.

### **Endpoint**

| Name          | Detail                                           |
| ------------- | ------------------------------------------------ |
| Address       | `https://your-server/api/SaveEmployeeDiscPoints` |
| Method        | `POST`                                           |
| Authorization | Basic Auth                                       |

The response and the common messages are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md).

### **Request fields**

Field names are not case-sensitive.

| Field          | Type   | Required | Default | Meaning                                                                                                                                                         |
| -------------- | ------ | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `RCU_MobileNo` | text   | Yes      | –       | The employee's mobile number. Employees are registered in Logic ERP as **retail customers**; this must match the mobile number of that retail customer exactly. |
| `OrderNo`      | text   | Yes      | –       | Your order or bill number for this discount, for example `"WEB-10452"`.                                                                                         |
| `Ext_APP_Code` | text   | Yes      | –       | A short code that names your app, for example `"STAFFAPP"`. Use the same code on every call.                                                                    |
| `Discount_Rs`  | number | Yes      | –       | The discount given, in ₹. Must be above `0`.                                                                                                                    |

### **Rules Logic ERP applies**

* **Program switched on.** The Employee Discount Program must be active in your Logic ERP and its configuration saved; otherwise nothing is saved (see the messages).
* **Finding the employee.** The retail customer whose mobile number is exactly `RCU_MobileNo`. If more than one retail customer has that number, one of them is used and you cannot choose which.
* **Finding the scheme.** Logic ERP takes the first **active** employee discount scheme it finds for the employee:
  * a scheme the employee is linked to individually, or
  * a scheme set up for the employee's **retail customer group** (the group level is chosen in the program's configuration; level 1 when not set), unless the employee is excluded from that scheme. A scheme that has employees linked to it individually applies only to those employees, not to the whole group.
* **Limits.** Each scheme has a limit per bill, per month and per year; a limit of `0` means no limit. The discount is refused when:

  * it is more than the **bill limit**, or
  * it is more than what is left of the **month limit** (the current calendar month), or
  * it is more than what is left of the **year limit** (the current financial year, for example April to March).

  What is "used" counts every employee discount recorded for this employee in that month or year – through this endpoint, from any app, and on bills made in Logic ERP itself.
* **Duplicates.** The same `OrderNo` with the same `Ext_APP_Code` can be recorded only once in a financial year. A second call is refused with `Order No already exists.` – it does not add the discount again. The same `OrderNo` with a different `Ext_APP_Code` is a different entry. The order number is checked **after** the limits, so a repeated request can be refused with a limit message instead – for example when the first call used up the month balance.
* **Date.** The discount is recorded with today's date on the Logic ERP server, in the current financial year. You cannot send a date.
* **The `Result` in the response includes the discount you just recorded** – `YearLimitUsed` and `MonthLimitUsed` include `Discount_Rs`, and `YearBalance` and `MonthBalance` are what is left after it. When the discount is refused, the figures are those before the request.
* One discount per request. Branches do not apply.
* When the program is not switched on or not configured, the employee is not found, or no scheme applies, nothing is saved and the response has `Status: false`; the reason is in `Message` and `Result.StatusCode` is `1`.
* When a required field is missing, or `Discount_Rs` is not above `0`, nothing is saved and the response has `Status: false`; the reason is in `Message` and in `Result.Message` (for example `RCU_MobileNo Cannot allow null..`), and `Result.StatusCode` is `1`.

### **Example request**

```json
{
  "RCU_MobileNo": "9876501234",
  "OrderNo": "WEB-10452",
  "Ext_APP_Code": "STAFFAPP",
  "Discount_Rs": 450.00
}
```

### **Response**

| Field           | Meaning for this endpoint                                                                                                                                                                                                  |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`        | `true` when the discount was recorded. `false` when it was not: a required field was missing, the program, the employee or a scheme was not found, a limit was exceeded, the order was already recorded, or saving failed. |
| `Message`       | `Success.` when the discount was recorded; otherwise the reason.                                                                                                                                                           |
| `LastSavedCode` | Logic ERP's number of the discount entry just recorded. `0` when nothing was recorded.                                                                                                                                     |
| `request_ID`    | Filled once the required fields have passed their checks; `null` when a field was missing.                                                                                                                                 |
| `Result`        | The employee's scheme and limits – see below. Its fields are `0` or empty when the request failed before the scheme was found; `Result.StatusCode` is then `1` and `Result.Message` holds the reason.                      |

**`Result`**

| Field              | Type   | Meaning                                                                                                                                                                      |
| ------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `StatusCode`       | number | `0` = the scheme was found (and, if `Status` is `true`, the discount recorded). `1` = refused or failed, also when a required field was missing; the reason is in `Message`. |
| `Message`          | text   | `Success.` or the reason for refusal.                                                                                                                                        |
| `SchemeCode`       | number | Logic ERP's number of the employee discount scheme.                                                                                                                          |
| `SchemeName`       | text   | Name of the scheme.                                                                                                                                                          |
| `DiscP`            | number | The scheme's discount %.                                                                                                                                                     |
| `BillLimit`        | number | Most discount allowed on one bill, in ₹. `0` = no limit.                                                                                                                     |
| `MonthLimit`       | number | Most discount allowed in a calendar month, in ₹. `0` = no limit.                                                                                                             |
| `YearLimit`        | number | Most discount allowed in a financial year, in ₹. `0` = no limit.                                                                                                             |
| `MonthLimitUsed`   | number | Discount used this month, in ₹, including this request when it was recorded.                                                                                                 |
| `YearLimitUsed`    | number | Discount used this financial year, in ₹, including this request when it was recorded.                                                                                        |
| `MonthBalance`     | number | `MonthLimit` minus `MonthLimitUsed`. `0` when there is no month limit.                                                                                                       |
| `YearBalance`      | number | `YearLimit` minus `YearLimitUsed`. `0` when there is no year limit.                                                                                                          |
| `LstCompGroupDisc` | list   | Discount % the scheme gives for particular brands (companies) or item groups. Empty when the scheme has none. See below.                                                     |

**`LstCompGroupDisc`**

| Field                    | Type         | Meaning                                                                                                      |
| ------------------------ | ------------ | ------------------------------------------------------------------------------------------------------------ |
| `CodeType`               | text         | `COMP` = for a company (brand), `GROUP` = for an item group, `COMPGROUP` = for an item group of one company. |
| `CompCode`, `CompName`   | number, text | The company (brand); `0` and empty for `GROUP`.                                                              |
| `GroupCode`, `GroupName` | number, text | The item group; `0` and empty for `COMP`.                                                                    |
| `DiscP`                  | number       | Discount % for that company or group.                                                                        |

### **Example response**

```json
{
  "Result": {
    "StatusCode": 0,
    "Message": "Success.",
    "SchemeCode": 3,
    "SchemeName": "STORE STAFF 2026",
    "YearLimit": 20000.0000,
    "MonthLimit": 3000.0000,
    "BillLimit": 1500.0000,
    "YearLimitUsed": 6250.0,
    "MonthLimitUsed": 900.0,
    "YearBalance": 13750.0000,
    "MonthBalance": 2100.0000,
    "DiscP": 10.0000,
    "LstCompGroupDisc": [
      {
        "GroupCode": 0,
        "GroupName": "",
        "CompCode": 214,
        "CompName": "URBAN STEP",
        "CodeType": "COMP",
        "DiscP": 15.0
      }
    ]
  },
  "Status": true,
  "Message": "Success.",
  "LastSavedCode": 87,
  "request_ID": "c41e8a72-0d5b-4b9e-a3f6-71e2d9b05c38"
}
```

### **Messages you may see**

| Message                                                                                               | Status  | Meaning                                                                                                 | What to do                                                                                                                                                     |
| ----------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Success.`                                                                                            | `true`  | The discount was recorded.                                                                              | Keep `LastSavedCode`.                                                                                                                                          |
| `RCU_MobileNo Cannot allow null..`, `Ext_APP_Code Cannot allow null..`, `OrderNo Cannot allow null..` | `false` | That field is missing or empty.                                                                         | Send the field.                                                                                                                                                |
| `Discount_Rs Cannot allow 0..`                                                                        | `false` | `Discount_Rs` is `0`, negative or missing.                                                              | Send an amount above `0`.                                                                                                                                      |
| `Employee Discount program not activated...`                                                          | `false` | The Employee Discount Program is not switched on in your Logic ERP. Nothing was saved.                  | Ask your Logic ERP support team.                                                                                                                               |
| `Employee Discount Program Configuration not defined.`                                                | `false` | The program's configuration has not been saved in Logic ERP. Nothing was saved.                         | Ask your Logic ERP team to complete the configuration.                                                                                                         |
| `Customer not found.`                                                                                 | `false` | No retail customer has exactly this mobile number. Nothing was saved.                                   | Check the number.                                                                                                                                              |
| `Employee Discount Program not found.`                                                                | `false` | No active scheme applies to this employee. Nothing was saved.                                           | Ask your Logic ERP team to link the employee or their group to a scheme.                                                                                       |
| `Discount can not be greater than Bill Limit.`                                                        | `false` | `Discount_Rs` is more than the scheme's bill limit.                                                     | Give a smaller discount.                                                                                                                                       |
| `Discount can not be greater than month balance.`                                                     | `false` | Not enough is left of the month limit.                                                                  | Give at most `Result.MonthBalance`.                                                                                                                            |
| `Discount can not be greater than year balance.`                                                      | `false` | Not enough is left of the year limit.                                                                   | Give at most `Result.YearBalance`.                                                                                                                             |
| `Order No already exists. …` (your order number follows)                                              | `false` | This `OrderNo` was already recorded for your `Ext_APP_Code` this financial year. Nothing new was saved. | If you are retrying, treat the earlier call as successful. Otherwise use a new order number. (A retry can also get a limit message – see the duplicates rule.) |
| Any other message with `Result.StatusCode` `1`                                                        | `false` | A database error while reading the scheme or saving.                                                    | Try again; if it continues, contact support with the `request_ID`.                                                                                             |


---

# 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://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/payroll/push/record-employee-discount.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.
