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-ModuleSidebar EntryDescription
Sales QuotesSales QuotesCreate and send quotations to customers or leads
Sales InvoicesSales InvoicesIssue invoices for goods and services sold
Sales PaymentsSales PaymentsRecord payments received from customers
CustomersCustomersManage customer contact and billing information
Sales ItemsSales ItemsDefine products and services available for sale
Loyalty ProgramLoyalty ProgramConfigure point-based customer loyalty rewards
Lead ManagementLeadTrack and convert sales prospects
Pricing RulesPricing RuleAutomate discounts based on conditions
Coupon CodesCoupon CodeCreate redeemable promotional codes
Price Lists(via Invoice)Maintain multiple price lists for different customer segments
Some sub-modules (Loyalty Program, Lead, Pricing Rule, Coupon Code) are optional features that must be enabled in Settings → Accounting Settings before they appear in the sidebar.

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

FieldTypeDescription
Number SeriesLink → NumberSeriesAuto-generated identifier (default prefix: SQUOT-)
Reference TypeSelectParty (existing customer) or Lead (sales prospect)
CustomerDynamicLinkLinks to a Party or Lead record depending on Reference Type
DateDatetimeQuote creation date
Price ListLink → PriceListOptional price list to apply per-item rates
ItemsTable → SalesQuoteItemLine items with item, quantity, rate, tax, discount, and amount
Net TotalCurrencySum of all line item amounts before tax
TaxesTable → TaxSummaryAutomatic tax breakdown by tax account
Grand TotalCurrencyNet Total + Taxes − Discounts
NotesTextFree-text field for quote terms and conditions
DiscountCurrency / PercentInvoice-level discount (amount or percentage)
Exchange RateFloatApplied when customer currency differs from company currency

Quote Lifecycle

Draft  →  Submitted  →  Converted to Invoice
                    →  Cancelled
  1. Draft — The quote is created and can be freely edited. Items, rates, taxes, and discounts can be modified.
  2. Submitted — The quote is finalized. No further edits are allowed. The quote can now be converted to a Sales Invoice.
  3. 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 quote field links back to the original quote.
  4. 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

ActionConditionDescription
Create → Sales InvoiceQuote is submittedConverts 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

FieldTypeDescription
Number SeriesLink → NumberSeriesAuto-generated identifier (default prefix: SINV-)
CustomerLink → PartyThe customer being invoiced (must have role "Customer" or "Both")
DateDatetimeInvoice date
AccountLink → AccountReceivable account (auto-set based on customer)
Price ListLink → PriceListOptional price list for automatic item rate lookup
ItemsTable → SalesInvoiceItemLine items with item, quantity, rate, unit, tax, discount, batch, serial number, and amount
CouponsTable → AppliedCouponCodesApplied coupon codes for pricing rule discounts
Net TotalCurrencySum of all line item amounts before tax
TaxesTable → TaxSummaryAutomatic tax summary with account, rate, and amount
Grand TotalCurrencyFinal total including taxes and after discounts
Base Grand TotalCurrencyGrand total in company currency (for multi-currency invoices)
Outstanding AmountCurrencyRemaining unpaid balance
Stock Not ShippedFloatQuantity of items not yet transferred via Shipment
Quote ReferenceLink → SalesQuoteReference to the originating sales quote (if any)
Back ReferenceLink → ShipmentReference to a linked shipment
Return AgainstLink → SalesInvoiceFor credit notes / returns, links to the original invoice
NotesTextInvoice terms and notes
AttachmentAttachmentFile attachment (PDF, image, etc.)

Invoice-Level Settings (Settings Tab)

SettingTypeDefaultDescription
Discount After TaxCheckfalseWhen enabled, the invoice-level discount is applied after tax calculation
Make Payment On SubmitCheckfalseAutomatically creates and submits a payment when the invoice is submitted
Make Shipment On SubmitCheckfalseAutomatically 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:

StatusColorDescription
DraftGrayInvoice is being prepared; can be freely edited
SubmittedGreenInvoice is finalized and ledger entries are posted; becomes Unpaid
UnpaidOrangeSubmitted invoice with full outstanding amount
Partly PaidYellowSome payment received but outstanding amount remains
PaidGreenFull amount has been received (outstandingAmount = 0)
CancelledRedInvoice has been voided; ledger entries are reversed
ReturnLimeThis invoice is a credit note / return against another invoice
Return IssuedLimeA 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:

  1. Debit the Receivable Account (e.g., Debtors) with the Grand Total
  2. Credit each item's Income Account (e.g., Sales, Service) with the item amount
  3. Credit each Tax Account with the respective tax amount
  4. Debit the Discount Account (if a discount is applied and a discount account is configured)
  5. 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 discountAfterTax setting 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 baseGrandTotal shows 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 isPricingRuleApplied flag and pricingRuleDetail table 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 isReturned status. 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 isPOS and posSession fields.
  • 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

