For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

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 shows the limits as they were before this discount – YearLimitUsed, MonthLimitUsed, YearBalance and MonthBalance do not yet include the amount you just recorded. Call Get Employee Discount Balance for the new figures, or subtract Discount_Rs yourself.

  • One discount per request. Branches do not apply.

Known issue – some refusals come back with Status: true. When the program is not switched on or not configured, the employee is not found, or no scheme applies, nothing is saved but the response has Status: true; the reason is in Message and Result.StatusCode is 1. Treat the discount as recorded only when Status is true and Result.StatusCode is 0 and LastSavedCode is above 0.

Known issue – a missing field gives a technical message. When a required field is missing, Status is false and Message starts with technical text, followed on the same line by the reason (for example RCU_MobileNo Cannot allow null..) and then more technical lines. Look for the reasons listed under Messages you may see.

Example request

Response

Field
Meaning for this endpoint

Status

true when the request was handled – see the known issue: also check Result.StatusCode and LastSavedCode. false when a required field was missing, 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. When a required field was missing, Result.StatusCode is also 0 and Result.Message is null – go by Status.

Result

Field
Type
Meaning

StatusCode

number

0 = the scheme was found (and, if Status is true, the discount recorded). 1 = refused; the reason is in Message. Also 0, with every other field empty, when a required field was missing (Status: false).

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 already used this month, in ₹ (before this request).

YearLimitUsed

number

Discount already used this financial year, in ₹ (before this request).

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

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.. (inside technical text)

false

That field is missing or empty.

Send the field.

Discount_Rs Cannot allow 0.. (inside technical text)

false

Discount_Rs is 0, negative or missing.

Send an amount above 0.

Employee Discount program not activated...

true

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.

true

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.

true

No retail customer has exactly this mobile number. Nothing was saved.

Check the number.

Employee Discount Program not found.

true

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

true or false

A database error while reading the scheme or saving.

Try again; if it continues, contact support with the request_ID.

Last updated