Skip to content

sp82286_statutoryweeklywage

Overview

Field Value
Schema WCIS_DBA
Type Standalone procedure
Calling libraries SAIF.Business.Claim
Calling classes clsStatutoryWeeklyWageCalculation

Purpose

Reject injury dates on or before 01-JAN-1900

Procedures / Methods

BeforeRetrieve

Field Value
Returns Oracle result or output parameters
Called by clsStatutoryWeeklyWageCalculation

Description: Executes the BeforeRetrieve Oracle routine for SAIF.Business.Claim.

AfterRetrieve

Field Value
Returns Oracle result or output parameters
Called by clsStatutoryWeeklyWageCalculation

Description: Executes the AfterRetrieve Oracle routine for SAIF.Business.Claim.

Business Rules

PR-001: Reject injury dates on or before 01-JAN-1900

Field Value
Statement Injury dates on or before 01-JAN-1900 are rejected
Trigger sp82286_statutoryweeklywage receives inInjuryDate <= 01-JAN-1900
Enforcement sp82286_statutoryweeklywage sets ErrorMessage to Invalid injury date and exits before calculation
Outcome No statutory weekly wage is calculated and the caller receives an error message
Confidence Verified
Source Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb (BeforeRetrieve, AfterRetrieve call sp82286_statutoryweeklywage)

PR-002: Reject non-positive wages

Field Value
Statement Non-positive wages are rejected
Trigger sp82286_statutoryweeklywage receives inWages <= 0
Enforcement sp82286_statutoryweeklywage sets ErrorMessage to Invalid wages at time of injury and exits
Outcome No statutory weekly wage is calculated and the caller receives an error message
Confidence Verified
Source Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb (BeforeRetrieve, AfterRetrieve call sp82286_statutoryweeklywage)

PR-003: Restrict pay period to H, D, W, M, or A

Field Value
Statement Pay period codes are limited to H, D, W, M, or A
Trigger sp82286_statutoryweeklywage receives an unsupported inPayPeriod value
Enforcement sp82286_statutoryweeklywage sets ErrorMessage to Invalid pay period and exits
Outcome No statutory weekly wage is calculated and the caller receives an error message
Confidence Verified
Source Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb (BeforeRetrieve, AfterRetrieve call sp82286_statutoryweeklywage)

PR-004: Enforce hours per day for hourly wage inputs

Field Value
Statement Hourly wage inputs must include hours worked per day
Trigger sp82286_statutoryweeklywage receives inPayPeriod = H with inHoursWorkedPerDay = 0
Enforcement sp82286_statutoryweeklywage sets ErrorMessage to Invalid hours worked per day for a hourly pay period and exits
Outcome No statutory weekly wage is calculated and the caller receives an error message
Confidence Verified
Source Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb (BeforeRetrieve, AfterRetrieve call sp82286_statutoryweeklywage)

PR-005: Enforce days worked per week for hourly and daily inputs

Field Value
Statement Hourly and daily wage inputs must include days worked per week
Trigger sp82286_statutoryweeklywage receives inPayPeriod = H or D with inDaysWorkedPerWeek = 0
Enforcement sp82286_statutoryweeklywage sets ErrorMessage to Invalid days worked per week for a hourly or daily pay period and exits
Outcome No statutory weekly wage is calculated and the caller receives an error message
Confidence Verified
Source Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb (BeforeRetrieve, AfterRetrieve call sp82286_statutoryweeklywage)

PR-006: Normalize pre-1995 hourly/daily schedules to a three-day minimum

Field Value
Statement Pre-1995 hourly and daily schedules with fewer than three days worked are normalized to three days per week
Trigger sp82286_statutoryweeklywage receives inPayPeriod = H or D, an injury date before 07-JUN-1995, and inDaysWorkedPerWeek < 3
Enforcement sp82286_statutoryweeklywage assigns v_DaysWorkedPerWeek := 3 before the wage calculation
Outcome The calculation uses a three-day minimum work schedule
Confidence Verified
Source Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb (BeforeRetrieve, AfterRetrieve call sp82286_statutoryweeklywage)

Operations

Operation Description Trigger
Calculate statutory weekly wage Calculates statutory weekly wage from injury date, wage basis, and schedule inputs clsStatutoryWeeklyWageCalculation.BeforeRetrieve

Source Code