ActionConditionDescription
Create → PaymentSubmitted, outstanding > 0Opens a quick-edit payment form pre-filled with the invoice reference
Create → ShipmentSubmitted, stock not shipped > 0Creates a Shipment document with items that haven't been transferred yet
Create → ReturnSubmitted, not a return itselfCreates a credit note / return invoice against this invoice
View → LedgerSubmittedNavigates 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:

FieldTypeDescription
ItemLink → ItemThe product or service being sold
DescriptionDataAuto-filled from item; can be overridden
QuantityFloatNumber of units
RateCurrencyPrice per unit (auto-filled from item, price list, or pricing rule)
UnitLink → UOMUnit of measurement (e.g., Nos, Kg, Hours)
Transfer UnitLink → UOMAlternative unit for stock transfer (uses conversion factor)
Transfer QuantityFloatQuantity in the transfer unit
AccountLink → AccountIncome account for this item (auto-filled based on item type)
TaxLink → TaxTax template for this item (auto-filled from item or item group)
AmountCurrencyCalculated: quantity × rate
Discount (Amount)CurrencyFixed discount amount per line item
Discount (Percent)FloatPercentage discount per line item
Discounted TotalCurrencyAmount after applying item-level discount
Taxed TotalCurrencyAmount after applying both discount and tax
BatchLink → BatchBatch number (if item has batch tracking enabled)
HSN CodeDataHarmonized System Nomenclature code for tax reporting
Is Free ItemCheckMarked true if the item was added by a Product Discount pricing rule
Stock Not TransferredFloatRemaining 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

FieldTypeDescription
Number SeriesLink → NumberSeriesAuto-generated identifier (default prefix: PAY-)
PartyLink → PartyThe customer making the payment
Posting DateDatetimeDate the payment was received
Payment TypeSelectReceive (for sales) or Pay (for purchases)
From AccountLink → AccountThe receivable account being debited
To AccountLink → AccountThe bank/cash account receiving the money
Payment MethodLink → PaymentMethodCash, Bank Transfer, Cheque, Mobile Money, etc.
AmountCurrencyTotal payment amount
Write OffCurrencyAmount to be written off (difference between invoice and payment)
Amount PaidCurrencyComputed: Amount − Write Off
Clearance DateDateBank clearance date (for cheque/bank transfer reconciliation)
Ref. / Cheque No.DataExternal reference number
Reference DateDateDate of the reference document
TaxesTable → TaxSummaryTax summary (if applicable)
Payment ReferenceTable → PaymentForLinks 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:

DebitCreditAmount
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 outstandingAmount is 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

FieldTypeDescription
NameDataCustomer or company name (also serves as the primary key)
ImageAttachImageCustomer photo or company logo
RoleSelectCustomer, Supplier, or Both
EmailDataEmail address (validated format)
PhoneDataPhone number (validated format)
AddressLink → AddressBilling/shipping address
Default AccountLink → AccountReceivable account (auto-set to "Debtors" or SYSCOHADA equivalent)
CurrencyLink → CurrencyDefault currency for invoices with this customer
Tax IDDataTax identification number
Loyalty ProgramLink → LoyaltyProgramEnrolled loyalty program
Loyalty PointsIntCurrent loyalty points balance (read-only, auto-calculated)
Outstanding AmountCurrencyTotal unpaid amount across all invoices (hidden, auto-calculated)
From LeadLink → LeadIf this customer was converted from a lead (read-only)
ArchivedCheckArchived customers don't appear in dropdowns but remain searchable

Default Account Logic

The default account is automatically determined based on:

  1. SYSCOHADA Countries (Benin, Burkina Faso, Cameroon, etc.) — Uses French accounting terminology:
    • Customers: 411-Clients, 4111-Clients, or 41-Clients et comptes rattachés
    • Suppliers: 401-Fournisseurs, Dettes en Compte, 4011-Fournisseurs, or 40-Fournisseurs et comptes rattachés
  2. Other Countries — Uses English account names:
    • Customers: Debtors
    • Suppliers: Creditors

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:

