# Minimum Margin Setting

<p class="doc-lead">Minimum Margin Settings stop approval of a sale quotation, sale order, or sale invoice when the document margin is below a configured percentage. The rule can apply to one customer, a customer group, a customer category, or everyone. Selected users can confirm and bypass it.</p>

<div class="doc-toc">
<p class="doc-toc-title">On this page</p>
<div class="doc-toc-section">
<div class="doc-toc-links">
<a href="#/sales/minimum-margin-setting?id=overview">Overview</a>
<a href="#/sales/minimum-margin-setting?id=fields">Fields</a>
<a href="#/sales/minimum-margin-setting?id=how-it-works">How It Works</a>
<a href="#/sales/minimum-margin-setting?id=cost">Cost used</a>
<a href="#/sales/minimum-margin-setting?id=messages">Messages</a>
<a href="#/sales/minimum-margin-setting?id=profit-summary">Profit Summary</a>
<a href="#/sales/minimum-margin-setting?id=actions">Actions</a>
<a href="#/sales/minimum-margin-setting?id=faq">FAQ</a>
<a href="#/sales/minimum-margin-setting?id=related">Related</a>
</div>
</div>
</div>

<hr class="doc-section-divider">

<h2 id="overview">Overview &amp; List View</h2>

Go to <b>Sales → Settings → Minimum Margin Settings</b> from the left menu.

Create one setting per scope (customer, group, category, or everyone). Only <b>Active</b> settings apply. There is no effective date. When several active settings match the same scope, the one updated most recently is used.

This check is separate from <a href="#/sales/credit-limit-setting">Credit Limit Setting</a> and from <b>Prevent under cost sale</b> in <a href="#/sales/sale-settings-config">Sale Settings</a>. A document can fail one check and pass the others.

<b>List columns</b>

| **Column** | **Description** |
|------------|-----------------|
| Id | Setting record ID. |
| Customer | Customer scope when set. |
| Customer Group | Group scope when set. |
| Customer Category | Category scope when set. |
| Minimum Margin % | Lowest allowed margin on the document. |

<b>Quick filter tabs</b>

| **Tab** | **Shows** |
|---------|-----------|
| Active | Active minimum margin settings (default). |
| Suspended | Suspended settings. Suspended settings are not used on approve. |

<b>Advanced filters</b>

| **Filter** | **Description** |
|------------|-----------------|
| Id | Filter by record ID. |
| Customer, Customer Group, Customer Category | Scope filters. |
| Status | Active or Suspended. |

<b>List row actions</b>

| **Action** | **Description** |
|------------|-----------------|
| View | Opens read-only details. |
| Edit | Opens the edit form. |
| Delete | Removes the setting. |

<hr class="doc-section-divider">

<h2 id="fields">Fields</h2>

<h3>Basic</h3>

| **Field** | **Description** |
|-----------|-----------------|
| Customer | Optional. Applies to one customer. Highest precedence when set. |
| Customer Group | Optional. Applies to customers in the group when no customer-specific rule matches. Do not set this together with Customer Category. |
| Customer Category | Optional. Applies when no customer or group rule matches. Do not set this together with Customer Group. Shown when the user can list customer categories. |
| Minimum Margin % * | Required. The document margin must be at least this percentage. <b>0</b> is a valid minimum (the sale must not be below cost). Leave the scope fields empty to apply the rule to every customer. |

<h3>Bypass &amp; Transaction Rules</h3>

| **Field** | **Description** |
|-----------|-----------------|
| Allowed Transaction Types | Which documents run the check on approve: Sale Invoice, Sale Order, Sale Quotation. A new setting selects all three. If none are selected, the check runs on all three. |
| Users allowed to bypass | Users who can approve below the minimum after a confirm. The document records that minimum margin was bypassed. |

<hr class="doc-section-divider">

<h2 id="how-it-works">How It Works</h2>

<h3>When it runs</h3>

The check runs on <b>Approve</b> and <b>Save And Approve</b> for each transaction type selected under <b>Allowed Transaction Types</b>. Saving a draft is not blocked. <b>Master Update</b> does not run the check again.

The comparison is for the whole document, not each line.

<h3>Setting precedence</h3>

When several active settings could match, the system picks the most specific scope, then the newest update inside that scope:

<ol>
<li><b>Customer</b> — setting with this customer's ID</li>
<li><b>Customer Group</b> — setting for the customer's group</li>
<li><b>Customer Category</b> — setting for the customer's category</li>
<li><b>Everyone</b> — setting with no customer, group, or category</li>
</ol>

If two active rows share that same scope, the row with the latest update wins.

<h3>When nothing is checked</h3>

Approve continues with no margin message when any of these is true:

<ul>
<li>No active setting matches the customer, group, category, or everyone.</li>
<li><b>Minimum Margin %</b> is blank. Zero is not blank — a minimum of 0% is enforced.</li>
<li>The document type is not in <b>Allowed Transaction Types</b>, and at least one type is selected.</li>
<li>Taxable amount and cost are both zero.</li>
</ul>

<h3>Margin formula</h3>

<p>Margin % = (taxable amount − cost) ÷ taxable amount × 100.</p>

Taxable amount is the document taxable total. Cost depends on the document — see <a href="#/sales/minimum-margin-setting?id=cost">Cost used</a>. Service lines and fixed-asset lines stay in the taxable amount and are left out of cost.

Approve is blocked when the margin is below <b>Minimum Margin %</b>. If taxable amount is zero and cost is greater than zero, approve is blocked.

<p><b>Example.</b> Taxable 330, cost 300, minimum 20%.</p>
<ul>
<li>Margin = (330 − 300) ÷ 330 × 100 = 9.09%. That is below 20%, so approve is blocked.</li>
<li>Taxable needed to reach 20% = 300 ÷ (1 − 20 ÷ 100) = 375.</li>
<li>Margin value needed = 375 − 300 = 75.</li>
</ul>

If the minimum is 100% or more, no taxable amount can meet it while cost is greater than zero. The message says so instead of showing a required taxable figure.

<h3>Bypass</h3>

Users who are not in <b>Users allowed to bypass</b> cannot approve. Users who are listed see the same figures and a confirm: <i>You are about to sell below the minimum margin. Do you want to proceed and bypass the limit?</i> Confirming approves the document and records the bypass. Cancelling leaves the document unapproved.

The same confirm is used when estimated cost is missing on a quotation or order. Confirming in that case approves without a further margin comparison on that attempt.

<hr class="doc-section-divider">

<h2 id="cost">Cost used</h2>

<h3>Sale invoice</h3>

Cost is the inventory cost posted on approve (cost of goods sold), not the estimate on the Profit Summary tab.

<ul>
<li><b>Direct invoice</b> — quantity issued × unit inventory value at approve.</li>
<li><b>Invoice from a delivery note</b> — the cost already posted on the delivery, reduced by any inward (return) quantity on that delivery.</li>
</ul>

<h3>Sale quotation and sale order</h3>

Cost is an estimate. There is no posted inventory cost yet. For each stock line, unit cost follows <a href="#/inventory/reports/item-enquiry">Item Enquiry</a>, then falls back to average inventory value. Quantity is the line net quantity.

| **What is set on the item** | **Unit cost** |
|-----------------------------|---------------|
| <b>Est. cost (value)</b> is filled | That amount. It is a unit value, not a percentage, and it wins over the margin %. Same priority as Item Enquiry. |
| <b>Estimated cost margin %</b> is set, and the item is in stock | Average unit value × (1 + margin % ÷ 100). The percentage is added on the average. |
| No estimated cost, and the item is in stock | Average unit value across all centers. |
| No stock, and <b>Show estimated cost on zero stock</b> is on, and the item has a last purchase price | Last purchase price × (1 + add-on % ÷ 100 + margin % ÷ 100). Margin % is treated as 0 when it is not set. Add-on % is <b>Estimated cost add-on % in zero stock</b> in <a href="#/sales/sale-settings-config?id=price">Sale Settings → Price</a>. |
| No stock, the zero-stock setting is off or there is no last purchase price, and Est. cost (value) is empty | Estimated cost is not available. Approve is blocked unless the user bypasses. |

<p><b>Example.</b> Apple Juice has 8 PCS in stock, average unit value 481.68, and no estimated cost on the item. A quotation for 1 PCS at taxable 500 uses cost 481.68. Margin is about 3.66%. If the minimum is 20%, approve is blocked and the message asks for taxable 602.10 and margin value 120.42.</p>

Service and fixed-asset lines are not costed. Their taxable amount is still part of the document total.

<hr class="doc-section-divider">

<h2 id="messages">Messages</h2>

Each figure is on its own line.

