pk73059_prem_hist_summary.get_applicable_ard¶
Overview¶
| Field | Value |
|---|---|
| Schema | WCIS_DBA |
| Type | Package helper function |
| Database | Oracle |
| Calling libraries | SAIF.Business.Policy.Rating |
| Calling classes | clsManualClassBase.GetManualClassBaseKey |
Purpose¶
Computes the anniversary-rating date that should govern stored-procedure class lookup when a policy period contains a mid-policy next ARD.
Procedures / Methods¶
get_applicable_ard¶
| Field | Value |
|---|---|
| Returns | DATE |
| Called by | pk73059_prem_hist_summary.sp62005_retrieve_rate |
Description: Chooses between the original ARD and a next-ARD fallback based on policy-period boundaries, rerating state, and class effective date. The function first derives a candidate "next ARD" by calling the sibling helper sp72233_get_next_ard. If that candidate falls strictly inside the policy period, it is kept only when sp72247_midpolicy_ard_rerated reports the mid-policy ARD was rerated; otherwise it is replaced with the policy period's expiration date. Finally, the function returns the original in_ard when the (possibly replaced) next ARD is later than the class effective date, and returns the next ARD otherwise. Any unhandled exception is routed through pk73090_error_handler.raise_an_error with the input parameters and SQLERRM concatenated into the error message.
Parameters¶
| Parameter | Direction | Type | Default | Description |
|---|---|---|---|---|
in_policy_period_eff_date |
IN | DATE | — | Effective date of the policy period; passed through to sp72233_get_next_ard and used as the lower bound when checking whether the next ARD falls inside the policy period. |
in_policy_period_exp_date |
IN | DATE | — | Expiration date of the policy period; passed through to sp72233_get_next_ard and used both as the upper bound for the mid-policy check and as the fallback value substituted for the next ARD when it is not rerated. |
in_ard |
IN | DATE | — | Original anniversary rating date supplied by the caller; returned unchanged when the resolved next ARD is later than in_eff_date. |
in_ard_extension_flag |
IN | VARCHAR2 | — | ARD-extension indicator passed through to sp72233_get_next_ard, which uses it to determine whether the next ARD calculation should account for an ARD extension. |
in_eff_date |
IN | DATE | — | Class effective date used as the comparison point for choosing between the original ARD and the resolved next ARD. |
Business Rules¶
Rules extracted from this function's logic:
| Rule ID | Rule | Condition | Action |
|---|---|---|---|
| BR-039 | Mid-policy next ARD falls back to the policy-period expiration date unless rerated. | The candidate next ARD (from sp72233_get_next_ard) is strictly inside the policy period and sp72247_midpolicy_ard_rerated(v_next_ard) returns FALSE. |
Replace v_next_ard with in_policy_period_exp_date before the final ARD comparison. |
| BR-040 | Original ARD applies when the next ARD falls after the class effective date. | v_next_ard > in_eff_date. |
Return in_ard; otherwise return v_next_ard. |
These rules are documented in business-rules.md. Newly introduced rules must be added to
business-rules.mdas part of the same writing task.
Operations¶
Operations and processes implemented in this function:
| Operation | Description | Trigger |
|---|---|---|
| Determine applicable ARD | Computes the anniversary-rating date that governs class lookup. | Internal helper invoked by pk73059_prem_hist_summary.sp62005_retrieve_rate on procedure entry, before class-rate lookup begins. |
These operations are also listed in operations-processes.md with source reference back to this document.
Source Code¶
PL/SQL function
FUNCTION get_applicable_ard(in_policy_period_eff_date IN DATE
, in_policy_period_exp_date IN DATE
, in_ard IN DATE
, in_ard_extension_flag IN VARCHAR2
, in_eff_date IN DATE)
RETURN DATE
IS
v_next_ard DATE;
BEGIN
v_next_ard :=
sp72233_get_next_ard(in_policy_period_eff_date
, in_policy_period_exp_date
, in_ard
, in_ard_extension_flag);
IF v_next_ard > in_policy_period_eff_date
AND v_next_ard < in_policy_period_exp_date THEN
IF sp72247_midpolicy_ard_rerated(v_next_ard) THEN
NULL;
ELSE
v_next_ard := in_policy_period_exp_date;
END IF;
END IF;
-- determine the ard that applies to the eff date
IF v_next_ard > in_eff_date THEN
RETURN in_ard;
ELSE
RETURN v_next_ard;
END IF;
EXCEPTION
WHEN OTHERS THEN
pk73090_error_handler.raise_an_error(
'get_applicable_ard '
|| in_policy_period_eff_date
|| ','
|| in_policy_period_exp_date
|| ','
|| in_ard
|| ','
|| in_ard_extension_flag
|| ','
|| in_eff_date
|| ','
|| SQLERRM);
END get_applicable_ard;
Related Documentation¶
Sources¶
- Oracle DBA_SOURCE: WCIS_DBA.pk73059_prem_hist_summary
Business\SAIF.Business.Policy.Rating\clsManualClassBase.vb