Skip to content

Commission Scheme

Define how sales commissions and membership points are earned: which sales qualify, and how much each level earns. A scheme never pays anything by itself. Commission is posted by the run started from the Sales Commission applet, and points by the scheduled membership-points run, and both read the schemes that are active.

Overview

The Commission Scheme applet is where you define how sales commissions and membership points are earned. A scheme is master data: a set of rules that decide which sales documents qualify (by branch, company, document type, date, customer type, member class, sales agent category, items or item categories) and a treatment that says how much is paid per downline level (a price source, an operator and a value, optionally through a formula or a tiered Pricing Model). Two supporting masters live in the same applet: Sales Groups (named groups of employees) and Pricing Models (range-to-rate tables).

The applet itself never pays anything. Active schemes are read by two backend processes: the sales-commission posting run started from the Sales Commission Applet (cash commission for sales agents and MLM uplines) and the scheduled membership-points run described on the Membership Admin Applet page (points on qualifying bills). A scheme can also be attached to an e-commerce website in CP Commerce Admin and to an MLM program in Membership Admin.

Where it fits

DirectionApplet / dataWhy
Upstream (master data the rules reference)Organisation (companies, branches), Employee (sales agents, employee categories, sales-group members), Customer (entity type flags), Inventory Item Maintenance (items, item categories), Membership Admin (member classes, member labels, the points currency picked on the treatment), MLM Admin Applet (MLM programs and lineage)Every rule and treatment picks from these lists
Upstream (documents evaluated)Sales Invoice (Internal), POS General cash bills, Sales Order (Internal), Receipt Voucher (Internal)The only server document types a Document Type rule can match (INTERNAL_SALES_INVOICE, INTERNAL_SALES_CASHBILL, INTERNAL_SALES_ORDER, INTERNAL_RECEIPT_VOUCHER)
Downstream (consumers)Sales Commission AppletRuns the posting that turns matching schemes into commission transaction lines and commission reports
Downstream (consumers)Membership Admin AppletScheduled membership-points run awards points from the Level 0 Membership Points treatment; MLM programs reference a scheme
Downstream (consumers)CP Commerce AdminWebsite › Commission Scheme tab links a website to a scheme

Screens and menus

The applet root route is applet/tnt/wavelet/erp/commission-scheme-applet. The left menu has three listings plus Settings and Personalization.

Menu itemScreenWhat it holds
Commission Scheme (default landing)Listing (code, name, description, created date, modified date, status) with search and an advanced filter (status, created-date range, modified-date range, keyword). + opens Create Commission Scheme; clicking a row opens Edit Commission Scheme with tabs Main Details, Rules - Doc Hdr, Rules - Multi Line, Rules - Single Line, Treatment, a RESET/SAVE pair and a DELETE button that must be clicked twice within three secondsThe scheme, with its rules and its treatments
Sales GroupListing (code, name, creation date, modified date, status). Edit has two tabs: Group (the header) and Salesman (linked employees with a Weightage column)The group and its salesmen
Pricing ModelListing (code, name, logic code, logic type, dates). Edit shows the header plus a line grid (range from, range to, commission multiplier, commission absolute, membership point multiplier / value)The model and its bands
SettingsFeature Visibility (landing), Field Settings, Default Selection, Webhook, Permission Wizard / Permission Set / User / Team / Role Permission listings, Release NotesShared platform screens except Field Settings and Default Selection
PersonalizationDefault Selection, SidebarPer-user

Rules are added from inside the Edit screen: on a Rules tab, + opens Add Rule - Doc Hdr / Multi Line / Single Line, where a Rule Type dropdown reveals the form for that rule type. Adding a rule, adding filter values to a rule, or editing a treatment only updates the draft in the browser; nothing reaches the server until you click SAVE on the Edit screen (every snackbar ends with “Please save changes”).

Configuration

