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