<b>Margin below the minimum</b> (users who cannot bypass):

<pre>Sale margin is below the minimum.
Taxable: 330
Cost: 300
Margin: 9.09%
Minimum margin: 20%
Required taxable: 375
Required margin value: 75</pre>

When taxable amount is zero and cost is greater than zero, the Margin line is omitted.

When the minimum is 100% or more, the last two lines are replaced by: <i>Required taxable: a minimum margin of {minimum}% cannot be met with cost {cost}</i>.

<b>Bypass confirm</b> — the same text, then a blank line, then:

<pre>You are about to sell below the minimum margin. Do you want to proceed and bypass the limit?</pre>

<b>Estimated cost missing</b> (sale quotation and sale order only):

<pre>Estimated cost is not available for Apple Juice 1 Ltr (line 1)</pre>

Several lines are listed together, separated by commas. The line number is the line serial number.

<hr class="doc-section-divider">

<h2 id="profit-summary">Estimated Profit Summary</h2>

The <b>Profit Summary</b> tab on the document is a preview. It is not the number used to block approve, except that both can use average inventory value when no estimated cost is set.

The compact tab shows profit, markup %, and margin %. Expand it to also see sale amount and cost per item, plus sale amount, sale cost, total profit, total markup %, and total margin %.

Cost-source notes are shown on screen and hidden when you print the summary.

<h3>Draft or pre-approved sale invoice</h3>

Cost is the average inventory value in the invoice <b>shipping center</b>. Each line is costed on its own.

| **Stock** | **Cost** | **Note under the item** | **Banner** |
|-----------|----------|-------------------------|------------|
| In the shipping center | Average in that center | None | Average cost from {center}. |
| Not in that center, but in another center | Average of all centers | All centers | No stock in {center}. Average of all centers. |
| No stock anywhere, purchase price is set | Item master purchase price | Item cost price | No stock. Item cost price is used where set. |
| No stock anywhere, purchase price is blank | Zero | No stock | No stock. Item cost price is used where set. |
| Mix of center stock and other sources | Each line as above | All centers, Item cost price, or No stock on the exception lines | Average cost from {center}. Other sources are shown on the item. |
| Mix of all-center average and purchase price, nothing in the shipping center | Each line as above | As above | No stock in {center}. Source is shown on the item. |

<h3>Open sale quotation or sale order</h3>

While the document is not yet covered by an approved invoice, cost is the average of all centers. If there is no stock, the item purchase price is used and the item shows <b>Item cost price</b> or <b>No stock</b>. The banner is <i>Source is shown on the item.</i> This preview does not add estimated cost margin % and does not use Est. cost (value). The approve check does — see <a href="#/sales/minimum-margin-setting?id=cost">Cost used</a>.

<h3>Approved sale invoice</h3>

After the invoice is approved or closed, Profit Summary uses posted cost (the same basis as <a href="#/sales/reports/profit-bill-report">Bill Wise Profit Report</a>), including sale expenses. The estimate notes above are not shown.

<hr class="doc-section-divider">

<h2 id="actions">Actions</h2>

<b>List header:</b> <b>New</b>

| **Action** | **Description** |
|------------|-----------------|
| Edit | Opens the minimum margin form |
| Delete | Removes the setting |
| Clone | Creates a copy |
| Activate / Suspend | Enables or disables the setting |
| Print | Prints the setting detail |
| Export | Exports the list |

<b>Form buttons:</b> <b>Save</b> / <b>Update</b>, <b>Reset</b>, <b>Cancel</b>

<hr class="doc-section-divider">

<h2 id="faq">FAQ</h2>

<b>Does minimum margin apply on save?</b><br>
No. The check runs on <b>Approve</b> and <b>Save And Approve</b> for the transaction types you select.

<b>Is this the same as Prevent under cost sale?</b><br>
No. Prevent under cost sale blocks a line whose rate is below item cost or estimated cost. Minimum margin compares the document taxable total with cost and blocks when the percentage is below the setting. Both can be on at the same time.

<b>Is this the same as credit limit?</b><br>
No. Credit limit checks bill total, outstanding, open bill count, and credit days. Minimum margin checks profitability. Bypass works the same way: listed users confirm once, and the document records the bypass.

<b>Can I set both a customer group and a customer category?</b><br>
No. Save shows <i>Both Customer Group and Customer Category are present. Only one should be set.</i> Use a customer row, or a group row, or a category row, or a row with none of them.

