Objective:
Provide early visibility when Customers or Suppliers are nearing their approved credit limits, both inside QuickEasy ERP and via scheduled reporting.
Procedure: ACC_CREDIT_WARNING_BY_TRANSID(:TRANSID)
Trigger point: Runs when creating/editing transactions.
Logic:
Fetch LEDGER.ENTRYTYPEID, LEDGER.COMPANYID.
If ENTRYTYPEID IN (1,2) → Customer.
If ENTRYTYPEID IN (4) → Supplier.
Get credit limit:
Customer → CUSMAIN.APPROVEDLIMIT
Supplier → SUPMAIN.CREDITLIMIT
Call appropriate ageing procedure:
Customer → ACC_CUS_AGEING_ID
Supplier → ACC_SUP_AGEING_ID
Calculate Exposure = TOTAL + WIP.
If Exposure ≥ 75% of Credit Limit → return WARNING message string.
If no limit set → return warning about missing limit.
Return:
Single VARCHAR(1024) message or empty string.
Usage example:
SELECT WARNING
FROM ACC_CREDIT_WARNING_BY_TRANSID(:TRANSID);
View: VW_CREDIT_AT_75PCT
Purpose: Show all Customers and Suppliers with Exposure ≥ 75% of limit.
Columns:
TYPE (Customer/Supplier)
ID
Name
Credit Limit
TOTAL (Outstanding)
WIP (Uninvoiced orders)
Exposure (TOTAL + WIP)
% Used (Exposure ÷ Limit × 100)
Headroom (Limit – Exposure)
CurrencyID used
Data source:
ACC_CUS_AGEING_ID (Customers)
ACC_SUP_AGEING_ID (Suppliers)
Filter: Exposure ≥ 75% of limit.
Schedule: Every Wednesday 12:00 (SAST).
Recipients: Client-defined (To/CC).
Threshold: 75% (configurable if needed).
Currency: Uses account currency if set, else falls back to local currency (from GET_SETTING(-1,-1,43)).
Entry Type Mapping:
Customer checks → ENTRYTYPEID IN (1,2)
Supplier checks → ENTRYTYPEID IN (4)
Expandable if new types added.
Switch to TOTALLOCAL instead of TOTAL if only local currency exposure is required.
Make threshold % and schedule user-configurable via GET_SETTING.
Add second view/report at ≥100% for hard-stop monitoring.
✅ Deployed: September 2025