Benefit period and schedule management¶
Every recurring benefit payment is described by one or more dated periods, an optional future-payment schedule, and a single pay remark. This operation covers the shared classes those payments (documented separately under Timeloss payment issuance and the award operations) build on to describe what is being paid and when.
| Field | Value |
|---|---|
| Operation ID | OP-CP-03 |
| Trigger | clsBenefitPeriodCollection.GetClaimBenefitPeriodCollection(dpi, claimID, benefitPaymentID); clsBenefitSchedule.GetClaimBenefitSchedule(...); clsBenefitRemark.GetBenefitRemark(dpi, benefitPayeeSeqNum) |
| Inputs | IDataPortalInfo, ClaimID, BenefitPaymentID, BenefitPayeeSeqNum, NextIssueDate (schedule-by-date lookup), user-entered dates/amounts/day counts/remark code |
| Outputs | Persisted rows via pk82394_claim_benefit procedures; in-memory collections with aggregate totals; a projected payment list; broken-rule/error messages |
| Primary components | clsBenefitPeriod, clsBenefitPeriodCollection, clsBenefitSchedule, clsBenefitScheduleCollection, clsBenefitRemark |
| Entry point | Business\SAIF.Business.Claim.Payment\Periods\clsBenefitPeriod.vb |
Steps¶
- Retrieve the period collection (SQL-047).
GetClaimBenefitPeriodCollectionandNewClaimBenefitPeriodCollectionboth callRetrieveObject— "New" does not create an empty in-memory collection, it re-reads the database. (CL_BENEFIT_PERIODis not separately catalogued indatabase-tables.md.) - Hydrate each period.
Load/Fillmap amounts, dates, interest, offset, retro-reserve, and TD-day fields, then derive display text from the payment category (TD, VocTD, SupTD). - Create a new period (SQL-004, DUAL).
CreatePeriod()obtains a new sequence value only when the parentBenefitPaymentIDis non-zero — a period created without a parent payment gets no identity. - Load previously-paid history for the period (BR-CP-013).
LoadPreviousPaidProperitesreads matching paid history fromCL_FINANCIAL_TRANS/CL_FINANCIAL_TRANS_DTL(uncatalogued inline query, described here without a SQL-ID link since no matching catalog entry exists), excluding penalty and interest-cost transactions; supplemental periods are matched by reimbursement program7instead of payment category. A match is only honored when the paid periods' minimum begin date and maximum end date exactly equal the period's from/thru dates with no day gaps between them — otherwise previously-paid amount and days are both zeroed. - Validate the period (BR-CP-011). Seven rules run: benefit-amount reconciliation, from-date on or before thru-date, TD days and previous TD days in half-day increments, zero TD days for supplemental periods, and two previously-paid-consistency warnings.
- Check for overlapping periods (BR-CP-012).
clsBenefitPeriodCollection.HasOverlappingPeriodsflags any two periods sharing a payment category whose date ranges overlap;PeriodsMatchingDatesseparately finds periods of a different category with identical dates. - Save a period.
Save()returnsFalseimmediately whenBenefitPeriodID = 0rather than attempting a database call. - Insert/update/delete the period. All three paths call
pk82394_claim_benefitprocedures againstCL_BENEFIT_PERIOD(SQL-014 create, SQL-097 update, SQL-120 delete). - On a rows-affected value other than 1:
"Insert Failed"(insert) orDBContentionError(update/delete) (BR-CP-001). - Retrieve the schedule (SQL-050). A multi-row result silently keeps only the last row loaded, since each
Filloverwrites the object in place. (CL_BENEFIT_SCHEDULEis not separately catalogued indatabase-tables.md.) - Retrieve the schedule collection. Branches between a claim-scoped procedure and a next-issue-date-scoped procedure depending on which parameter is populated; the DPI-only overload leaves both unset and falls into the by-date branch with an empty date.
- Build a payment schedule (BR-CP-014).
CreateSchedule/BuildPaymentProjectionscomputes the from/thru/issue date for each future payment; every issue date after the first rolls back to the previous work day, while the first is never adjusted. - Validate the schedule (BR-CP-014).
Rule_CheckMaxFuturePaymentsrejects a schedule whose remaining payment count exceeds the configured maximum (14 when loaded through the collection); the broken rule carries an empty message. - Insert/update/delete the schedule (SQL-016 create, SQL-099 update, SQL-122 delete).
- On a rows-affected value other than 1:
"Insert Failed"/DBContentionError(BR-CP-001). Unlike the period, a successful update does not advance the update number or mark the object clean — a likely defect.
- On a rows-affected value other than 1:
- Retrieve the pay remark (SQL-049). Missing remarks are not an error;
AfterRetrieveseeds a new, empty remark placeholder. - Validate and save the remark (BR-CP-015). A non-blank code must exist among unexpired rows in the remark-code table (SQL-048); saving with a blank code marks the remark deleted instead of updating it.
- Insert/update/delete the remark (SQL-015 create, SQL-098 update, SQL-121 delete).
- On a rows-affected value other than 1:
"Insert Failed"/DBContentionError(BR-CP-001).
- On a rows-affected value other than 1:
Process flow¶
flowchart TD
Start([Benefit payment aggregate<br>created, retrieved, or saved]) --> Which{Period, schedule,<br>or remark?}
Which -->|Period| Retr[Retrieve/create period]
Retr --> Prev[Load previously-paid history:<br>exact, gap-free match required]
Prev --> Validate{Period rules pass?}
Validate -->|No| Blocked([Broken rules returned])
Validate -->|Yes| Overlap{Overlaps another<br>same-category period?}
Overlap -->|Yes| Flag([Caller warned/blocked])
Overlap -->|No| SavePeriod[Insert/update/delete period]
Which -->|Schedule| BuildSched[Build payment projections:<br>roll issue dates to work days]
BuildSched --> MaxCheck{RemainingPaymentCount<br>within max?}
MaxCheck -->|No| SchedBlocked([Broken rule, empty message])
MaxCheck -->|Yes| SaveSched[Insert/update/delete schedule]
Which -->|Remark| RemarkCode{Remark code blank?}
RemarkCode -->|Yes| DeleteRemark[Mark remark deleted]
RemarkCode -->|No| CheckCode{Code active<br>and on file?}
CheckCode -->|No| RemarkBlocked([Broken rule: invalid remark])
CheckCode -->|Yes| SaveRemark[Insert/update remark]
SavePeriod --> Rows{RowsAffected = 1?}
SaveSched --> Rows
SaveRemark --> Rows
Rows -->|No| Contention([Insert Failed / DB contention error])
Rows -->|Yes| Done([Persisted])
Failure and edge-case behavior¶
- A period created without a parent payment (
BenefitPaymentID = 0) never gets a sequence value andSave()silently returnsFalse— no error message is added. - The schedule's successful update path does not call
MarkOld()or advance the update number, unlike the period and remark equivalents — repeated saves against the same in-memory object may re-send a stale update number. clsBenefitPeriodCollectionandclsBenefitScheduleCollectionare strictly retrieve-only; theirCriteriathrowsInvalidSQLPropertyfor Create/Insert/Update/Delete — each period/schedule instance owns its own persistence.HasPreviouslyPaid3DWand the underlying claim-status checks depend onclsClaimData(SAIF.Business.View.Claim), which is not yet migrated to the new documentation format; see that library'soperations-processes.mdfor the three-day-wait claim context this method reads.
Related documentation¶
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.Payment\Periods\clsBenefitPeriod.vbBusiness\SAIF.Business.Claim.Payment\Periods\clsBenefitPeriodCollection.vbBusiness\SAIF.Business.Claim.Payment\Payments\TimelossPayments\clsBenefitSchedule.vbBusiness\SAIF.Business.Claim.Payment\Payments\TimelossPayments\clsBenefitScheduleCollection.vbBusiness\SAIF.Business.Claim.Payment\clsBenefitRemark.vb