---
title: Statutory weekly wage calculation
summary: Calculates a worker's statutory weekly wage from injury date, reported wages, and pay period by invoking the sp82286_statutoryweeklywage stored procedure.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-30
library: SAIF.Business.Claim
reference_type: package
operation_id: OP-BC-05
trigger: A caller requests a statutory weekly wage for a set of wage inputs through GetStatutoryWeeklyWageCalculation
---

# 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](../sql/SQL-026-saif-business-claim.md)).
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](../business-rules.md#pr-001-reject-injury-dates-on-or-before-01-jan-1900)).
4. **Reject non-positive wages.** Wages of zero or less are rejected with an error message ([PR-002](../business-rules.md#pr-002-reject-non-positive-wages)).
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](../business-rules.md#pr-003-restrict-pay-period-to-h-d-w-m-or-a)).
6. **Require the hourly companions.** An hourly pay period requires hours worked per day ([PR-004](../business-rules.md#pr-004-enforce-hours-per-day-for-hourly-wage-inputs)), and both the hourly and daily pay periods require days worked per week ([PR-005](../business-rules.md#pr-005-enforce-days-worked-per-week-for-hourly-and-daily-inputs)).
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](../business-rules.md#pr-006-normalize-pre-1995-hourlydaily-schedules-to-a-three-day-minimum)).
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.
   - Any exception raised while reading the row is caught and discarded, leaving both properties at their initial values.
9. **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.

```mermaid
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.

## Related documentation

- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **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`
