Skip to main content

Accounting rules

Accounting rules tell General Ledger which account to post each amount to. You set them with Customer Controlled Configuration (CCC), either for the whole tenant or for a single business unit.

The six kinds of rule​

There is one configuration kind per kind of amount. Each rule in a kind has a type that says what it matches on. The types are tried in the order listed, and the first rule that matches decides the account. DEFAULT catches everything that nothing more specific matched.

Sales and returns​

gle.sales-and-returns-rules.v1: the account for the goods on each item line, excluding VAT. Returns use the same rule as sales, on the debit side. See Posting to accounts.

TypeMatches when value equals
ITEM_IDthe item's ID
CATEGORY_IDthe item's merchandise category
TAX_GROUP_IDthe tax group the line is taxed under
DEFAULTanything not matched above (value is null)

Tax​

gle.tax-rules.v1: the account for the VAT on each line.

TypeMatches when value equals
TAX_GROUP_IDthe tax group
DEFAULTanything not matched above

Tender​

gle.tender-rules.v1: the account for each payment or refund, plus cash rounding.

TypeMatches when value equals
PAYMENT_METHOD_NAMEthe payment method the till recorded, for example AMEX. Use this to separate card schemes that share a provider.
PROVIDER_IDthe payment provider that authorised the card payment
INTERNAL_TENDER_IDthe tender ID configured in Hii Retail, for example cash or a store card
DEFAULTany payment not matched above
ROUNDINGused for cash rounding only (value is null)

Income and expense​

gle.income-rules.v1 (paid-in) and gle.expense-rules.v1 (paid-out): the account for money put into or taken out of the till that is not a sale, for example buying milk for the staff room from the till.

TypeMatches when value equals
REASON_CODE_IDthe reason code the cashier chose
DEFAULTany other reason

A paid-in or paid-out also moves money in the till, so it needs a tender rule as well. It is matched on INTERNAL_TENDER_ID, then DEFAULT.

These two kinds take two extra fields for VAT on the income or expense:

FieldMeaning
taxRatethe VAT rate in percent, for example 25. The amount is split into net and VAT at this rate.
taxAccountIdthe account the VAT part goes to

⚠ Set both or neither. With a taxRate but no taxAccountId, the VAT part has nowhere to go and the transaction cannot be balanced.

Gift card​

gle.gift-card-rules.v1: the account for the value loaded when a gift card is sold. Paying with a gift card is a tender.

TypeMatches when value equals
PROVIDER_IDthe gift-card provider
DEFAULTany other gift card

How matching works​

  • value must match exactly, including case and leading zeros. AMEX does not match Amex.
  • Configure exactly one DEFAULT per kind. If there are several, which one is used is not defined.
  • A rule's id only identifies the rule within the list. It has no effect on matching or on the order.

The minimum set of rules​

For a store's transactions to be posted in full, it needs:

  • a DEFAULT rule in each of the six kinds its transactions use (in practice: sales and returns, tax and tender always; income, expense and gift card if the store does paid-ins, paid-outs or sells gift cards)
  • a ROUNDING rule in the tender kind, if the store rounds cash

With those in place every amount has an account, and you can add more specific rules on top.

What happens without them:

SituationResult
The business unit has no rules at all🛑 Its transactions are not recorded. Recalculating later cannot bring them back, so configure the rules before the store trades.
Some amounts in a transaction have no matching ruleThe transaction cannot be balanced, so the store's whole business day is blocked and not exported. See Blocked days.

Tenant or business unit​

A rule list set on the tenant applies to every business unit. A list set on a business unit is used for that business unit instead. CCC resolves the list for each business unit, and General Ledger uses the resolved list.

  • PUT on a business unit replaces the tenant's list for that business unit, so the list you send must be complete, DEFAULT rules included.
  • PATCH on a business unit adds or changes individual rules, matched by id, on top of the list it inherits.

Read more about inheritance in CCC.

Setting a rule​

Example: post everything in tax group Standard to SR_Standard, and everything else to SR190, for one business unit:

curl --request PUT "https://ccc-api.retailsvc.com/api/v1/config/gle.sales-and-returns-rules.v1/values/business-units/${BUSINESS_UNIT_ID}" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${API_TOKEN}" \
--data '{
"value": [
{ "id": "rule001", "config": { "type": "TAX_GROUP_ID", "value": "Standard", "accountId": "SR_Standard" } },
{ "id": "rule002", "config": { "type": "DEFAULT", "value": null, "accountId": "SR190" } }
]
}'

Replace the kind in the URL for the other kinds. Every rule has type and accountId. value is required for every type except DEFAULT and ROUNDING.

When a change takes effect​

  • New transactions use the new rules within about ten minutes of the change.
  • Transactions already posted keep the account they were posted to. A rule change never rewrites a day on its own. To apply the new rules to days that have already been posted or exported, recompute those days. Wait ten minutes after the change first, or the recompute may still use the old rules. See Correcting and resending.

Troubleshooting​

SymptomCheck
A store's day never arrives in the accounting systemIs the day blocked? Recompute or re-export it and look at blockedBusinessDates in the response. Then check that every kind has a DEFAULT rule.
Amounts land on the DEFAULT account instead of a specific oneDoes value match exactly, including case and leading zeros? Is the rule on the right business unit, or overridden by a business-unit list?
A new rule has no effect on yesterday's figuresRules only apply to new transactions. Recompute the days.
Paid-ins or paid-outs block the dayIs there a tender rule for them? Is taxRate set without taxAccountId?
Amex ends up on the general card accountAdd a PAYMENT_METHOD_NAME tender rule with the exact value the till records.