Skip to content

Statutory weekly wage calculation

The statutory weekly wage is the legally defined weekly earnings figure that drives time-loss benefit amounts. This operation is a thin read-only wrapper around the Oracle procedure that performs the calculation: it validates nothing itself, passes the wage inputs through unchanged, and returns either a calculated wage or the procedure's own error message. All of the substantive rules live inside the procedure.

Field Value
Operation ID OP-BC-05
Trigger clsStatutoryWeeklyWageCalculation.GetStatutoryWeeklyWageCalculation(dataPortalInfo, injuryDate, wages, payPeriod, hoursPerDay, daysPerWeek)
Inputs Injury date; reported wages; pay period code (H, D, W, M, or A); hours worked per day; days worked per week
Outputs StatutoryWeeklyWage as a decimal amount; ErrorMessage carrying the procedure's rejection text
Primary components clsStatutoryWeeklyWageCalculation.Criteria, clsStatutoryWeeklyWageCalculation.BeforeRetrieve, clsStatutoryWeeklyWageCalculation.AfterRetrieve
Entry point Business\SAIF.Business.Claim\clsStatutoryWeeklyWageCalculation.vb

Steps

  1. Capture the wage inputs. The shared factory builds a Criteria holding the injury date, wages, pay period code, hours worked per day, and days worked per week, then asks the framework data-access layer to retrieve the object.
  2. Bind the procedure call. BeforeRetrieve sets the request to stored-procedure mode, names the procedure, and binds the injury date as a ten-character string, the wages as a numeric value, the pay period as a single character, and the hours-per-day and days-per-week values; an output cursor named recordset receives the result (SQL-026).
  3. Reject impossible injury dates. The procedure refuses an injury date on or before 01-JAN-1900 and returns an error message instead of a wage (PR-001).
  4. Reject non-positive wages. Wages of zero or less are rejected with an error message (PR-002).
  5. Restrict the pay period. Only the hourly, daily, weekly, monthly, and annual pay-period codes are accepted; any other value is rejected (PR-003).
  6. Require the hourly companions. An hourly pay period requires hours worked per day (PR-004), and both the hourly and daily pay periods require days worked per week (PR-005).
  7. Normalize historic schedules. For injuries before 07-JUN-1995 with an hourly or daily pay period, a reported schedule of fewer than three days per week is raised to three days before the wage is computed (PR-006).
  8. Read the returned row. AfterRetrieve opens the cursor, and when a row is present reads the statutory weekly wage as a decimal and the error message as a string into the object's properties.
  9. Any exception raised while reading the row is caught and discarded, leaving both properties at their initial values.
  10. Return the read-only object. The object is marked read-only at construction and its create, insert, update, and delete SQL properties raise an application exception, so nothing about the calculation can be persisted through it.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Caller supplies injury date,<br>wages and pay period]) --> Bind[Bind the stored procedure<br>parameters and output cursor]
    Bind --> Proc[Execute the statutory<br>weekly wage procedure]
    Proc --> Valid{Inputs accepted<br>by the procedure?}
    Valid -->|No| Msg[Procedure returns<br>an error message]
    Valid -->|Yes| Norm{Pre-1995 hourly or daily<br>with fewer than 3 days?}
    Norm -->|Yes| Three[Raise days per week to 3]
    Norm -->|No| Calc
    Three --> Calc[Calculate the statutory<br>weekly wage]
    Calc --> Row[Return a single result row]
    Msg --> Row
    Row --> Read{Row present?}
    Read -->|No| Empty([Wage and message<br>stay unset])
    Read -->|Yes| Fill[Read wage and error message]
    Fill --> Done([Read-only object returned])

Failure and edge-case behavior

  • The wrapper performs no client-side validation, so every rejection arrives as an error message string rather than a business rule failure; callers must inspect the message before trusting the wage.
  • A returned wage of zero is indistinguishable from "no calculation performed" unless the error message is also examined.*
  • The exception handler around the cursor read swallows all errors silently, so a schema or type mismatch surfaces as an empty result rather than a failure.
  • The injury date is bound as a ten-character string, so the caller's date formatting must match what the procedure expects.*
  • The object is read-only by construction, so a caller cannot accidentally persist a calculated wage from here.

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\clsStatutoryWeeklyWageCalculation.vb