<b>What if I need a different minimum for one customer?</b><br>
Add a setting with that customer. It wins over the group, category, and everyone settings.

<b>Why was a quotation blocked when Item Enquiry shows an average value?</b><br>
If the item has stock and no estimated cost, the quotation uses that average. The block is then the margin percentage, not a missing cost. Read <b>Margin</b>, <b>Minimum margin</b>, <b>Required taxable</b>, and <b>Required margin value</b> on the message.

<b>Why does Profit Summary show a different cost than the approve message?</b><br>
On a quotation or order, Profit Summary uses average inventory value (or purchase price when there is no stock). Approve uses Est. cost (value) or average plus estimated cost margin % when those are set on the item. On a draft invoice, Profit Summary uses the shipping-center average. Approve of the invoice uses the inventory cost posted at that moment.

<b>Do the cost notes print?</b><br>
No. The banner and the source under each item (<b>All centers</b>, <b>Item cost price</b>, <b>No stock</b>) stay on screen and are left out of the print. Amounts still print.

<hr class="doc-section-divider">

<h2 id="related">Related Topics</h2>

<ul>
<li><a href="#/sales/sale-quotation">Sale Quotation</a></li>
<li><a href="#/sales/sale-order">Sale Order</a></li>
<li><a href="#/sales/sale-invoice">Sale Invoice</a></li>
<li><a href="#/sales/credit-limit-setting">Credit Limit Setting</a></li>
<li><a href="#/sales/estimated-cost-margin">Estimated Cost Margin</a></li>
<li><a href="#/inventory/reports/item-enquiry">Item Enquiry</a></li>
<li><a href="#/sales/customers">Customers</a></li>
<li><a href="#/sales/customer-groups">Customer Groups</a></li>
<li><a href="#/sales/customer-categories">Customer Category</a></li>
<li><a href="#/sales/sale-settings">Sale Settings hub</a></li>
</ul>

<section class="ai-index-only">

## Errors and warnings

Exact messages for Minimum Margin Setting and for the approve check on Sale Quotation, Sale Order, and Sale Invoice. Visitors do not see this section; Vertex AI Search uses it to answer questions about on-screen errors.

### Customer group and customer category both set

- **Type:** Error (blocks save of the setting)
- **Action:** Save, Update on Minimum Margin Setting
- **When:** The form has both **Customer Group** and **Customer Category**.
- **Example message:** *Both Customer Group and Customer Category are present. Only one should be set.*
- **Outcome:** The setting is not saved.
- **Solution:** Clear either Customer Group or Customer Category. A customer-only row, a group-only row, a category-only row, or a row with none of them is valid.

### Minimum margin percent required

- **Type:** Error (blocks save of the setting)
- **Action:** Save, Update
- **When:** **Minimum Margin %** is empty.
- **Example message:** *Field is required* on Minimum Margin %.
- **Outcome:** The setting is not saved. A blank minimum on a saved row would not block sales; zero is a real minimum and must be entered as 0.
- **Solution:** Enter the percentage, including 0 if sales at cost should pass and only below-cost sales should fail.

### Sale margin below the minimum

- **Type:** Error (blocks approve unless the user may bypass)
- **Action:** Approve, Save And Approve on Sale Invoice, Sale Order, or Sale Quotation. Draft Save is not checked. Master Update is not checked.
- **When:** An active Minimum Margin Setting matches this customer (customer, then group, then category, then everyone with no scope). This document type is included (or Allowed Transaction Types is empty, which means all three). Document margin is below **Minimum Margin %**. Margin % = (taxable amount − cost) ÷ taxable amount × 100. Sale invoice cost is posted inventory cost. Sale order and sale quotation cost is estimated: Est. cost (value) if set, otherwise average unit value plus estimated cost margin % when that percent is set, otherwise average unit value when the item is in stock. Service and fixed-asset lines are in the taxable total and not in cost.
- **Example message:** *Sale margin is below the minimum.* then one figure per line: *Taxable: 330* / *Cost: 300* / *Margin: 9.09%* / *Minimum margin: 20%* / *Required taxable: 375* / *Required margin value: 75*. Bypass users see the same text, a blank line, then *You are about to sell below the minimum margin. Do you want to proceed and bypass the limit?*
- **Outcome:** Approve fails for users who are not in **Users allowed to bypass**. Bypass users can confirm and proceed; the document records that minimum margin was bypassed. Cancelling the confirm leaves the document unapproved.
- **Solution:** Raise the taxable amount to at least **Required taxable** (the margin value of that increase is **Required margin value**), lower cost, or ask an administrator to add this user under Users allowed to bypass. Prevent under cost sale is a different message (*Sale price is less than item cost…*) and is not cleared by this bypass.

