Skip to content

Manage distributions and refunds

clsThirdpartyDistribution records a disbursement check against a case's recovery settlement, split across claim-cost, ARA, refund, employer-credit, and up to two "other" amount components. The distribution-history (clsThirdpartyDistHist) and refundee (clsThirdpartyRefundee) classes are read-only projections that surface the resulting history and payee detail; only the distribution and distribution-refund objects carry business rules and write behavior.

Field Value
Operation ID OP-TP-05
Trigger clsThirdpartyDistribution.NewThirdpartyDistribution / GetThirdpartyDistribution followed by property edits and Save()
Inputs CaseSeqNum, DistributionCode, payee name, check number/date/amount, claim-cost/ARA/refund/employer-credit/other amounts, refund payee names
Outputs Persisted thrdparty_distribution row and associated thrdparty_distribution_refund rows; read-only distribution-history and refundee collections for display
Primary components clsThirdpartyDistribution.AddBusinessRules, clsThirdpartyDistribution.ValidCheckAmount, clsThirdpartyDistribution.ValidRefundAmount
Entry point Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistribution.vb

Steps

  1. Create or retrieve a distribution. Retrieval reads a distribution by case (SQL-051, thrdparty_distribution).
  2. Validate the distribution (IsValid), with most checks skipped when DistributionCode is ARA (excess-cash-refund-account distributions do not require a payee, check number, or check date):
  3. Payee name, check number, and check date are required unless the distribution is an ARA type (BR-025).
  4. Check date, when required, must be a reasonable date within the shared CommonBusinessRules window (Now.AddYears(MIN_REASONABLE_DATE_OFFSET) through today) (BR-025).
  5. Check amount is required unless the distribution is an ARA type (BR-026).
  6. Check amount, unless ARA, must equal the sum of claim-cost, ARA, refund, employer-credit, and both other amounts (BR-026).
  7. The excess-cash refund amount must equal the sum of the two individual refund-payee amounts (refund1Amount + refund2Amount), evaluated regardless of distribution type (BR-026).
  8. A refund payee name is required whenever the corresponding refund amount (refund1Amount/refund2Amount) is non-zero (BR-027).
  9. An "other" amount description is required whenever the corresponding other amount (OtherAmount1/OtherAmount2) is non-zero (BR-027).
  10. Create-user text is required, delegated to the shared CommonBusinessRules.TextRequired rule.
  11. A claim-costs-amount-required rule exists in source but is fully commented out and is not registered.*
  12. Persist the distribution via insert (SQL-023) or update (SQL-077) against thrdparty_distribution; insert also allocates a new refund sequence number and writes to thrdparty_distribution_refund when refund payees are populated (thrdparty_distribution_refund).
  13. On a rows-affected value other than 1: an insert/update error message is added.
  14. Read distribution history for display. clsThirdpartyDistHist and its collection retrieve a read-only history of prior distributions for the case; no rules or write paths exist on this class.*
  15. Read refundee detail for display. clsThirdpartyRefundee and its collection retrieve a read-only projection of refund payees for a distribution (SQL-050); no rules or write paths exist on this class.*

Process flow

The following diagram visualizes distribution check validation, centered on the amount-reconciliation rules.

flowchart TD
    Start([Caller creates or edits distribution]) --> Type{DistributionCode = ARA?}
    Type -->|No| Required[Validate payee name,<br>check number, check date,<br>check amount]
    Type -->|Yes| SkipReq[Skip payee/check-identity checks]
    Required --> Amounts[Validate check amount = sum<br>of claim-cost, ARA, refund,<br>employer-credit, other amounts]
    SkipReq --> Amounts
    Amounts --> RefundTotal[Validate refund amount =<br>refund1Amount + refund2Amount]
    RefundTotal --> Names[Validate refund/other payee<br>names present when amounts entered]
    Names --> Ok{All rules pass?}
    Ok -->|No| Fail([Broken rules returned])
    Ok -->|Yes| Save[Insert or update<br>thrdparty_distribution]
    Save --> Rows{RowsAffected = 1?}
    Rows -->|No| Contention([Insert/Update error added])
    Rows -->|Yes| Done([Distribution persisted;<br>refund rows written if present])

Failure and edge-case behavior

  • ARA-type distributions bypass the payee, check-number, check-date, and check-amount-required checks entirely — only the refund-amount-reconciliation and refund/other-name rules still apply to them.
  • The refund-amount-reconciliation rule (ValidRefundAmount) runs unconditionally, even for ARA distributions, unlike the other amount checks.*
  • A claim-costs-amount-required rule is present in source as commented-out code and never registered — the corresponding validation does not run despite appearing in the class.*
  • A rows-affected value other than 1 on insert or update is treated as a DB contention failure rather than an exception (BR-005).
  • Distribution history and refundee reads have no corresponding write path in this library; any correction requires editing the originating distribution and re-saving.*

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistribution.vb
  • Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistributionCollection.vb
  • Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistHist.vb
  • Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistHistCollection.vb
  • Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistributionRefund.vb
  • Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyRefundee.vb
  • Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyRefundeeCollection.vb