ActionConditionDescription
Create SaleSaved, role ≠ SupplierCreates a new Sales Invoice pre-filled with this customer
Create PurchaseSaved, role ≠ CustomerCreates a new Purchase Invoice pre-filled with this party
View SalesSaved, role ≠ SupplierNavigates to Sales Invoices filtered by this customer
View PurchasesSaved, role ≠ CustomerNavigates to Purchase Invoices filtered by this party
View Unpaid SalesSaved, role ≠ SupplierShows Sales Invoices with outstandingAmount ≠ 0
View Unpaid PurchasesSaved, role ≠ CustomerShows Purchase Invoices with outstandingAmount ≠ 0
View PaymentsSavedNavigates to Payments filtered by this party
View ShipmentsSaved, role ≠ SupplierNavigates to Shipments filtered by this party
View Purchase ReceiptsSaved, role ≠ CustomerNavigates 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

FieldTypeDescription
Item NameDataProduct or service name (serves as the primary key)
Item TypeSelectProduct or Service
ForSelectSales, Purchases, or Both
UnitLink → UOMBase unit of measurement (e.g., Nos, Kg, Hours) — locked after first save
Sale RateCurrencyDefault selling price (cannot be negative)
Purchase RateCurrencyDefault purchase price (cannot be negative)
TaxLink → TaxDefault tax template applied on invoices
Item GroupLink → ItemGroupCategory classification (enabled via Settings)
HSN CodeData4–8 digit Harmonized System Nomenclature code (validated)
BarcodeData12-digit barcode (validated, enabled via Inventory Settings)
Track ItemCheckEnable inventory/stock tracking (only for Products; locked after save)
Has BatchCheckEnable batch tracking (enabled via Inventory Settings; locked after save)
Has Serial NumberCheckEnable serial number tracking (enabled via Inventory Settings; requires Track Item)
UOM ConversionsTableDefine alternate units with conversion factors (enabled via Inventory Settings)
Income AccountLink → AccountAccount credited on sales (auto-set based on item type and country)
Expense AccountLink → AccountAccount 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

ActionConditionDescription
Create → Sales InvoiceSaved, for ≠ PurchasesCreates a Sales Invoice with this item pre-added
Create → Purchase InvoiceSaved, for ≠ SalesCreates 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.

Enable this feature: Go to Settings → Accounting Settings and turn on Enable Loyalty Program.

Schema Overview

FieldTypeDescription
NameDataProgram name (e.g., "Silver Rewards", "VIP Club")
From DateDateProgram start date
To DateDateProgram end date
Is EnabledCheckWhether the program is currently active
Collection RulesTable → CollectionRulesItemsDefine tiers and point earning rates
Conversion FactorFloatHow much 1 loyalty point is worth in currency (default: 1)
Expiry DurationIntNumber of days before earned points expire (default: 1)
Expense AccountLink → AccountExpense account debited when points are redeemed

Collection Rules

Each collection rule defines a tier with conditions for earning points:

FieldTypeDescription
Tier NameDataName of the tier (e.g., "Bronze", "Silver", "Gold")
Collection FactorFloatAmount spent that equals 1 loyalty point (e.g., 10 means spend $10 = earn 1 point)
Minimum Total SpentCurrencyMinimum cumulative purchase amount required to qualify for this tier

How Points Are Earned

When a Sales Invoice is submitted:

  1. The system checks if the customer has an assigned Loyalty Program.
  2. It determines the customer's tier based on their total spending history.
  3. Points are calculated: purchase amount / collection factor.
  4. 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:

  1. Enable Redeem Loyalty Points (checkbox on the invoice).
  2. Enter the number of Loyalty Points to redeem.
  3. The monetary value is calculated: points × conversion factor.
  4. 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
  5. 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:

FieldDescription
Loyalty ProgramWhich program the entry belongs to
CustomerThe customer who earned/redeemed points
InvoiceThe Sales Invoice that triggered the entry
Purchase AmountThe invoice amount used for calculation
Posting DateWhen the points were earned
Expiry DateWhen the points expire
Loyalty PointsNumber of points (positive for earned, negative for redeemed)
Loyalty Program TierWhich 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.

Enable this feature: Go to Settings → Accounting Settings and turn on Enable Pricing Rule.

Schema Overview

FieldTypeDescription
Number SeriesLink → NumberSeriesAuto-generated identifier (default prefix: PRLE-)
TitleDataDescriptive name for the rule
Is EnabledCheckWhether the rule is currently active
Applied ItemsTable → PricingRuleItemItems or item groups this rule applies to
Discount TypeSelectPrice Discount or Product Discount
PrioritySelect1–20 (higher number = higher priority when multiple rules match)
Is Coupon Code BasedCheckIf 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-TypeFieldDescription
RateDiscount RateSets a fixed selling rate for the item
Discount PercentageDiscount PercentageReduces the item rate by a percentage
Discount AmountDiscount AmountReduces 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:

FieldTypeDescription
Free ItemLink → ItemThe item to give for free
QuantityFloatHow many free items to give
UOMLink → UOMUnit of measurement for the free item
Round Free Item QtyCheckWhether to round the calculated free quantity
Rounding MethodSelectFloor, Round, or Ceil
Is RecursiveCheckApply the free item repeatedly for every N units purchased
Recurse EveryFloatNumber of purchased units that trigger one free item cycle

Conditions

Pricing rules can be limited by quantity and amount ranges, and by date validity:

FieldDescription
Min QtyMinimum quantity (in stock unit) for the rule to apply
Max QtyMaximum quantity for the rule to apply
Min AmountMinimum line item amount for the rule to apply
Max AmountMaximum line item amount for the rule to apply
Valid FromStart date for the rule's validity
Valid ToEnd date for the rule's validity

Priority & Conflict Resolution

When multiple pricing rules match for the same item:

  1. Rules are sorted by priority (highest first).
  2. If two rules have the same priority, the system detects a conflict and prompts the user to resolve it.
  3. 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:

  1. The system queries all enabled pricing rules where the item (or its group) is in the appliedItems table.
  2. Non-coupon-based rules are filtered by quantity, amount, and date conditions.
  3. Coupon-based rules are only considered if a matching coupon code has been applied to the invoice.
  4. 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: true and pricingRule set.
  5. The pricingRuleDetail table 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.

Enable this feature: Go to Settings → Accounting Settings and turn on Enable Coupon Code. This also requires Enable Pricing Rule to be active.

Schema Overview

FieldTypeDescription
Coupon CodeDataAuto-generated from the coupon name (uppercase, no spaces, max 8 chars)
NameDataDescriptive name for the coupon (e.g., "Summer Sale 2025")
Is EnabledCheckWhether the coupon is currently active
Pricing RuleLink → PricingRuleThe pricing rule to activate (must have isCouponCodeBased: true)
Min AmountCurrencyMinimum invoice amount to use this coupon
Max AmountCurrencyMaximum invoice amount to use this coupon
Valid FromDateStart date for coupon validity
Valid ToDateEnd date for coupon validity
Maximum UseIntMaximum number of times this coupon can be redeemed (0 = unlimited)
UsedIntNumber 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:

RuleDescription
Amount BoundsMin/Max amounts must fall within the linked pricing rule's amount range
Date BoundsValid From/To dates must fall within the linked pricing rule's date range
Min < MaxMinimum amount must be less than maximum amount
From < ToValid From date must be before Valid To date
Usage TrackingThe used counter is incremented on invoice submit and decremented on invoice cancel

How Coupons Work in an Invoice

  1. Add items to a Sales Invoice as usual.
  2. In the Coupons section, add one or more coupon codes.
  3. 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?
  4. If valid, the linked Pricing Rule is activated and the discount is applied.
  5. When the invoice is submitted, the coupon's used counter is incremented.
  6. If the invoice is cancelled, the used counter 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

FieldTypeDescription
NameDataPrice list name (e.g., "Retail", "Wholesale", "VIP")
Is EnabledCheckWhether the price list is active
For SalesCheckAvailable for use on Sales Invoices and Quotes
For PurchaseCheckAvailable for use on Purchase Invoices
Item PricesTable → PriceListItemPer-item rate definitions
ArchivedCheckArchived price lists don't appear in dropdowns

Price List Items

Each row in the Item Prices table defines a rate for a specific item:

FieldTypeDescription
ItemLink → ItemThe item this rate applies to
UnitLink → UOMUnit of measurement (auto-filled from the item's default unit)
RateCurrencyThe special rate for this item in this price list

How Price Lists Work

  1. Create a Price List — Give it a name, enable it for Sales and/or Purchase, and add item rows with custom rates.
  2. Apply to an Invoice — Select the Price List in the invoice's priceList field.
  3. 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.
  4. Fallback Behavior — If an item is not in the price list, the item's default saleRate (or purchaseRate) is used.
  5. 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: true AND isSales: true are shown.

When selecting on a Purchase Invoice:

  • Only price lists with isEnabled: true AND isPurchase: true are 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

Tip: Use the complete sales workflow — Quote → Invoice → Payment → Shipment — for maximum traceability and auditability.
  1. Create a Lead (optional) — Track prospects before they become customers.
  2. Send a Sales Quote — Prepare a formal quotation with pricing and terms.
  3. Convert to Invoice — One-click conversion preserves all details.
  4. Receive Payment — Record partial or full payment against the invoice.
  5. Ship Goods — Create a Shipment for tracked inventory items.
  6. 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 baseGrandTotal always 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.