home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / HIWBenefitsSummary.asp < prev    next >
Text File  |  1997-11-01  |  9KB  |  222 lines

  1. <%
  2.  
  3.   ' Save URL of calling page as needed
  4.   SetURLCallHIW
  5.  
  6. %>
  7.  
  8. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  9. <HTML>
  10. <HEAD>
  11. <!--META TAGS ARE RECOMMENDED FOR THE SEARCH ENGINE-->
  12. <META NAME="DESCRIPTION" CONTENT="How It Works Page">
  13. <META NAME="KEYWORDS" CONTENT="help, code, source code, questions, explanation">
  14. <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
  15. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
  16. <!--END META TAGS-->
  17.  
  18. <TITLE>How The Benefits Summary Page Works</TITLE>
  19. </HEAD>
  20.  
  21. <BODY  BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#808080 LINK=#FFCC00>
  22. <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
  23.  
  24. <!--Change link color on mouseover
  25.     Only if running Internet Explorer 4.0 or later -->
  26. <!--#include file=../libHighlight.inc-->
  27.  
  28. <!--BEGIN TOP TABLE HOLDING GRAPHIC, NAVIGATIONAL LINK, AND MAIN CONTENT-->
  29. <TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING=0 CELLSPACING=0  BGCOLOR="#000000" BORDER=0>
  30.   <TR>
  31.     <TD BGCOLOR="#000000" ALIGN=CENTER VALIGN=TOP WIDTH=170>
  32.       <BR>
  33.       <IMG SRC="../images/btslarge.jpg" HEIGHT=119 WIDTH=171  
  34.         ALT="Behind the Scenes at Exploration Air" BORDER=0 >
  35.       <BR>
  36.       <BR>
  37.       <BR>
  38.       <!--BACK BUTTON AND VARIABLE TO RETURN TO ORIGINATING PAGE-->
  39.       <A HREF="<%=Session("URLCallHIW")%>">
  40.         <IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 ALT="Return to Exploration Air Benefits"  
  41.           HSPACE=2 BORDER=0>
  42.       </A>
  43.       <FONT SIZE=2 FACE="VERDANA, ARIAL, HELVETICA"><STRONG>
  44.         <A HREF="<%=Session("URLCallHIW")%>" TITLE="Return to Exploration Air Benefits">
  45.           B  A  C  K 
  46.         </A>
  47.       </STRONG></FONT>
  48.       <BR> 
  49.       <BR>
  50.       <!--JAVASCRIPT TO VIEW PAGE'S SOURCE CODE-->
  51.       <FONT SIZE=2 FACE="VERDANA, ARIAL, HELVETICA">
  52.         <A HREF="JavaScript:openWindow('../Benefits/Benefits.asp')" 
  53.           TITLE="View the Source for the Default page">
  54.           V I E W   S O U R C E
  55.         </A>
  56.         <BR>
  57.       </FONT>
  58.     </TD>
  59.     <TD BGCOLOR="#FFFFFF" BACKGROUND="../images/btsbg.gif" VALIGN=top>
  60.       <BR CLEAR=ALL>
  61.       <TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0>   
  62.         <TR>
  63.           <TD VALIGN=top>
  64.             <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>
  65.               How The Benefits Summary Page Works
  66.             </FONT>
  67.             <P>
  68.             <HR>
  69.             <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="3">
  70.                         
  71.             <H2>The Big Picture</H2>
  72.             This page displays the employee's current benefits, and links that the employee can click
  73.             to review or change individual benefit choices.
  74.  
  75.             <H2>Functional Overview</H2>
  76.  
  77.             As on most other pages in the Benefits application, a few standard tasks are
  78.             done at the top of the page. The first is that VBScript is declared the default 
  79.             scripting language for the page. Next, "TRANSACTION=REQUIRED" is specified to cause
  80.             Microsoft Transaction Server to wrap the actions of the page in a transaction.
  81.             Then, "Option Explicit" is specified so that an error will generate unless
  82.             all the variables on the page are explicitly declared. This protects against
  83.             errors caused by misspelling a variable name and having the server treat 
  84.             the misspelled variable name as a new variable declaration.
  85.         
  86.             <P>Next, libAuthenticate.inc checks whether the user has a Session variable containing
  87.             the EmployeeId. If not, then the request is redirected to Benefits/Default.asp 
  88.             to ensure that the application is properly initialized for the user.
  89.  
  90.             <P>This page is generated to either "Review/Change Current Benefits" or for "Open Enrollment".
  91.             This is determined by checking the "Review" parameter of the query string. A parameter of 0 
  92.             means this page should generate for Open Enrollment. A parameter of 1 
  93.             means this page should generate for Review.
  94.  
  95.             <P>If the page is prepared for Open Enrollment, a check is made of whether the employee
  96.             has already been in open enrollment for the coming benefit year. If not, the component
  97.             method 
  98.             <STRONG><A HREF=HIWBenefitsComponent.asp#NewBenefits>Employee.NewBenefits</A></STRONG>
  99.             is called, specifying the new benefit year. This component creates records
  100.             in the Benefits database for the benefits that have been created for the next year.
  101.  
  102.             <P>Next, four subprocedures are run to get subtotals of the employee's benefits
  103.             information. These subprocedures call component methods which get information from the
  104.             database and compute the totals. The methods called are
  105.             <STRONG><A HREF=HIWBenefitsComponent.asp#GetTotalCost>BenefitList.GetTotalCost</A></STRONG> 
  106.             (called once with a parameter for After-tax total and again    with a parameter for Pre-tax total), 
  107.             <STRONG><A HREF=HIWBenefitsComponent.asp#GetTotalCredits>BenefitList.GetTotalCredits</A></STRONG>,
  108.             and 
  109.             <STRONG><A HREF=HIWBenefitsComponent.asp#GetTotalPaycheck>BenefitList.GetTotalPaycheck</A></STRONG>.
  110.  
  111.             <P>Now the HTML page is written. One of the first things that happens is that an include 
  112.             file tests whether the client browser is Internet Explorer 4.0 or later. If so, then
  113.             two functions are included in the page that will change the color of links 
  114.             whenever the mouse passes over them.
  115.  
  116.             <P>A subprocedure called ListBenefitSummary runs to generate the table in the middle
  117.             of the page. This subprocedure calls the component method 
  118.             <STRONG><A HREF=HIWBenefitsComponent.asp#SummaryForID>BenefitList.SummaryForID</A></STRONG>
  119.             to prepare a recordset of data that will be generated into a table by the ASP script.
  120.  
  121.             <H2>Data Model</H2>
  122.  
  123.             You can view a diagram of the <STRONG><A HREF="HIWBenefitsSchema.asp">database</A></STRONG>.
  124.  
  125.             <P>
  126.             <H2>Components Used</H2>
  127.  
  128.             This pages uses methods in the Employee class and the BenefitList class of the 
  129.             Benefit component.
  130.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#NewBenefits>Employee.NewBenefits</A></STRONG>
  131.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#GetTotalCost>BenefitList.GetTotalCost</A></STRONG>
  132.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#GetTotalCredits>BenefitList.GetTotalCredits</A></STRONG>
  133.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#GetTotalPaycheck>BenefitList.GetTotalPaycheck</A></STRONG>
  134.             <BR><STRONG><A HREF=HIWBenefitsComponent.asp#SummaryForID>BenefitList.SummaryForID</A></STRONG>
  135.  
  136.             <P>
  137.             </FONT>
  138.           </TD>
  139.         </TR>
  140.       </TABLE>
  141.       <!--END TOP TABLE HOLDING GRAPHIC, NAVIGATIONAL LINK, AND MAIN CONTENT-->
  142.  
  143.       <BR>
  144.       <BR>
  145.  
  146.       <CENTER>
  147.       <!--BEGIN LEGAL INFORMATION-->
  148.       <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
  149.         <TR>
  150.           <TD>
  151.             <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1">
  152.               <A HREF="../legal.htm">
  153.                 ©1997 Microsoft Corporation. All rights reserved. Terms of Use.
  154.               </A>
  155.             </FONT>
  156.             <P>
  157.           </TD>
  158.         </TR>
  159.       </TABLE>
  160.       </CENTER>
  161.       <!--END LEGAL INFORMATION-->
  162.     </TD>
  163.   </TR>
  164. </TABLE>
  165.  
  166. </BODY>
  167. </HTML>
  168. <!--END HTML-->
  169.  
  170. <SCRIPT LANGUAGE="JavaScript">
  171. function openWindow(SourceURL)
  172. {
  173.     // Set some defaults
  174.     width=450;
  175.     height=450;
  176.  
  177.     url = "code.asp?Source=" + SourceURL;
  178.     window.open(url,"Sample","resizable=yes,scrollbars=yes,width=" + width + ",height=" + height);
  179. }
  180. </SCRIPT>
  181.  
  182. <%
  183.  
  184.   '
  185.   ' SetURLCallHIW saves the name of the page in the application that called HIW page
  186.   '
  187.   Sub SetURLCallHIW
  188.     ' Extract the last directory from path
  189.     Dim strPathInfo, strLastChar, intLocation, ShortString, strLastDir
  190.     strPathInfo = Request.ServerVariables("HTTP_REFERER")
  191.     ' now str has a value like: "http://servername/exair/benefits/Default.asp"
  192.     ' we need to extract "benefits"
  193.     strLastChar = ""
  194.     ShortString = strPathInfo
  195.     intLocation = 0
  196.     
  197.     If Len(ShortString) > 0 Then
  198.         ' Get position of beginning of file name
  199.         Do Until strLastChar = "/"
  200.           strLastChar = right(ShortString, 1)
  201.           ShortString = left(ShortString, len(ShortString)-1)
  202.           intLocation = intLocation + 1
  203.         Loop
  204.     
  205.         ' Now get position of beginning of last directory name
  206.         strLastChar = ""
  207.         Do Until strLastChar = "/"
  208.           strLastChar = right(ShortString, 1)
  209.           ShortString = left(ShortString, len(ShortString)-1)
  210.           intLocation = intLocation + 1
  211.         Loop
  212.         strLastDir = mid(strPathInfo, len(strPathInfo) - (intLocation - 2), 10)
  213.     
  214.         ' If last directory not 'HowItWorks', then save the calling URL
  215.         If strLastDir <> "HowItWorks" Then
  216.           Session("URLCallHIW") = strPathInfo
  217.         End If
  218.     End If
  219.   End Sub
  220.  
  221. %>
  222.