Before you can use it

  • Companies and branches exist in Organisation — needed for Company and Branch rules.
  • Employees exist in the Employee Applet with is_employee set: only such entities appear in the Sales Group › Salesman picker, and the Employee Category rule matches the categories (labels from the EMPLOYEE_CATEGORIES list) tagged on the document’s sales agent.
  • Items and item categories exist in Inventory Item Maintenance — the Item, Item Category and regex line rules read item_guid, item_code, item_name and the item’s categories from the document line.
  • Member classes and labels exist in Membership Admin; a points currency exists in Membership Admin (PTS CCY Module) if the treatment awards points.
  • Pricing schemes (maintained outside this applet) exist if a treatment uses the Pricing Scheme price source; the Treatment tab lists the pricing schemes it can find.
  • For the money to be paid, the Sales Commission Applet must be installed and run. For points, the company’s member-point settings in Organisation (member_point_award_doc_in, member_point_in_doc_status) decide which document type and posting status the scheduled run picks up.
  • API permissions: TNT_API_COMMISSION_SCHEME_HDR_{READ, CREATE, UPDATE, DELETE, OWNER, ADMIN, MEMBER} (tenant owner/admin bypasses), and the corresponding TNT_API_SALE_COMMISSION_PRICING_MODEL_HDR_* / _LINE_* sets for pricing models. The commission and points runs read schemes on their own and need no user permission.

Applet settings

The applet has its own Field Settings and Default Selection screens; Default Selection saves for the whole tenant. Anyone with access to the applet’s Settings menu can change them.

Only one setting is shown, saved and actually used:

SettingWhereWhat it controlsDefaultEffect when changed
Details Tab Ordering (COMMISSION_SCHEME_DETAILS_TAB_ORDER)Settings › Default Selection › Details Tab Ordering (drag-and-drop list)The order of the five tabs on Edit Commission SchemeMain Details, Rules - Doc Hdr, Rules - Multi Line, Rules - Single Line, TreatmentEdit Commission Scheme shows its tabs in the saved order; a tab added in a later version is appended at the end

Shown and saved, and used by nothing:

  • Default Branch (DEFAULT_BRANCH) and Default Location (DEFAULT_LOCATION) on the same Default Selection screen. They are saved (picking a branch also fills in the branch’s main location), but commission schemes, sales groups and pricing models have no branch or location field, so nothing uses them. RESET clears both.

Not functional:

  • Settings › Field Settings shows eight toggles (Unit Discount, SST/VAT/GST, WHT, Blanket Order, Segment, G/L Dimension, Profit Center, Project) and a SAVE button that does nothing. Treat the screen as a placeholder.
  • Personalization › Default Selection shows Default Branch / Default Location, but choosing a value fails and SAVE saves nothing.

There are no document-behaviour settings: schemes have no posting status, numbering or printables.

Feature visibility / permissions

No SHOW_* / HIDE_* client-side permission is checked anywhere in the applet, and none is defined for it. Access control is therefore the API permission set listed above plus the shared Feature Visibility screen.

Fields

Commission Scheme — Create and Main Details

FieldMeaningRequiredNotes / validation
Commission Scheme CodeIdentifier of the schemeYesMax 255; the input blocks special characters; read-only after creation (“The code cannot be modified after creation”). The backend CommissionSchemeHdrDataConsistencyObject does not check uniqueness — two schemes may carry the same code
StatusACTIVE / INACTIVEYesDefaults to ACTIVE. Only ACTIVE schemes are loaded by the posting and points processes (getActiveCommissionSchemes filters status = ACTIVE)
Commission Scheme NameDisplay nameYesMax 255, special characters blocked
DescriptionFree textNoMax 255 on create; character counter
Commission TypeSALES_AGENT or MLMYesDefaults to SALES_AGENT. Decides whether the posting run walks the customer’s MLM lineage (see Lifecycle)
Created By / Created Date / Updated By / Updated DateAudit columns—Read-only on Main Details

On CREATE the effect writes the header with all three rule groups set to Rules Logic AND / Negation DISABLED and one Level 0 treatment whose commission and membership-points price source and operator are NA.

Rules tabs (Doc Hdr, Multi Line, Single Line)

Each tab has two group-level fields and a grid of rules (Rule Name, Rule Type, Negation Logic):

FieldMeaningRequiredNotes
Rules LogicAND (every rule in the group must pass) or OR (any rule)YesStored as top_level_logic; default AND
Negation LogicENABLED inverts the result of the whole groupYesStored as negation_logic = TRUE/FALSE; default DISABLED

Every rule form carries Rule Name (required, max 255) and its own Negation Logic (inverts that one rule). Each rule type can be added once per tab — a second attempt shows “RuleType already exists. Cannot add rule with same ruleType again” and returns to the tab.

