The Discounts module lets you configure bespoke pricing for individual customers — per-product overrides that silently take precedence over the product’s global default discount rules whenever that customer is invoiced. The workflow is simple: enter a customer ID, load their discount grid, edit the columns you want to change, and save. Behind the scenes, the save operation atomically replaces all of that customer’s discount rows in MySQL, ensuring there are no stale or duplicate entries.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/arsinousltd-sudo/Arsinous-V8-Sales/llms.txt
Use this file to discover all available pages before exploring further.
The Discounts Sheet
The Discounts sheet is loaded customer-by-customer. Enter a customer ID in cell H2 to load that customer’s discount grid starting at row 5.| Column | Source | Description |
|---|---|---|
| A | products.id | Product ID |
| B | products.code | Product code |
| C | products.name | Product description |
| D | products.cost | Default cost price |
| E | products.price | Wholesale price |
| F | products.retail | Retail price |
| G | products.def_discount | Product-level default quantity-break discount |
| H | products.def_fixed_discount | Product-level default fixed discount % |
| I | discounts.discount | Customer override — quantity-break discount rule |
| J | discounts.fixed_discount | Customer override — flat discount percentage |
products. Columns I and J are where you enter or modify the customer-specific overrides.
Loading Discounts
Enter the customer’s ID in cell H2. The sheet automatically callsgetDiscounts() via the onEdit trigger when cell A1 is edited — but the most direct way is to use Arsinous menu → GET Discounts or the sidebar Load Discounts button.
getDiscounts(conn) clears A5:M, then immediately writes "Updating...." into cell A5 and calls SpreadsheetApp.flush() so the user sees a loading indicator before the query runs. It reads the customer ID from H2, executes the LEFT JOIN query, and writes results from row 5:
Editing Discounts
Modify the values in columns I and J directly in the sheet:- Column I (
discount) — enter a quantity-break rule string using the same format asdef_discounton the product (e.g."6+2,12+6"). Leave blank to fall back to the product default. - Column J (
fixed_discount) — enter a numeric flat discount percentage (e.g.15). Leave blank to fall back to the product default.
discounts table — they will simply use the product’s global defaults.
Saving Discounts
Go to Arsinous menu → SAVE Discounts or click the sidebar Save Discounts button. This callssaveDiscounts(conn):
How Discounts Apply on Invoices
When an invoice line item is calculated, the discount engine checks in this priority order:- Manual discount — a one-off percentage entered directly in the invoice line item’s discount dialog (overrides everything).
- Customer-specific discount — the
discountorfixed_discountrow from thediscountstable for this customer + product combination (loaded into the invoice modal fromgetAllFromDB('discounts')). - Product default discount —
def_discountanddef_fixed_discountfrom theproductstable.
discount) and fixed (fixed_discount) rules, the engine evaluates each applicable rule as an absolute cash amount and applies the one that gives the largest discount to the customer.
discount vs fixed_discount
| Field | Type | Format | Example |
|---|---|---|---|
discount | string | Comma-separated buy+free rules | "6+2,12+6" — buy 6 get 2 free, or buy 12 get 6 free |
fixed_discount | numeric | Flat percentage off the line total | 15 — 15% off regardless of quantity |
Quick Reference
Load Discounts
Enter customer ID in cell H2, then use Arsinous menu → GET Discounts (or the sidebar Load button). Cell A5 shows
"Updating...." while the query runs, then the sheet is populated from row 5 with all products and any existing overrides for that customer. Editing cell A1 also triggers an automatic reload via the onEdit trigger.Save Discounts
After editing columns I and J, use Arsinous menu → SAVE Discounts or the sidebar Save button. All existing discounts for the customer are replaced with the current sheet values.
Discount Priority
Manual (invoice-level) → Customer-specific → Product default. The largest absolute discount amount wins when multiple quantity-break tiers are applicable.
Blank = Use Default
Rows where both columns I and J are empty are not saved. Those products will continue to use the product-level
def_discount and def_fixed_discount on invoices.