PL/SQL procedure body
-- Actual PL/SQL body retrieved from Oracle via Legends CLI
-- Source: DBA_SOURCE / ALL_SOURCE for WCIS_DBA.sp82286_statutoryweeklywage
procedure sp82286_statutoryweeklywage
(inInjuryDate         IN Varchar2
, inWages             IN Number
, inPayPeriod         IN Varchar2
, inHoursWorkedPerDay IN Number
, inDaysWorkedPerWeek IN Number
,  recordset IN OUT sys_refcursor)
/****************************************************************
*Procedure Title  : Calcuate Statutory Weekly Wage
*
*Name             : sp82286_statutoryweeklywagecalculation
*Called by        :.Net object clsStatutoryWeeklyWageCalculation
*****************************************************************
*PROGRAMMER     ANALYST                 DATE                      MOD #
*TONBUS                              06/22/2007
*Description:  Process determines the statutory weekly wage depending on the
*              parameters that are passed in and makes the results available
*              to the .net object clsStatutoryWeeklyWageCalculation
******************************************************************/

Is

 v_StatutoryWeeklyWage Number(11, 2);
 v_ErrorMessage        Varchar2(100);
 v_WeeksPerMonth       Number(5, 4);
 v_DaysWorkedPerWeek   Number;

procedure SelectStatutoryWeeklyWage
is
  begin
  OPEN recordset FOR
  SELECT
       v_StatutoryWeeklyWage as StatutoryWeeklyWage,
       v_ErrorMessage as ErrorMessage
    FROM dual;
end SelectStatutoryWeeklyWage;

-- ----------------------------------------------------------
--    M a i n   P r o c e d u r e
-- ----------------------------------------------------------
BEGIN
v_ErrorMessage := '';
v_StatutoryWeeklyWage := 0.00;
v_DaysWorkedPerWeek := inDaysWorkedPerWeek;

        --check for injury date
        If to_date(inInjuryDate, 'MM/DD/YYYY') <= to_date('01-jan-1900','dd-mon-yyyy') then
             v_ErrorMessage := 'Invalid injury date';
             SelectStatutoryWeeklyWage;
             Return;
        End If;

        --check for wages
        If inWages <= 0 Then
            v_errormessage := 'Invalid wages at time of injury';
            SelectStatutoryWeeklyWage;
            Return;
        End If;

        --check for valid pay period
        If inPayPeriod != 'H' and
           inPayPeriod != 'D' and
           inPayPeriod != 'W' and
           inPayPeriod != 'M' and
           inPayPeriod != 'A' Then
            v_errormessage := 'Invalid pay period';
            SelectStatutoryWeeklyWage;
            Return;
        End If;

        --check for valid hours for an hourly pay period
        If inPayPeriod = 'H' and
           inHoursWorkedPerDay = 0 Then
            v_errormessage := 'Invalid hours worked per day for a hourly pay period';
            SelectStatutoryWeeklyWage;
            Return;
        End If;

        --check for valid days for an hourly or daily pay period
        If (inPayPeriod = 'H' or
            inPayPeriod = 'D') and
           inDaysWorkedPerWeek = 0 Then
            v_errormessage := 'Invalid days worked per week for a hourly or daily pay period';
           SelectStatutoryWeeklyWage;
           Return;
        End If;

        --If the injury date is before 10/01/1973 then the weeks per month is 4.3452 else it is 4.35
        If to_date(inInjuryDate, 'MM/DD/YYYY') < to_date('01-oct-1973','dd-mon-yyyy') then
             v_WeeksPerMonth := 4.3452;
        Else
            v_WeeksPerMonth := 4.35;
        End If;

        --If the injury date is before 10/07/1995 and hourly or daily then the minimul days worked per week is three
        If (inPayPeriod = 'H' or
            inPayPeriod = 'D') and
           to_date(inInjuryDate, 'MM/DD/YYYY') < to_date('07-jun-1995','dd-mon-yyyy') and
           inDaysWorkedPerWeek < 3 Then
            v_DaysWorkedPerWeek := 3;
        End If;

        --Calculate the statutory weekly wage
        v_StatutoryWeeklyWage :=
        Case inPayPeriod
             When 'H' Then inWages * inHoursWorkedPerDay * v_DaysWorkedPerWeek
             When 'D' Then inWages * v_DaysWorkedPerWeek
             When 'W' Then inWages
             When 'M' Then inWages / v_WeeksPerMonth
             When 'A' Then inWages / 52
             --When 'A' Then (inWages / 12) / v_WeeksPerMonth
             Else 0.00
        End;

        SelectStatutoryWeeklyWage;
     Return ;

END sp82286_statutoryweeklywage;

Sources

  • Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb