Calculation type

EAPG

Maps each charge's code to an EAPG code and fee via two schedules, pays the highest-fee distinct EAPG member on the account at Percentages[0], and pays each other distinct EAPG member (in original charge order, not sorted by fee) at successive Percentages entries, while 'covered' or duplicate-member or unmapped charges are zeroed.

0
uses
0
customers
Base
category
Charge
applies at

Unused

This type appears in no customer's configuration in the snapshot.

What it computes

codeRecords = GetCodeScheduleRecords(ctx, CodeScheduleTypeKey); feeRecords = GetMappedFeeScheduleRecords(ctx, codeRecords, FeeScheduleTypeKey); coveredBy[i] computed by walking CoveredByScheduleTypeKey records for charge i's EAPG code, marking i covered if ANY other charge j (j!=i) already carries that covering code. highest = the fee record with the largest Amount among charges with feeRecords[i]!=null && coveredBy[i]==null (first-encountered wins ties, scanned i=1..N in original charge order -- NOT sorted). Then for i=1..N in original array order (not resorted): if feeRecords[i]==null or coveredBy[i]!=null -> SetBase(0); else if that charge's EAPG Member is already in the running 'paid' set -> SetBase(0); else if Member==highest.Member -> SetBase(Units*Amount*Percentages[0]/100), add Member to paid; else -> SetBase(Units*Amount*Percentages[secondaryPIndex]/100), add Member to paid, then secondaryPIndex++ capped at last index.

Parameters

KeyMeaning
CodeScheduleTypeKeySchedule type key mapping charge code -> EAPG code (CodeScheduleType field 'CodeScheduleType').
FeeScheduleTypeKeySchedule type key mapping EAPG code -> fee amount (field 'FeeScheduleType').
CoveredByScheduleTypeKeyOptional schedule type key of EAPG codes that subsume/pay $0 for other EAPG codes present on the same account.
PercentagesList<double>, default [100,50,25]; Percentages[0] pays the highest-fee EAPG's first-encountered member charge; Percentages[1],[2],... pay each additional NEWLY-encountered distinct EAPG member in original charge order (index caps at list length, repeating the last value).

Gotchas

(1) Secondary-percentage assignment is by ORDER OF FIRST APPEARANCE of a distinct EAPG Member in context.Charges (i=1..N array order), not by descending fee amount -- unlike the Multiple*Adjustment family this method never sorts charges, so a lower-fee EAPG encountered earlier in the charge list can get a richer percentage than a higher-fee one encountered later. (2) A second charge line sharing the SAME EAPG Member as the overall highest gets $0, not Percentages[0] again and not a secondary percentage -- the paid.Contains() check runs before the highest.Member check, so only the first charge of any given Member is ever paid. (3) Tie-breaking for 'highest' uses strict '<' so the first charge encountered with the maximum fee amount is kept as highest even if a later charge ties it exactly; if two different EAPG Members happen to have identical top fee amounts, only the first-seen one is treated as the 100%-Member and the other is demoted to a secondary percentage. (4) No explicit rounding call in this method (unlike ApplyMultipliers' Math.Round AwayFromZero) -- the decimal division Units*Amount*Percentages[i]/100.0M keeps full decimal precision until whatever rounds it downstream. (5) calc.Percentages.Count < 1 throws; an empty Percentages list is a hard failure, not a default-to-zero.

In the source

class · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CustomerDataModel.cs:809
calculator · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CalculationEngine.cs:1323 (private method CalculateEAPG; no separate Calculator/Generator class)
dispatch · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CalculationEngine.cs:672-674 (case EAPGCalculation eapg: CalculateEAPG(eapg, context);) inside ApplyBaseCalculation

CONFIRMED