<% ' Save URL of calling page as needed SetURLCallHIW %> How The Benefits Summary Page Works

Behind the Scenes at Exploration Air


"> Return to Exploration Air Benefits " TITLE="Return to Exploration Air Benefits"> B  A  C  K 

V I E W   S O U R C E

How The Benefits Summary Page Works


The Big Picture

This page displays the employee's current benefits, and links that the employee can click to review or change individual benefit choices.

Functional Overview

As on most other pages in the Benefits application, a few standard tasks are done at the top of the page. The first is that VBScript is declared the default scripting language for the page. Next, "TRANSACTION=REQUIRED" is specified to cause Microsoft Transaction Server to wrap the actions of the page in a transaction. Then, "Option Explicit" is specified so that an error will generate unless all the variables on the page are explicitly declared. This protects against errors caused by misspelling a variable name and having the server treat the misspelled variable name as a new variable declaration.

Next, libAuthenticate.inc checks whether the user has a Session variable containing the EmployeeId. If not, then the request is redirected to Benefits/Default.asp to ensure that the application is properly initialized for the user.

This page is generated to either "Review/Change Current Benefits" or for "Open Enrollment". This is determined by checking the "Review" parameter of the query string. A parameter of 0 means this page should generate for Open Enrollment. A parameter of 1 means this page should generate for Review.

If the page is prepared for Open Enrollment, a check is made of whether the employee has already been in open enrollment for the coming benefit year. If not, the component method Employee.NewBenefits is called, specifying the new benefit year. This component creates records in the Benefits database for the benefits that have been created for the next year.

Next, four subprocedures are run to get subtotals of the employee's benefits information. These subprocedures call component methods which get information from the database and compute the totals. The methods called are BenefitList.GetTotalCost (called once with a parameter for After-tax total and again with a parameter for Pre-tax total), BenefitList.GetTotalCredits, and BenefitList.GetTotalPaycheck.

Now the HTML page is written. One of the first things that happens is that an include file tests whether the client browser is Internet Explorer 4.0 or later. If so, then two functions are included in the page that will change the color of links whenever the mouse passes over them.

A subprocedure called ListBenefitSummary runs to generate the table in the middle of the page. This subprocedure calls the component method BenefitList.SummaryForID to prepare a recordset of data that will be generated into a table by the ASP script.

Data Model

You can view a diagram of the database.

Components Used

This pages uses methods in the Employee class and the BenefitList class of the Benefit component.
Employee.NewBenefits
BenefitList.GetTotalCost
BenefitList.GetTotalCredits
BenefitList.GetTotalPaycheck
BenefitList.SummaryForID



©1997 Microsoft Corporation. All rights reserved. Terms of Use.

<% ' ' SetURLCallHIW saves the name of the page in the application that called HIW page ' Sub SetURLCallHIW ' Extract the last directory from path Dim strPathInfo, strLastChar, intLocation, ShortString, strLastDir strPathInfo = Request.ServerVariables("HTTP_REFERER") ' now str has a value like: "http://servername/exair/benefits/Default.asp" ' we need to extract "benefits" strLastChar = "" ShortString = strPathInfo intLocation = 0 If Len(ShortString) > 0 Then ' Get position of beginning of file name Do Until strLastChar = "/" strLastChar = right(ShortString, 1) ShortString = left(ShortString, len(ShortString)-1) intLocation = intLocation + 1 Loop ' Now get position of beginning of last directory name strLastChar = "" Do Until strLastChar = "/" strLastChar = right(ShortString, 1) ShortString = left(ShortString, len(ShortString)-1) intLocation = intLocation + 1 Loop strLastDir = mid(strPathInfo, len(strPathInfo) - (intLocation - 2), 10) ' If last directory not 'HowItWorks', then save the calling URL If strLastDir <> "HowItWorks" Then Session("URLCallHIW") = strPathInfo End If End If End Sub %>