Edit Commission Scheme on the Rules - Doc Hdr tab: Rules Logic and Negation Logic drop-downs above a grid of three rules, one of them a Sales Group rule
A Rules - Doc Hdr tab with Rules Logic set to OR. The Sales Group rule in this grid always evaluates false (see the table below), so here it adds nothing; under AND it would disqualify every document.

Rules - Doc Hdr (document-level; rule types in the dropdown):

Rule typeFormWhat the backend compares it with
Valid Date RangeRelative Period (period + unit Day(s)/Month(s)/Year(s)) or Absolute Period (From / To dates)Absolute: document date_txn between From and To inclusive (an unparsable bound is ignored). Relative is not implemented — it always evaluates false
Entity TypeAll Entity, or Selected Entity with All Customer / All Supplier / All Employee / All Merchant“All” passes; “Selected” checks the document customer’s is_customer / is_supplier / is_employee / is_merchant flags
Member ClassPick member classesThe member on the document (member_guid) → membership card → membership_class_guid is one of the picked classes; no member on the document → false
Member LabelPick member labelsPasses when the document’s member has any CRM label link — the picked labels are not compared
CompanyPick companiesDocument guid_comp
BranchPick branchesDocument guid_branch
Sales GroupPick sales groupsNot implemented in the backend (// TODO): the rule always evaluates false, so with Rules Logic AND it disqualifies every document, and with Negation ENABLED it always passes
Document TypeCheckboxes Sales Contract, Receipt Voucher, Sales Order, Sales InvoiceSales Order = INTERNAL_SALES_ORDER; Sales Invoice = INTERNAL_SALES_INVOICE or INTERNAL_SALES_CASHBILL; Receipt Voucher = INTERNAL_RECEIPT_VOUCHER. Sales Contract is never evaluated
Employee CategoryPick employee categories (EMPLOYEE_CATEGORIES labels)Categories of the document’s sales agent (sales_entity_hdr_guid); no sales agent → false

A Company, Branch, Member Class, Member Label, Sales Group or Employee Category rule saved with an empty pick list passes unconditionally (the negation is not applied either).

Rules - Multi Line and Rules - Single Line (item-level; same dropdown):

Rule typeFormMatch
ItemPick items; Min Quantity, Min Amount (default 0)item_guid of the line
Item CategoryPick categories; Min Quantity, Min AmountAny category of the line’s item
Item Code Regex / Item Name RegexName + Regular Expression rowsRegex found anywhere in item_code / item_name
Category Code Regex / Category Name RegexName + Regular Expression rowsRegex found in any of the item’s category codes / names

Only lines with transaction type PNS (product and service lines) are considered. Multi Line is evaluated on the whole document: the matching lines are collected, then their summed quantity_base must be ≥ Min Quantity and summed amount_txn ≥ Min Amount (no matching line → rule fails). Single Line is evaluated per line during treatment: each line must individually match and meet both minimums, and only matching lines earn commission or points.

Treatment tab

Edit Commission Scheme on the Treatment tab: the Level 0 (Self) block with a Commission row, the Below Cost checkbox, a Membership Points row with a Pts Currency drop-down and a validity period, and an Add Uplines button
The Level 0 block. Pts Currency is the box to check: the points run needs one on every active scheme a document matches, including schemes built only for commission.

One block per level; Level 0 (Self) always exists, Add Uplines appends Level 1 (Parent), Level 2 … up to 10 levels (MAX_DOWNLINE); the last level can be deleted.

FieldMeaningRequiredNotes
Commission › Price SourceBase amount for cash commissionNo (default NA)Doc Hdr Standard / Net / Transaction / Open Balance Amount; Doc Line Standard / Net / Transaction Amount; Base Quantity; Price Unit Cost; Pricing Scheme; NA
Commission › OperatorHow the value is appliedNo (default NA)MULTIPLY, ABSOLUTE, ADD, SUBTRACT, PRICING MODEL, FORMULA, NA
Commission › ValueNumberNo (default 0)Rate for MULTIPLY (0.05 = 5 %), fixed amount for ABSOLUTE
Commission › Pricing SchemeShown when Price Source = Pricing Scheme—Dropdown of pricing schemes
Commission › FormulaShown when Operator = FORMULA—Hint: {PRICE_SOURCE}*(150-{DAY})/150*0.016
Commission › Pricing ModelShown when Operator = PRICING MODEL—Dropdown of this applet’s pricing models
Commission › Below CostCheckbox, default checked—Unchecked: line-level commission is zero when the price-source value is below the line’s unit moving-average cost
Membership Points › Price Source / Operator / ValueSame lists as commissionNo (defaults NA / NA / 0)Pricing Model and Formula operators have no effect for points
Membership Points › Pts CurrencyPoints currency—From the PTS CCY Module in Membership Admin. The screen lets you leave it empty, but the scheduled points run needs one on every active scheme a document matches — including a scheme you built only for cash commission. If any matching scheme has none, the run fails for that document and no scheme awards it points. The currency’s code is copied onto the points report when it is created
Membership Points › Validity Period (Days)Days the points stay validNo (default 0)Validity starts at the document’s date_txn
Membership Points › Pricing SchemeShown when Price Source = Pricing Scheme—

Sales Group

FieldMeaningRequiredNotes
Sales Group CodeIdentifierYesBackend rejects a duplicate
StatusACTIVE / INACTIVEYesDefault ACTIVE
Salesman tab › +Multi-select grid of entities flagged as employees (Salesman Code = employee code, Salesman Name)—Adds the employee to the group; linking the same employee twice is rejected
Salesman tab › WeightageNumber on the link edit form (default 0)NoStored in the link’s property_json.weightage; not read by the commission backend

A sales group also has a Sales Group Name (required) and a free-text Description.

Pricing Model

FieldMeaningRequiredNotes
Pricing Model Code / NameIdentifier and display nameYesNo uniqueness check in the backend DCO
Logic CodeFree textYesRequired, but only a label: nothing that calculates commission reads it. Use it for your own reference — for example, the sales-policy clause the bands come from
Logic TypeTIERED or VOLUMEYesDefault TIERED; stored only — the engine applies the same first-matching-band lookup for both
Line › Range From / Range ToBand boundariesYesMatched as from ≤ value < to against the price-source value, so a value exactly equal to one band’s To belongs to the next band. The band’s rate applies to the whole value, not only the part inside the band. A value below the lowest From or at or above the highest To earns 0, so give the top band a To well above any real sale. Nothing checks that From is below To or that bands do not overlap, and where two bands overlap which one applies is not defined — keep them end to end
Line › Commission Operator + ValueMULTIPLY or ABSOLUTE with a numberOne of commission or point valueMULTIPLY stores the number in commission_multiplier, ABSOLUTE in commission_value (the other column is written as 0); the edit form infers the operator from whichever column is > 0
Line › Membership Point Operator + ValueSame patternStored in membership_point_multiplier / membership_point_value; not read by any backend service

The line form enforces “Please enter one of the following fields: Commission Value or Membership Point Value”.

Edit Pricing Model with code, name, logic code and logic type above a grid of two bands, each with Range From, Range To, a commission multiplier and a commission absolute value
Two bands laid end to end, one paying a multiplier and one a fixed amount. A sale at or above the top band's Range To earns 0, so the last band needs a To well above any real sale.

Lifecycle and effects

Commission schemes, sales groups and pricing models are master data: no posting status, no journal, no stock. DELETE does not check whether websites, MLM programs or existing commission reports still use the scheme.

How a scheme is evaluated

  1. Load every scheme with status ACTIVE.
  2. For each scheme, each rule group is checked. Doc Hdr and Multi Line groups are evaluated against the whole document and both must pass. Inside a group the rule results are combined with AND or OR and then the group’s negation is applied; an empty group passes.
  3. If the scheme has Single Line rules, the treatment is computed line by line (only PNS lines) and summed; otherwise it is computed once on the document.
  4. A scheme is kept for cash commission only if at least one level has a commission price source other than NA and an operator other than NA.

How the treatment amount is computed

  • Price source: header amounts are the document’s standard, net, transaction or open-balance amount; line amounts and Base Quantity are summed over the goods lines (or the single line); Price Unit Cost = Σ moving-average cost price × base quantity; Pricing Scheme = the item’s sales unit price in the chosen scheme × base quantity.
  • Operator: MULTIPLY = source × value; ABSOLUTE = value; ADD / SUBTRACT = source ± value; FORMULA = the expression evaluated with {PRICE_SOURCE} replaced by the source (or, for receipt vouchers, the contra amount) and {DAY} by the days between the invoice date and the receipt’s contra date (0 when there is no contra) — a parse error or a negative result yields 0; NA = 0.
  • PRICING MODEL is not applied when a document is evaluated (it gives 0 there). It is applied only to the intermediate lines of a commission cycle (create full commission in the Sales Commission Applet): the first band that contains the summed source value is used — its commission multiplier when non-zero, otherwise its commission value.
  • Below Cost unchecked: for line-level commission, if the price-source value is lower than the line’s moving-average cost per unit the commission for that line is 0.

Cash commission (Sales Commission Applet)

The commission posting (the SALES_COMMISSION_POSTING_JOB_PROCESSOR job, or a run from the Sales Commission Applet) loads the document, refuses it if its commission has already been posted, finds the matching schemes with a usable treatment, and writes one intermediate commission line per scheme (per line when Single Line rules or MLM are involved). Then it marks the document’s commission as posted. Details that matter for scheme design:

  • SALES_AGENT schemes use the Level 0 treatment for the document’s sales agent.
  • MLM schemes look up the customer’s MLM lineage: each upline at level n receives the Level n treatment, computed per line.
  • A Receipt Voucher earns commission only through its contra links to invoices; an RV with no contra produces nothing. This is the path where {DAY} in a formula is meaningful.

Membership points (scheduled)

The scheduled job MEMBERSHIP_POINTS_COMMISSION_QUEUE_PROCESSOR (schedule it in the Scheduler) selects documents of the type and status the company’s member-point settings name, whose points commission has not yet been posted, evaluates the rules (treatment presence is not checked) and applies only the first treatment’s Membership Points block (“Supports only 1 treatment”), creating a membership-points commission report valid from the transaction date to the transaction date + Validity Period. The same number can be previewed for one document through the API.

Other references

  • CP Commerce Admin › Website › Commission Scheme links a website to a scheme.
  • Membership Admin MLM programs carry a commission scheme.

Related applets

Troubleshooting

SymptomCauseFix
A scheme with a Sales Group rule never matches any documentThe backend has no evaluation for SALES_GROUP (CommissionSchemeGenericRuleNode falls through to false)Remove the rule; restrict by Employee Category on the sales agent instead, or by Branch / Company. Do not rely on Negation to “fix” it — a negated Sales Group rule passes every document
A Valid Date Range rule set to Relative Period never matchesOnly ABSOLUTE is implemented; RELATIVE returns falseUse Absolute Period with explicit From / To dates
Member Label rule pays every member, not just the labelled onesThe rule only checks that the member has some label link; the picked labels are ignoredUse Member Class, or accept the behaviour until the rule is fixed
Commission expected on Sales Contracts never appearsThe Sales Contract checkbox is stored but never evaluated; only SO, SI/cash bill and RV server types matchPay on the resulting invoice instead
Treatment with Operator PRICING MODEL yields 0 in the commission transaction linesThe document path returns 0 for PRICING MODEL; it is applied only during the cycle’s full-commission pass on intermediate linesRun the full commission generation in the Sales Commission Applet, or use MULTIPLY / ABSOLUTE for per-document amounts
Points from Level 1 or higher are never awardedThe points run uses the first treatment onlyPut the points logic on Level 0
Scheme matches but the commission amount is 0Price source or operator left at NA, Value 0, a FORMULA that fails to parse or evaluates negative, or Below Cost unchecked with a selling price below unit costCheck the treatment values; test a formula with {PRICE_SOURCE} only before adding {DAY}
An empty Company / Branch / Item rule “applies to everything”A rule with no picked values passes unconditionallyPick at least one value or delete the rule
“RuleType already exists. Cannot add rule with same ruleType again”One rule per type per tabEdit the existing rule (click its row) and add values there
Rule or treatment changes vanished after navigating awayRules and filter values only live in the browser draft until SAVE on Edit Commission SchemeSave before leaving the scheme
Two schemes with the same codeThe backend does not enforce code uniquenessRename one; downstream reports show the scheme guid, so duplicates are confusing rather than blocking
Re-running the posting for a document is refused as already postedposting_sales_commission_queue is already POSTED for that documentUse the regenerate endpoint from the Sales Commission Applet rather than re-posting
Field Settings / Personal Default Selection do nothingPlaceholder screens (see Configuration)Nothing to configure there
Applet build or deployment problems after the Angular 14 migrationTracked in the applet repository (issue #5, closed)Upgrade to the current build

Related documentation

Last updated on