# Estimated Cost Margin

<p class="doc-lead">Estimated Cost Margin sets per-item estimated cost for profit reporting — either as a margin percentage off reference costs or as a direct estimated cost value. Values sync to Basic Pricing when the estimated cost columns are enabled there.</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/estimated-cost-margin?id=overview">Overview</a>
<a href="#/sales/estimated-cost-margin?id=fields">Fields</a>
<a href="#/sales/estimated-cost-margin?id=how-it-works">How It Works</a>
<a href="#/sales/estimated-cost-margin?id=actions">Actions</a>
<a href="#/sales/estimated-cost-margin?id=faq">FAQ</a>
<a href="#/sales/estimated-cost-margin?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 → Estimated Cost Margin</b> from the left menu.

<p><b>Server calculation.</b> Reference costs, <b>By Value</b>, and enquiry-style estimated cost are calculated on the server (same rules as <a href="#/inventory/reports/item-enquiry">Item Enquiry</a>). The screen displays API values; you only edit margin %, By Value, or Est. cost (value).</p>

<b>List columns</b>

| **Column** | **Description** |
|------------|-----------------|
| Item Code | Item identifier. Click for item quick view. |
| Item Name | Item description. |
| Last Purchase Price | Most recent purchase rate for reference. |
| Last Purchase Date | Date of last purchase. |
| Avg Inventory Value | Average inventory unit value for reference. |
| Set Margin (By % / By Value) | Margin mode and value for estimated cost. |
| Est. cost (value) | Calculated or entered estimated cost. |

<b>Filters</b>

| **Control** | **Description** |
|-------------|-----------------|
| Item Group | Optional filter. Click <b>Generate</b> to load items in the selected group. |
| Brand | Optional filter. Limit the list to one brand. |
| Item | Optional filter. Load a single active item. |
| Apply % to all rows | Bulk-apply a margin percentage to every row on the current page. |

<b>List widgets</b>

| **Widget** | **Description** |
|------------|-----------------|
| Priority color-coding | Highlights rows where estimated cost differs from reference costs. |
| Item quick view | Click an item code to preview the item. |
| Pagination | Navigate large item lists page by page. |

<b>Estimated Cost Margin</b>

<img src="sales/images/estimated-cost-margin.webp" alt="Estimated Cost Margin" loading="lazy">

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

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

| **Column** | **Description** |
|------------|-----------------|
| Item Code / Item Name | Item identifier and description. Click for quick view. |
| Last Purchase Price | Most recent purchase rate for reference. |
| Last Purchase Date | Date of last purchase. |
| Avg Inventory Value | Average inventory unit value for reference. |
| By % | Estimated cost margin percentage. Green highlight when margin % drives the cost. |
| By Value | Estimated cost from margin %, calculated on the server (rounded to 2 decimals). Matches <b>Estimated Cost</b> on <a href="#/inventory/reports/item-enquiry">Item Enquiry</a> when margin % drives the cost: average inventory value × (1 + margin % ÷ 100) when in stock, or last purchase price × (1 + add-on % ÷ 100 + margin % ÷ 100) for zero-stock items when <b>Show estimated cost on zero stock</b> is enabled. Green highlight when margin % has priority. |
| Est. cost (value) | Direct estimated cost override. Amber highlight when this value takes priority over margin %. |

<h3>Filters &amp; bulk actions</h3>

| **Control** | **Description** |
|-------------|-----------------|
| Item Group + Generate | Load items filtered by group. |
| Brand | Optional — narrow the list to one brand before Generate. |
| Item | Optional — load one active item before Generate. |
| Margin % + Apply % to all rows | Set the same margin percentage on all visible rows. |

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

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

<h3>Setting estimated cost</h3>

You can define estimated cost in two ways (per row):

<ol>
<li><b>Margin %</b> — enter By % directly, or enter By Value to derive the percentage. <b>By Value</b> is computed on the server when you click <b>Generate</b> (or after <b>Update</b>), using the same formula as Item Enquiry:
<ul>
<li><b>Stock on hand</b> — average inventory value × (1 + margin % ÷ 100)</li>
<li><b>Zero stock</b> (when <b>Show estimated cost on zero stock</b> is on) — last purchase price × (1 + add-on % ÷ 100 + margin % ÷ 100). Add-on % comes from <a href="#/sales/sale-settings-config?id=zero-stock-estimated-cost-addon-percent">Sale Settings → Price</a>; margin % from the row's By % field.</li>
</ul>
Displayed By Value is rounded to <b>two decimal places</b>.</li>
<li><b>Est. cost (value)</b> — enter a fixed estimated unit cost. When filled, this <b>takes higher priority</b> than margin % for profit calculation and enquiry display.</li>
</ol>