### Taxable amount is zero and cost is greater than zero

- **Type:** Error (blocks approve unless the user may bypass)
- **Action:** Approve, Save And Approve
- **When:** The matched minimum margin setting applies, taxable amount is 0, and cost is greater than 0. Margin cannot be calculated.
- **Example message:** *Sale margin is below the minimum.* / *Taxable: 0* / *Cost: {cost}* / *Minimum margin: {minimum}%* and, when the minimum is under 100%, *Required taxable* and *Required margin value*. The Margin line is omitted. Bypass users also see *You are about to sell below the minimum margin. Do you want to proceed and bypass the limit?*
- **Outcome:** Same as a margin breach: blocked, or bypass after confirm.
- **Solution:** Enter a taxable amount at least equal to **Required taxable**, or bypass if allowed.

### Minimum margin is 100% or more

- **Type:** Error (blocks approve unless the user may bypass)
- **Action:** Approve, Save And Approve
- **When:** The matched **Minimum Margin %** is 100 or higher and cost is greater than zero. No taxable amount can produce that margin.
- **Example message:** The usual margin lines, then *Required taxable: a minimum margin of {minimum}% cannot be met with cost {cost}* instead of Required taxable and Required margin value figures.
- **Outcome:** Approve is blocked unless the user confirms a bypass.
- **Solution:** Lower the minimum below 100% on the setting, or add the user under Users allowed to bypass.

### Estimated cost is not available

- **Type:** Error (blocks approve of Sale Quotation or Sale Order unless the user may bypass)
- **Action:** Approve, Save And Approve. Not used on Sale Invoice (invoice cost comes from posted inventory).
- **When:** A stock line has no usable cost. Est. cost (value) is empty, the item is not in stock (quantity is zero or there is no positive average unit value), and the zero-stock estimate does not apply (Show estimated cost on zero stock is off, or there is no last purchase price). Service and fixed-asset lines are skipped and do not cause this message.
- **Example message:** *Estimated cost is not available for {item name} (line {serial})*. Several items are joined with commas. Bypass users see that text plus *You are about to sell below the minimum margin. Do you want to proceed and bypass the limit?*
- **Outcome:** Approve fails. If a bypass user confirms, the document is approved and the margin percentage is not compared on that attempt. The document records that minimum margin was bypassed.
- **Solution:** Receive stock so an average unit value exists, set **Est. cost (value)** or **Estimated cost margin %** on the item (margin % still needs stock, or the zero-stock sale setting plus a last purchase price), turn on **Show estimated cost on zero stock** when a last purchase exists, or add the user under Users allowed to bypass.

### Both taxable amount and cost are zero

- **Type:** Not an error
- **Action:** Approve, Save And Approve
- **When:** Taxable amount is 0 and cost is 0, even if a minimum margin setting matches.
- **Example message:** None.
- **Outcome:** The minimum margin check is skipped. Other checks, such as credit limit, still run.
- **Solution:** No change is required for minimum margin.

### No matching setting, blank minimum, or document type excluded

- **Type:** Not an error
- **Action:** Approve, Save And Approve
- **When:** No active setting matches; or **Minimum Margin %** is blank; or **Allowed Transaction Types** lists one or more types and this document is not one of them. A suspended setting does not match.
- **Example message:** None from minimum margin.
- **Outcome:** Approve is not blocked by minimum margin.
- **Solution:** None. To start enforcing, activate a setting, enter a minimum (0 is valid), and include this document type.

### Bulk update of users allowed to bypass

- **Type:** Error
- **Action:** Set bypass users on selected minimum margin settings
- **When:** No settings are selected, no user is selected, or a selected setting no longer exists. If one row fails, that row is reported and the rest of the batch stops.
- **Example message:** *ids array is required* or *Select at least one user allowed to bypass* or *Minimum margin setting not found: 12* or *Setting {name}: could not update bypass users*
- **Outcome:** Bypass users are not updated for the failed row.
- **Solution:** Select at least one setting and at least one user. Refresh if a setting was deleted, then try again.

</section>
