Sales Module
Complete guide to the NkapBooks Sales Module — manage quotes, invoices, payments, customers, items, loyalty programs, leads, pricing rules, coupon codes, and price lists.
4. Sales Module
The Sales Module manages the complete revenue cycle in NkapBooks — from generating a quote for a prospect to collecting payment and tracking customer loyalty. It is accessible from the Sales section in the sidebar and contains the following sub-modules:
| Sub-Module | Sidebar Entry | Description |
|---|---|---|
| Sales Quotes | Sales Quotes | Create and send quotations to customers or leads |
| Sales Invoices | Sales Invoices | Issue invoices for goods and services sold |
| Sales Payments | Sales Payments | Record payments received from customers |
| Customers | Customers | Manage customer contact and billing information |
| Sales Items | Sales Items | Define products and services available for sale |
| Loyalty Program | Loyalty Program | Configure point-based customer loyalty rewards |
| Lead Management | Lead | Track and convert sales prospects |
| Pricing Rules | Pricing Rule | Automate discounts based on conditions |
| Coupon Codes | Coupon Code | Create redeemable promotional codes |
| Price Lists | (via Invoice) | Maintain multiple price lists for different customer segments |
4.1 Sales Quotes
Sales Quotes (also called Quotations) allow you to prepare a formal pricing proposal for a customer or lead before creating an invoice. They follow the same structure as invoices but do not generate accounting ledger entries.
Schema Overview
| Field | Type | Description |
|---|---|---|
| Number Series | Link → NumberSeries | Auto-generated identifier (default prefix: SQUOT-) |
| Reference Type | Select | Party (existing customer) or Lead (sales prospect) |
| Customer | DynamicLink | Links to a Party or Lead record depending on Reference Type |
| Date | Datetime | Quote creation date |
| Price List | Link → PriceList | Optional price list to apply per-item rates |
| Items | Table → SalesQuoteItem | Line items with item, quantity, rate, tax, discount, and amount |
| Net Total | Currency | Sum of all line item amounts before tax |
| Taxes | Table → TaxSummary | Automatic tax breakdown by tax account |
| Grand Total | Currency | Net Total + Taxes − Discounts |
| Notes | Text | Free-text field for quote terms and conditions |
| Discount | Currency / Percent | Invoice-level discount (amount or percentage) |
| Exchange Rate | Float | Applied when customer currency differs from company currency |
Quote Lifecycle
Draft → Submitted → Converted to Invoice
→ Cancelled
- Draft — The quote is created and can be freely edited. Items, rates, taxes, and discounts can be modified.
- Submitted — The quote is finalized. No further edits are allowed. The quote can now be converted to a Sales Invoice.
- Converted — When the "Sales Invoice" action is triggered, a new Sales Invoice is created with all items, rates, and terms copied from the quote. The invoice's
quotefield links back to the original quote. - Cancelled — A submitted quote can be cancelled if it is no longer needed.
Key Features
- One-Click Conversion — Use the Create → Sales Invoice action to convert a submitted quote into a Sales Invoice. All line items, quantities, rates, taxes, and terms are carried over.
- Multi-Currency — If the customer has a different default currency, the exchange rate is automatically fetched and applied to all amounts.
- Tax Templates — Taxes are calculated automatically based on the tax template assigned to each item.
- Print / PDF Export — Generate professional PDF quotes using your configured print templates.
- Custom Number Series — Configure the prefix and starting number for quotes (e.g.,
SQUOT-,QT-,EST-).
Actions
| Action | Condition | Description |
|---|---|---|
| Create → Sales Invoice | Quote is submitted | Converts the quote into a Sales Invoice with all data copied |
4.2 Sales Invoices
Sales Invoices are the core revenue document in NkapBooks. They record the sale of goods or services to a customer and automatically generate double-entry accounting ledger entries upon submission.
Schema Overview
| Field | Type | Description |
|---|---|---|
| Number Series | Link → NumberSeries | Auto-generated identifier (default prefix: SINV-) |
| Customer | Link → Party | The customer being invoiced (must have role "Customer" or "Both") |
| Date | Datetime | Invoice date |
| Account | Link → Account | Receivable account (auto-set based on customer) |
| Price List | Link → PriceList | Optional price list for automatic item rate lookup |
| Items | Table → SalesInvoiceItem | Line items with item, quantity, rate, unit, tax, discount, batch, serial number, and amount |
| Coupons | Table → AppliedCouponCodes | Applied coupon codes for pricing rule discounts |
| Net Total | Currency | Sum of all line item amounts before tax |
| Taxes | Table → TaxSummary | Automatic tax summary with account, rate, and amount |
| Grand Total | Currency | Final total including taxes and after discounts |
| Base Grand Total | Currency | Grand total in company currency (for multi-currency invoices) |
| Outstanding Amount | Currency | Remaining unpaid balance |
| Stock Not Shipped | Float | Quantity of items not yet transferred via Shipment |
| Quote Reference | Link → SalesQuote | Reference to the originating sales quote (if any) |
| Back Reference | Link → Shipment | Reference to a linked shipment |
| Return Against | Link → SalesInvoice | For credit notes / returns, links to the original invoice |
| Notes | Text | Invoice terms and notes |
| Attachment | Attachment | File attachment (PDF, image, etc.) |
Invoice-Level Settings (Settings Tab)
| Setting | Type | Default | Description |
|---|---|---|---|
| Discount After Tax | Check | false | When enabled, the invoice-level discount is applied after tax calculation |
| Make Payment On Submit | Check | false | Automatically creates and submits a payment when the invoice is submitted |
| Make Shipment On Submit | Check | false | Automatically creates and submits a shipment for tracked items when the invoice is submitted |
Invoice Lifecycle
Draft → Submitted → Paid
→ Partly Paid
→ Cancelled
→ Return / Return Issued
Status Definitions:
| Status | Color | Description |
|---|---|---|
| Draft | Gray | Invoice is being prepared; can be freely edited |
| Submitted | Green | Invoice is finalized and ledger entries are posted; becomes Unpaid |
| Unpaid | Orange | Submitted invoice with full outstanding amount |
| Partly Paid | Yellow | Some payment received but outstanding amount remains |
| Paid | Green | Full amount has been received (outstandingAmount = 0) |
| Cancelled | Red | Invoice has been voided; ledger entries are reversed |
| Return | Lime | This invoice is a credit note / return against another invoice |
| Return Issued | Lime | A return has been issued against this invoice |
What Happens on Submit
When you submit a Sales Invoice, the following accounting ledger entries are automatically generated:
- Debit the Receivable Account (e.g., Debtors) with the Grand Total
- Credit each item's Income Account (e.g., Sales, Service) with the item amount
- Credit each Tax Account with the respective tax amount
- Debit the Discount Account (if a discount is applied and a discount account is configured)
- A round-off entry is made if the total doesn't balance exactly due to rounding
For multi-currency invoices, all amounts are converted to the base currency using the exchange rate before posting.
If Loyalty Program is active and points are being redeemed:
- Debit the Loyalty Program Expense Account
- Credit the Receivable Account with the loyalty amount
Key Features
- Automatic Tax Calculation — Taxes are computed per item based on assigned tax templates. The tax summary table shows a breakdown by tax account with rates and amounts.
- Discount Support — Both item-level and invoice-level discounts are supported. You can set discounts as a percentage or fixed amount. The
discountAfterTaxsetting controls whether discounts apply before or after tax. - Multi-Currency — When a customer's default currency differs from your company currency, the invoice automatically applies the exchange rate. The
baseGrandTotalshows the converted amount. - Linked Payments — Payments made against an invoice are tracked. The outstanding amount is automatically recalculated when payments are created, submitted, or cancelled.
- Auto-Payment — Enable "Make Payment On Submit" to automatically create and submit a payment entry when the invoice is submitted. The payment account is taken from Settings → Defaults → Sales Payment Account.
- Auto-Shipment — Enable "Make Shipment On Submit" to automatically create and submit a Shipment document for all tracked items. The location is taken from Settings → Defaults → Shipment Location.
- Pricing Rules — Automatic discounts are applied based on configured pricing rules. The
isPricingRuleAppliedflag andpricingRuleDetailtable track which rules were applied. - Coupon Codes — Apply coupon codes to trigger coupon-based pricing rules. Coupons are validated for date range, amount range, and maximum usage.
- Price Lists — Select a price list to automatically look up per-item rates. The price list must be marked as "For Sales" and "Enabled".
- Returns / Credit Notes — Create a return against any submitted invoice using the Create → Return action. The return invoice reverses the ledger entries and updates the original invoice's
isReturnedstatus. Partial returns are supported based on remaining quantity. - POS Integration — Invoices created through the Point of Sale module are automatically linked to the active POS session via the
isPOSandposSessionfields. - License Check — For non-return invoices, NkapBooks validates against your license tier's invoice limits before allowing creation. If the limit is reached, you'll be prompted to upgrade.
- Custom Print Templates — Use the Template Builder to design custom invoice layouts with your logo, terms, and styling.
Actions
| Action | Condition | Description |
|---|---|---|
| Create → Payment | Submitted, outstanding > 0 | Opens a quick-edit payment form pre-filled with the invoice reference |
| Create → Shipment | Submitted, stock not shipped > 0 | Creates a Shipment document with items that haven't been transferred yet |
| Create → Return | Submitted, not a return itself | Creates a credit note / return invoice against this invoice |
| View → Ledger | Submitted | Navigates to the General Ledger filtered for this invoice's entries |
Line Item Fields (SalesInvoiceItem)
Each line item in a Sales Invoice supports the following fields:
| Field | Type | Description |
|---|---|---|
| Item | Link → Item | The product or service being sold |
| Description | Data | Auto-filled from item; can be overridden |
| Quantity | Float | Number of units |
| Rate | Currency | Price per unit (auto-filled from item, price list, or pricing rule) |
| Unit | Link → UOM | Unit of measurement (e.g., Nos, Kg, Hours) |
| Transfer Unit | Link → UOM | Alternative unit for stock transfer (uses conversion factor) |
| Transfer Quantity | Float | Quantity in the transfer unit |
| Account | Link → Account | Income account for this item (auto-filled based on item type) |
| Tax | Link → Tax | Tax template for this item (auto-filled from item or item group) |
| Amount | Currency | Calculated: quantity × rate |
| Discount (Amount) | Currency | Fixed discount amount per line item |
| Discount (Percent) | Float | Percentage discount per line item |
| Discounted Total | Currency | Amount after applying item-level discount |
| Taxed Total | Currency | Amount after applying both discount and tax |
| Batch | Link → Batch | Batch number (if item has batch tracking enabled) |
| HSN Code | Data | Harmonized System Nomenclature code for tax reporting |
| Is Free Item | Check | Marked true if the item was added by a Product Discount pricing rule |
| Stock Not Transferred | Float | Remaining quantity not yet shipped |
4.3 Sales Payments
Sales Payments record money received from customers. In NkapBooks, payments are managed through the unified Payment document with paymentType: "Receive".
Schema Overview
| Field | Type | Description |
|---|---|---|
| Number Series | Link → NumberSeries | Auto-generated identifier (default prefix: PAY-) |
| Party | Link → Party | The customer making the payment |
| Posting Date | Datetime | Date the payment was received |
| Payment Type | Select | Receive (for sales) or Pay (for purchases) |
| From Account | Link → Account | The receivable account being debited |
| To Account | Link → Account | The bank/cash account receiving the money |
| Payment Method | Link → PaymentMethod | Cash, Bank Transfer, Cheque, Mobile Money, etc. |
| Amount | Currency | Total payment amount |
| Write Off | Currency | Amount to be written off (difference between invoice and payment) |
| Amount Paid | Currency | Computed: Amount − Write Off |
| Clearance Date | Date | Bank clearance date (for cheque/bank transfer reconciliation) |
| Ref. / Cheque No. | Data | External reference number |
| Reference Date | Date | Date of the reference document |
| Taxes | Table → TaxSummary | Tax summary (if applicable) |
| Payment Reference | Table → PaymentFor | Links to one or more invoices being paid |
Payment Lifecycle
Draft → Submitted → (auto-updates invoice outstanding)
→ Cancelled → (reverts invoice outstanding)
Accounting Entries
When a sales payment is submitted, the following ledger entries are created:
| Debit | Credit | Amount |
|---|---|---|
| Bank/Cash Account (To Account) | Receivable Account (From Account) | Payment Amount |
If a Write Off amount is specified:
- An additional entry debits the Write Off Account and credits the Receivable Account for the write-off amount.
Key Features
- Multi-Invoice Payments — A single payment can be applied against multiple invoices using the Payment Reference table. Each reference row specifies the invoice and amount.
- Partial Payments — Pay any amount less than the outstanding balance. The invoice's outstanding amount is automatically recalculated.
- Write-Off — Write off small remaining balances (e.g., rounding differences). Requires a configured Write Off Account.
- Payment Methods — Create custom payment methods (Cash, Bank Transfer, Cheque, Mobile Money, etc.) from Settings → Payment Methods. Each method can have a default account.
- Auto-Update Outstanding — When a payment is submitted, the linked invoice's
outstandingAmountis recalculated based on all linked payments. When cancelled, the outstanding is reverted. - Party Outstanding — After each payment, the customer's overall outstanding amount is recalculated across all their invoices.
- Quick Payment — From any submitted Sales Invoice, use the Create → Payment action to open a pre-filled payment quick-edit form. The payment is automatically linked to the invoice.
- Validation — The system validates that:
- The payment amount doesn't exceed the invoice's outstanding amount
- The from/to accounts are appropriate for the payment type
- Reference invoices are submitted and not cancelled
- Total reference amounts match the payment amount (plus any write-off)
4.4 Customer Management
In NkapBooks, customers are managed as Party records with role: "Customer" (or role: "Both" for parties that are both customers and suppliers).
Schema Overview
| Field | Type | Description |
|---|---|---|
| Name | Data | Customer or company name (also serves as the primary key) |
| Image | AttachImage | Customer photo or company logo |
| Role | Select | Customer, Supplier, or Both |
| Data | Email address (validated format) | |
| Phone | Data | Phone number (validated format) |
| Address | Link → Address | Billing/shipping address |
| Default Account | Link → Account | Receivable account (auto-set to "Debtors" or SYSCOHADA equivalent) |
| Currency | Link → Currency | Default currency for invoices with this customer |
| Tax ID | Data | Tax identification number |
| Loyalty Program | Link → LoyaltyProgram | Enrolled loyalty program |
| Loyalty Points | Int | Current loyalty points balance (read-only, auto-calculated) |
| Outstanding Amount | Currency | Total unpaid amount across all invoices (hidden, auto-calculated) |
| From Lead | Link → Lead | If this customer was converted from a lead (read-only) |
| Archived | Check | Archived customers don't appear in dropdowns but remain searchable |
Default Account Logic
The default account is automatically determined based on:
- SYSCOHADA Countries (Benin, Burkina Faso, Cameroon, etc.) — Uses French accounting terminology:
- Customers:
411-Clients,4111-Clients, or41-Clients et comptes rattachés - Suppliers:
401-Fournisseurs, Dettes en Compte,4011-Fournisseurs, or40-Fournisseurs et comptes rattachés
- Customers:
- Other Countries — Uses English account names:
- Customers:
Debtors - Suppliers:
Creditors
- Customers:
Outstanding Amount Calculation
The outstanding amount is calculated by summing the outstandingAmount field across all submitted, non-cancelled invoices for the customer:
- Customer role: Sum of outstanding Sales Invoices
- Both role: Outstanding Sales Invoices minus outstanding Purchase Invoices (net receivable)
The calculation uses a retry mechanism with up to 3 attempts to handle concurrent updates (ConflictError).
Customer Actions
When viewing a customer record, the following contextual actions are available:
| Action | Condition | Description |
|---|---|---|
| Create Sale | Saved, role ≠ Supplier | Creates a new Sales Invoice pre-filled with this customer |
| Create Purchase | Saved, role ≠ Customer | Creates a new Purchase Invoice pre-filled with this party |
| View Sales | Saved, role ≠ Supplier | Navigates to Sales Invoices filtered by this customer |
| View Purchases | Saved, role ≠ Customer | Navigates to Purchase Invoices filtered by this party |
| View Unpaid Sales | Saved, role ≠ Supplier | Shows Sales Invoices with outstandingAmount ≠ 0 |
| View Unpaid Purchases | Saved, role ≠ Customer | Shows Purchase Invoices with outstandingAmount ≠ 0 |
| View Payments | Saved | Navigates to Payments filtered by this party |
| View Shipments | Saved, role ≠ Supplier | Navigates to Shipments filtered by this party |
| View Purchase Receipts | Saved, role ≠ Customer | Navigates to Purchase Receipts filtered by this party |
Duplicate Behavior
When duplicating a customer, the outstandingAmount is reset to zero and loyaltyPoints is reset to 0, ensuring the new record starts fresh.
Filtering in Sidebar
The sidebar entry "Customers" applies a route filter of role: ["in", ["Customer", "Both"]] to show only parties that can receive Sales Invoices.
4.5 Sales Items
Items in NkapBooks represent products or services that can be sold, purchased, or both. Items visible under Sales → Sales Items are filtered to show only those with for: "Sales" or for: "Both".
Schema Overview
| Field | Type | Description |
|---|---|---|
| Item Name | Data | Product or service name (serves as the primary key) |
| Item Type | Select | Product or Service |
| For | Select | Sales, Purchases, or Both |
| Unit | Link → UOM | Base unit of measurement (e.g., Nos, Kg, Hours) — locked after first save |
| Sale Rate | Currency | Default selling price (cannot be negative) |
| Purchase Rate | Currency | Default purchase price (cannot be negative) |
| Tax | Link → Tax | Default tax template applied on invoices |
| Item Group | Link → ItemGroup | Category classification (enabled via Settings) |
| HSN Code | Data | 4–8 digit Harmonized System Nomenclature code (validated) |
| Barcode | Data | 12-digit barcode (validated, enabled via Inventory Settings) |
| Track Item | Check | Enable inventory/stock tracking (only for Products; locked after save) |
| Has Batch | Check | Enable batch tracking (enabled via Inventory Settings; locked after save) |
| Has Serial Number | Check | Enable serial number tracking (enabled via Inventory Settings; requires Track Item) |
| UOM Conversions | Table | Define alternate units with conversion factors (enabled via Inventory Settings) |
| Income Account | Link → Account | Account credited on sales (auto-set based on item type and country) |
| Expense Account | Link → Account | Account debited on purchases (auto-set based on item type and tracking) |
Income Account Logic
The income account is automatically determined:
- SYSCOHADA Countries: Products →
701-Ventes de Marchandises; Services →706-Services Vendus - Other Countries: Products →
Sales; Services →Service
Stock Quantity in List View
When viewing the items list, a Stock Qty column shows the current stock balance for tracked items. This is computed by summing stock ledger entries across all locations. Non-tracked items show a dash (-).
Item Actions
| Action | Condition | Description |
|---|---|---|
| Create → Sales Invoice | Saved, for ≠ Purchases | Creates a Sales Invoice with this item pre-added |
| Create → Purchase Invoice | Saved, for ≠ Sales | Creates a Purchase Invoice with this item pre-added |
Read-Only After Save
The following fields become read-only after the item is first saved to maintain data integrity:
- Unit, Item Type, Track Item, Has Batch, Has Serial Number
4.6 Loyalty Program
The Loyalty Program allows you to reward customers with points based on their purchase amounts. Points can be accumulated over time and redeemed as discounts on future purchases.
Schema Overview
| Field | Type | Description |
|---|---|---|
| Name | Data | Program name (e.g., "Silver Rewards", "VIP Club") |
| From Date | Date | Program start date |
| To Date | Date | Program end date |
| Is Enabled | Check | Whether the program is currently active |
| Collection Rules | Table → CollectionRulesItems | Define tiers and point earning rates |
| Conversion Factor | Float | How much 1 loyalty point is worth in currency (default: 1) |
| Expiry Duration | Int | Number of days before earned points expire (default: 1) |
| Expense Account | Link → Account | Expense account debited when points are redeemed |
Collection Rules
Each collection rule defines a tier with conditions for earning points:
| Field | Type | Description |
|---|---|---|
| Tier Name | Data | Name of the tier (e.g., "Bronze", "Silver", "Gold") |
| Collection Factor | Float | Amount spent that equals 1 loyalty point (e.g., 10 means spend $10 = earn 1 point) |
| Minimum Total Spent | Currency | Minimum cumulative purchase amount required to qualify for this tier |
How Points Are Earned
When a Sales Invoice is submitted:
- The system checks if the customer has an assigned Loyalty Program.
- It determines the customer's tier based on their total spending history.
- Points are calculated:
purchase amount / collection factor. - A Loyalty Point Entry is created with:
- The program name, tier, customer, invoice reference
- Posting date and expiry date (posting date + expiry duration)
- The number of points earned
How Points Are Redeemed
On a Sales Invoice:
- Enable Redeem Loyalty Points (checkbox on the invoice).
- Enter the number of Loyalty Points to redeem.
- The monetary value is calculated:
points × conversion factor. - Validations ensure:
- Points must be greater than 0
- Points cannot exceed the customer's available balance
- The redemption value cannot exceed the invoice grand total
- On submit, the ledger entries include an additional debit to the Loyalty Expense Account.
Loyalty Point Entry
Each point transaction (earned or redeemed) is tracked as a LoyaltyPointEntry:
| Field | Description |
|---|---|
| Loyalty Program | Which program the entry belongs to |
| Customer | The customer who earned/redeemed points |
| Invoice | The Sales Invoice that triggered the entry |
| Purchase Amount | The invoice amount used for calculation |
| Posting Date | When the points were earned |
| Expiry Date | When the points expire |
| Loyalty Points | Number of points (positive for earned, negative for redeemed) |
| Loyalty Program Tier | Which tier the customer qualified for |
Customer Loyalty Balance
Each customer's loyalty point balance is automatically calculated by summing all non-expired LoyaltyPointEntry records. The balance is visible on the customer's Party record under the Loyalty Program section.
4.7 Pricing Rules
Pricing Rules allow you to automate discounts and free item offers based on configurable conditions. They can be applied to individual items, item groups, or all items.
Schema Overview
| Field | Type | Description |
|---|---|---|
| Number Series | Link → NumberSeries | Auto-generated identifier (default prefix: PRLE-) |
| Title | Data | Descriptive name for the rule |
| Is Enabled | Check | Whether the rule is currently active |
| Applied Items | Table → PricingRuleItem | Items or item groups this rule applies to |
| Discount Type | Select | Price Discount or Product Discount |
| Priority | Select | 1–20 (higher number = higher priority when multiple rules match) |
| Is Coupon Code Based | Check | If enabled, this rule only activates when a matching coupon code is applied |
Discount Type: Price Discount
When Discount Type = "Price Discount", you choose one of three sub-types:
| Sub-Type | Field | Description |
|---|---|---|
| Rate | Discount Rate | Sets a fixed selling rate for the item |
| Discount Percentage | Discount Percentage | Reduces the item rate by a percentage |
| Discount Amount | Discount Amount | Reduces the item rate by a fixed amount |
Optionally link to a Price List for rate-based discounts using the forPriceList field.
Discount Type: Product Discount
When Discount Type = "Product Discount", a free item is automatically added to the invoice:
| Field | Type | Description |
|---|---|---|
| Free Item | Link → Item | The item to give for free |
| Quantity | Float | How many free items to give |
| UOM | Link → UOM | Unit of measurement for the free item |
| Round Free Item Qty | Check | Whether to round the calculated free quantity |
| Rounding Method | Select | Floor, Round, or Ceil |
| Is Recursive | Check | Apply the free item repeatedly for every N units purchased |
| Recurse Every | Float | Number of purchased units that trigger one free item cycle |
Conditions
Pricing rules can be limited by quantity and amount ranges, and by date validity:
| Field | Description |
|---|---|
| Min Qty | Minimum quantity (in stock unit) for the rule to apply |
| Max Qty | Maximum quantity for the rule to apply |
| Min Amount | Minimum line item amount for the rule to apply |
| Max Amount | Maximum line item amount for the rule to apply |
| Valid From | Start date for the rule's validity |
| Valid To | End date for the rule's validity |
Priority & Conflict Resolution
When multiple pricing rules match for the same item:
- Rules are sorted by priority (highest first).
- If two rules have the same priority, the system detects a conflict and prompts the user to resolve it.
- Only one pricing rule can be applied per item per invoice.
How Pricing Rules Are Applied
When an item is added to a Sales Invoice:
- The system queries all enabled pricing rules where the item (or its group) is in the
appliedItemstable. - Non-coupon-based rules are filtered by quantity, amount, and date conditions.
- Coupon-based rules are only considered if a matching coupon code has been applied to the invoice.
- The highest-priority matching rule is applied:
- Price Discount: The item's discount amount or percentage is automatically set.
- Product Discount: A free item row is added to the invoice with
isFreeItem: trueandpricingRuleset.
- The
pricingRuleDetailtable on the invoice records which rules were applied to which items.
4.9 Coupon Codes
Coupon Codes are alphanumeric codes that customers can use to activate coupon-based Pricing Rules. They add a layer of control over when and how discounts are applied.
Schema Overview
| Field | Type | Description |
|---|---|---|
| Coupon Code | Data | Auto-generated from the coupon name (uppercase, no spaces, max 8 chars) |
| Name | Data | Descriptive name for the coupon (e.g., "Summer Sale 2025") |
| Is Enabled | Check | Whether the coupon is currently active |
| Pricing Rule | Link → PricingRule | The pricing rule to activate (must have isCouponCodeBased: true) |
| Min Amount | Currency | Minimum invoice amount to use this coupon |
| Max Amount | Currency | Maximum invoice amount to use this coupon |
| Valid From | Date | Start date for coupon validity |
| Valid To | Date | End date for coupon validity |
| Maximum Use | Int | Maximum number of times this coupon can be redeemed (0 = unlimited) |
| Used | Int | Number of times this coupon has been used (read-only, auto-incremented) |
Code Generation
The coupon code is automatically generated from the coupon name:
- Spaces are removed
- Text is converted to uppercase
- Truncated to 8 characters
For example: "Summer Sale" → SUMMERSA
Validation Rules
Coupon codes enforce strict validation:
| Rule | Description |
|---|---|
| Amount Bounds | Min/Max amounts must fall within the linked pricing rule's amount range |
| Date Bounds | Valid From/To dates must fall within the linked pricing rule's date range |
| Min < Max | Minimum amount must be less than maximum amount |
| From < To | Valid From date must be before Valid To date |
| Usage Tracking | The used counter is incremented on invoice submit and decremented on invoice cancel |
How Coupons Work in an Invoice
- Add items to a Sales Invoice as usual.
- In the Coupons section, add one or more coupon codes.
- The system validates each coupon against the current invoice:
- Is the coupon enabled?
- Is the current date within the Valid From/To range?
- Is the invoice amount within the Min/Max amount range?
- Has the coupon not exceeded its Maximum Use limit?
- If valid, the linked Pricing Rule is activated and the discount is applied.
- When the invoice is submitted, the coupon's
usedcounter is incremented. - If the invoice is cancelled, the
usedcounter is decremented.
4.10 Price Lists
Price Lists allow you to maintain multiple sets of item prices for different customer segments, channels, or promotions (e.g., Retail, Wholesale, VIP, Staff).
Schema Overview
| Field | Type | Description |
|---|---|---|
| Name | Data | Price list name (e.g., "Retail", "Wholesale", "VIP") |
| Is Enabled | Check | Whether the price list is active |
| For Sales | Check | Available for use on Sales Invoices and Quotes |
| For Purchase | Check | Available for use on Purchase Invoices |
| Item Prices | Table → PriceListItem | Per-item rate definitions |
| Archived | Check | Archived price lists don't appear in dropdowns |
Price List Items
Each row in the Item Prices table defines a rate for a specific item:
| Field | Type | Description |
|---|---|---|
| Item | Link → Item | The item this rate applies to |
| Unit | Link → UOM | Unit of measurement (auto-filled from the item's default unit) |
| Rate | Currency | The special rate for this item in this price list |
How Price Lists Work
- Create a Price List — Give it a name, enable it for Sales and/or Purchase, and add item rows with custom rates.
- Apply to an Invoice — Select the Price List in the invoice's
priceListfield. - Automatic Rate Lookup — When an item is added to the invoice, the system looks up the item's rate from the selected price list. If found, it overrides the item's default rate.
- Fallback Behavior — If an item is not in the price list, the item's default
saleRate(orpurchaseRate) is used. - Priority — Price list rates take precedence over the item's default rate but may be further modified by Pricing Rules.
Filtering
When selecting a price list on a Sales Invoice:
- Only price lists with
isEnabled: trueANDisSales: trueare shown.
When selecting on a Purchase Invoice:
- Only price lists with
isEnabled: trueANDisPurchase: trueare shown.
List View
The Price List list view shows:
- Name — The price list identifier
- Enabled Status — Badge showing whether the list is active
- Sales/Purchase — Badge indicating whether it's for Sales, Purchase, or both
4.11 Sales Module Tips & Best Practices
Recommended Workflow
- Create a Lead (optional) — Track prospects before they become customers.
- Send a Sales Quote — Prepare a formal quotation with pricing and terms.
- Convert to Invoice — One-click conversion preserves all details.
- Receive Payment — Record partial or full payment against the invoice.
- Ship Goods — Create a Shipment for tracked inventory items.
- Track Loyalty — Customers automatically earn loyalty points on purchases.
Discount Strategy
- Use Pricing Rules for automated, condition-based discounts (quantity breaks, seasonal promotions).
- Use Coupon Codes for customer-initiated discounts (marketing campaigns, referral codes).
- Use Price Lists for segment-based pricing (wholesale vs. retail).
- Use Invoice-Level Discounts for one-off manual adjustments.
- Use Item-Level Discounts for per-line adjustments.
Multi-Currency Tips
- Set the customer's default currency on their Party record to auto-apply it on invoices.
- Exchange rates are fetched automatically but can be manually overridden.
- The
baseGrandTotalalways shows the amount in your company currency for consistent reporting.
Returns & Credit Notes
- Always use the Create → Return action instead of manually creating negative invoices.
- Returns automatically reverse the original ledger entries.
- Partial returns are supported — specify the quantity to return for each item.
- The original invoice's status updates to "Return Issued" after a return is created.