<p>Row highlighting indicates which method is active: green for margin-driven, amber for direct value priority.</p>

<h3>Where estimated cost is used</h3>

<ul>
<li><b>Prevent under cost sale</b> — when enabled in <a href="#/sales/sale-settings-config">Sale Settings</a>, sale rates below estimated cost can be blocked.</li>
<li><b>Profit on sale documents</b> — Profit Summary tab on sale quotation, order, and invoice view.</li>
<li><b>Profit reports</b> — <a href="#/sales/reports/profit-bill-report">Bill Wise Profit Report</a>, <a href="#/sales/reports/profit-item-report">Item Wise Profit Report</a>, <a href="#/sales/reports/profit-customer-report">Customer Wise Profit Report</a>, <a href="#/sales/reports/profit-employee-report">Employee Wise Profit Report</a>.</li>
<li><b>Basic Pricing</b> — Est. cost margin % and Est. cost (value) columns on <a href="#/sales/basic-pricing">Basic Pricing</a> when the feature is enabled for your company.</li>
<li><b>Item Enquiry</b> — <a href="#/inventory/reports/item-enquiry">Item Enquiry</a> and <a href="#/inventory/reports/item-wise-enquiry-report">Item-wise Enquiry Report</a> show calculated estimated cost (same rules on both). Item-wise Enquiry Report includes zero-stock items by default; use <b>More → Hide Zero Lines</b> to filter them out. When stock is zero, display follows <b>Show estimated cost on zero stock</b> and <b>Estimated cost add-on % in zero stock</b> in <a href="#/sales/sale-settings-config?id=price">Sale Settings → Price</a>.</li>
</ul>

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

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

| **Action** | **Description** |
|------------|-----------------|
| Generate | Loads items for the selected Item Group, Brand, and/or Item filters. |
| Apply % to all rows | Bulk-sets margin % on the current page. |
| Update | Saves all changed rows. |
| Export | Exports the grid to Excel. |

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

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

<b>Which takes priority — margin % or Est. cost (value)?</b><br>
Est. cost (value) wins when filled. Otherwise margin % (from By % or derived from By Value) is used.

<b>Can I filter by Brand or Item?</b><br>
Yes. Use the <b>Brand</b> and <b>Item</b> filters (along with <b>Item Group</b>), then click <b>Generate</b> to load only matching rows.

<b>Why is By Value blank for an item with no stock?</b><br>
By Value is calculated on the server. With stock on hand it uses average inventory value; with no stock it uses last purchase price, but only when <b>Show estimated cost on zero stock</b> is enabled in <a href="#/sales/sale-settings-config?id=price">Sale Settings → Price</a> and the item has a recorded last purchase price on an approved purchase invoice. If the setting is off, or there is neither stock nor a last purchase price, By Value stays blank.

<b>Why does By Value on this screen differ from Item Enquiry?</b><br>
It should match when the same margin % applies and <b>Est. cost (value)</b> is not set on the item. Both use the server formula above. If Item Enquiry shows a value but By Value is blank, click <b>Generate</b> again after saving Sale Settings. If <b>Est. cost (value)</b> is filled on the row, that fixed amount takes priority on enquiry screens instead of the margin-derived value.

<b>How many decimals does By Value show?</b><br>
By Value is rounded to two decimal places (same display precision as estimated cost on Item Enquiry).

<b>Does this change inventory valuation?</b><br>
No. Estimated cost is for sales profit reporting and under-cost validation only — not for inventory GL valuation.

<b>How does this affect profit reports?</b><br>
<a href="#/sales/reports/profit-reports">Profit Reports</a> use estimated cost when item ledger cost is unavailable or as configured for margin display.

<b>What happens when Prevent under cost sale is enabled?</b><br>
Sale approve can be blocked if the line rate is below item cost or estimated cost. Keep margins realistic on fast-moving items.

<b>Should I use percentage or fixed estimated cost?</b><br>
Use percentage for category-wide defaults. Use fixed value when you know landed cost for a specific SKU regardless of sale price.

<b>Does estimated margin update old invoices?</b><br>
No. Changes apply to new bills and profit reports going forward. Posted invoice profit is based on cost at approve time.

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

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

<ul>
<li><a href="#/sales/basic-pricing">Basic Pricing</a></li>
<li><a href="#/sales/reports/profit-reports">Profit Reports</a></li>
<li><a href="#/sales/sale-settings-config">Sale Settings</a></li>
<li><a href="#/sales/sale-settings">Sale Settings hub</a></li>
<li><a href="#/inventory/reports/item-enquiry">Item Enquiry</a></li>
<li><a href="#/inventory/reports/item-wise-enquiry-report">Item-wise Enquiry Report</a></li>
</ul>
