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

  1. <%@ LANGUAGE="VBSCRIPT" TRANSACTION=REQUIRED %>
  2. <% Option Explicit %>
  3.  
  4. <!--#include file=libAuthenticate.inc-->
  5.  
  6. <%
  7. Dim m_ReturnTitle1, m_ReturnTitle2, m_EnrollPrompt, m_BenefitLabel, m_DependentCovered, _
  8.   m_PlanId, m_PlanLabel, m_PlanDesc, m_PlanCost, m_TaxStatusId, m_TaxStatusLabel, _
  9.   m_Change, m_CurrentPlanId, m_ShowPlanId, m_ShowPlanRank, m_PhysicianRequired, _
  10.   m_CoveredPrompt, m_TaxStatusPrompt, m_Review, m_BenefitId, m_RequestPlanId, _
  11.   m_intRequestPlanId, m_intTaxStatus, m_BenefitYear, m_ActiveQualifier, _
  12.   m_NoPhysician, strURL, m_strMainPrompt, m_UpdateMessage
  13.  
  14. ' Move Input parameters to working variables
  15. m_Review = Request("Review")
  16. m_BenefitId = Request("BenefitId")
  17. m_RequestPlanId = Request("RequestPlanId")
  18.  
  19. ' Get the Physician Id that represents 'No Physician Selected'
  20. m_NoPhysician = CInt(Application("NoPhysician"))
  21.  
  22. ' Handle if Review or Open Enrollment and Qualified to change or not
  23. If m_Review = 0 Then
  24.   m_Change = 1
  25.   m_BenefitYear = Year(Date) + 1
  26.   m_ReturnTitle1 = "Return to Open Enrollment"
  27.   m_ReturnTitle2 = "OPEN ENROLLMENT"
  28.   m_EnrollPrompt = "To change your Insurance, select a Plan, make any other changes, " & _
  29.     "and then click <STRONG>Save</STRONG>." & _
  30.     "<BR>Any changes you make will take effect at the beginning of next year.<P>"
  31.   m_CoveredPrompt = "<FONT FACE=VERDANA, ARIAL, HELVETICA SIZE=2> " & _
  32.     "<CENTER> To add or remove coverage, click the check box next to the " & _
  33.     "person whose coverage you want to change. <BR> " &  _
  34.     "You can also <A HREF=" & Chr(34) & "DependentAdd.asp" & Chr(34) & _
  35.     ">add a dependent</A></CENTER></FONT>"
  36.   ' Set prompt about tax status
  37.   m_TaxStatusPrompt = "<FONT FACE=VERDANA, ARIAL, HELVETICA SIZE=2> " & _
  38.     "<CENTER> To choose whether to spend Pre-tax dollars or After-tax dollars " & _
  39.     "on this benefit, select the appropriate button.</CENTER></FONT>"
  40. Else
  41.   ' Deal with records for this year
  42.   m_BenefitYear = Year(Date)
  43.   ' Find out if Employee has a qualifying event in effect for this benefit
  44.   CheckQualifier
  45.   If m_ActiveQualifier = 1 Then
  46.     m_Change = 1
  47.     m_ReturnTitle1 = "Return to Review or Change Current Benefits"
  48.     m_ReturnTitle2 = "REVIEW OR CHANGE CURRENT BENEFITS"
  49.     m_EnrollPrompt = "To change your Insurance, select a Plan, make any other changes, " & _
  50.     "and then click <STRONG>Save</STRONG>." & _
  51.       "<BR>Any changes you make will take effect at the beginning of next month.<P>"
  52.     ' Set prompt about maintaining covered persons
  53.   m_CoveredPrompt = "<FONT FACE=VERDANA, ARIAL, HELVETICA SIZE=2> " & _
  54.     "<CENTER> To add or remove coverage, click the check box next to the " & _
  55.     "person whose coverage you want to change. <BR> " &  _
  56.     "You can also <A HREF=" & Chr(34) & "DependentAdd.asp" & Chr(34) & _
  57.     ">add a dependent</A></CENTER></FONT>"
  58.     ' Set prompt about tax status
  59.     m_TaxStatusPrompt = "<FONT FACE=VERDANA, ARIAL, HELVETICA SIZE=2> " & _
  60.     "<CENTER> To choose whether to spend Pre-tax dollars or After-tax dollars " & _
  61.     "on this benefit, select the appropriate button.</CENTER> </FONT>"
  62.   Else
  63.         m_ReturnTitle1 = "Return to Review or Change Current Benefits"
  64.       m_ReturnTitle2 = "REVIEW OR CHANGE CURRENT BENEFITS"
  65.       m_EnrollPrompt = "To change your Insurance, click <STRONG>Change</STRONG>.<P>"
  66.     ' Set prompt about maintaining covered persons
  67.   m_CoveredPrompt = "<FONT FACE=VERDANA, ARIAL, HELVETICA SIZE=2> " & _
  68.     "<CENTER>You can <A HREF=" & Chr(34) & "DependentAdd.asp" & Chr(34) & _
  69.     ">add a dependent</A></CENTER></FONT>"
  70.   End If
  71. End If
  72.  
  73. m_UpdateMessage = ""
  74. If Request.Form("SubmitPlan") <> "" Then  
  75.   If Request.Form("SubmitPlan") = "Save" Then
  76.     GetValuesFromForm
  77.     UpdateBenefit
  78.     GetCurrentPlan
  79.     m_ShowPlanId = m_CurrentPlanId
  80.     GetPlanInfo(m_ShowPlanId)
  81.     m_UpdateMessage = " Language=JavaScript " & _
  82.       "onLoad=" & Chr(34) & "{ alert ('Your Insurance Plan was updated.');}" & Chr(34)
  83.   ' User clicked Change, so need to get qualifying change info and then update
  84.   Else
  85.     strURL = "Change.asp?BenefitId=" & m_BenefitId
  86.     Response.Redirect(strURL)
  87.     Response.End
  88.   End If
  89. Else
  90.   ' If the Request included a "RequestPlan" then show its info
  91.   If m_RequestPlanId > 0 Then
  92.     GetCurrentPlan
  93.     m_ShowPlanId = CInt(m_RequestPlanId)
  94.     GetPlanInfo(m_ShowPlanId)
  95.   ' Else show the current plan info
  96.   Else
  97.     GetCurrentPlan
  98.     m_ShowPlanId = m_CurrentPlanId
  99.     GetPlanInfo(m_ShowPlanId)
  100.   End If
  101. End If
  102.  
  103. %>
  104.  
  105. <!--BEGIN HTML-->
  106. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  107. <HTML>
  108. <HEAD>
  109. <!--META TAGS ARE RECOMMENDED FOR THE SEARCH ENGINE-->
  110. <META NAME="DESCRIPTION" CONTENT="Insurance Detail">
  111. <META NAME="KEYWORDS" CONTENT="insurance, covered, dependent, change, update">
  112. <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
  113. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
  114. <!--END META TAGS-->
  115.  
  116. <TITLE><%= m_BenefitLabel %></TITLE>
  117. </HEAD>
  118.  
  119. <BODY BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#228B22 LINK=#23238E
  120.  <%= m_UpdateMessage%> >
  121. <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
  122.  
  123. <!--Change link color on mouseover
  124.     Only if running Internet Explorer 4.0 or later -->
  125. <!--#include file=../libHighlight.inc-->
  126.  
  127. <!--COLOR BANNER_START-->
  128. <CENTER>
  129. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  130.   <TR>
  131.     <TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
  132.     </TD>
  133.   </TR>
  134. </TABLE>
  135. <!--COLOR BANNER_END-->
  136.  
  137. <!--BEGIN TABLE CONTAINING LOGO, TITLE AND NAVIGATIONAL LINK-->
  138. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  139.   <TR>
  140.     <TD VALIGN=TOP WIDTH=325>
  141.       <A HREF="../default.asp">
  142.         <IMG SRC="../images/logo_sm.gif" WIDTH=200 HEIGHT=100 
  143.           ALT="Return to Exploration Air Home Page" BORDER=0>
  144.       </A>
  145.       <BR>
  146.       <A HREF="default.asp">
  147.         <IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5
  148.           ALT="Return to Employee Benefit Home Page" BORDER=0>
  149.       </A>
  150.       <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2" ><STRONG>
  151.         <A HREF="default.asp" TITLE="Click to return to Employee Benefit Home Page">
  152.           EMPLOYEE BENEFITS HOME PAGE
  153.         </A>
  154.       </STRONG></FONT>
  155.       <BR>
  156.       <A HREF="Benefits.asp?Review=<%= m_Review%>">
  157.         <IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5
  158.           ALT="<%= m_ReturnTitle1%>" BORDER=0>
  159.       </A>
  160.       <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2" ><STRONG>
  161.         <A HREF="Benefits.asp?Review=<%= m_Review%>" TITLE="<%= m_ReturnTitle1%>">
  162.           <%= m_ReturnTitle2%>
  163.         </A>
  164.       </STRONG></FONT>
  165.     </TD>
  166.     <TD VALIGN=MIDDLE WIDTH=200>
  167.       <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=3>
  168.         <%= m_strMainPrompt %>
  169.       </FONT>
  170.     </TD>
  171.     <TD VALIGN=MIDDLE WIDTH=200>
  172.       <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>
  173.         <%= m_BenefitLabel %>
  174.       </FONT>
  175.     </TD>
  176.     <TD VALIGN=TOP ALIGN=RIGHT>
  177.       <A HREF="../HowItWorks/HIWBenefitsDetail.asp">
  178.         <IMG SRC="../images/btssmall.gif" WIDTH="115" HEIGHT="52" 
  179.           ALT="Click here to learn how this page works" BORDER=0>
  180.       </A>
  181.     </TD>
  182.   </TR>
  183. </TABLE>
  184. <!--END TABLE CONTAINING LOGO, TITLE AND NAVIGATIONAL LINK-->
  185.  
  186. <BR>
  187. <BR>
  188.  
  189. <% 'Conditional HTML code for RDS
  190. If Session("UseRDS") = "True" Then
  191. %>
  192.  
  193. <!-- Non-visual controls - used for data binding -->
  194. <OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" 
  195.      ID=dsoPlan 
  196.      HEIGHT=1 WIDTH = 1>
  197. </OBJECT>
  198. <OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" 
  199.      ID=dsoField 
  200.      HEIGHT=1 WIDTH = 1>
  201. </OBJECT>
  202.  
  203. <!-- BEGIN TABLE CONTAINING THE EMPLOYEE'S BENEFITS INFO -->
  204.       <%= m_EnrollPrompt%>
  205.  
  206. <TABLE BORDER=1 WIDTH=90%>
  207.   <TR>
  208.     <TH>
  209.       Plan
  210.     </TH>
  211.     <TD>
  212.   <% If m_Change = 1 Then %>
  213.       <TABLE>
  214.         <TR ALIGN=CENTER>
  215.           <TD>
  216.             <INPUT TYPE=BUTTON NAME="MoveFirst" VALUE="First">
  217.           </TD>
  218.           <TD>
  219.             <INPUT TYPE=BUTTON NAME="MovePrevious" VALUE="Previous">
  220.           </TD>
  221.           <TD>
  222.             <SPAN NAME="PlanLabel" DATASRC="#dsoPlan" DATAFLD="PlanLabel"></SPAN>
  223.           </TD>
  224.           <TD>
  225.             <INPUT TYPE=BUTTON NAME="MoveNext" VALUE="Next">
  226.           </TD>
  227.           <TD>
  228.             <INPUT TYPE=BUTTON NAME="MoveLast" VALUE="Last">
  229.           </TD>
  230.         </TR>
  231.       </TABLE>
  232.   <% Else %>
  233.           <TD>
  234.             <SPAN NAME="PlanLabel" DATASRC="#dsoPlan" DATAFLD="PlanLabel"></SPAN>
  235.           </TD> 
  236.   <% End If %>                  
  237.     </TD>
  238.   </TR>
  239. </TABLE>
  240.  
  241. <!--BEGIN FORM-->
  242. <FORM NAME="formPlan" METHOD=POST 
  243.   ACTION="DetailInsurance.asp?BenefitId=<%= m_BenefitId %>&Review=<%= m_Review %>"> 
  244.  
  245. <DIV ID=RankZero>
  246.  
  247. <INPUT TYPE=HIDDEN NAME="RequestPlanId" DATASRC="#dsoPlan" DATAFLD="PlanId">
  248.  
  249. <TABLE BORDER=1 WIDTH=90%>
  250.   <TR>
  251.     <TH>
  252.       Description
  253.     </TH>
  254.     <TD>
  255.       <SPAN NAME="PlanDesc" DATASRC="#dsoPlan" DATAFLD="PlanDesc"></SPAN>     
  256.     </TD>
  257.   </TR>
  258.   <TR>
  259.     <TH>
  260.       Cost per Period
  261.     </TH>
  262.     <TD>
  263.       $<SPAN NAME="PlanCost" DATASRC="#dsoPlan" DATAFLD="PlanCost"></SPAN>     
  264.     </TD>
  265.   </TR>
  266. </TABLE>
  267. <TABLE DATASRC="#dsoField" BORDER=1 WIDTH=90%>
  268.   <TR>
  269.     <TH>
  270.       <SPAN NAME="FieldLabel" DATAFLD="FieldLabel"></SPAN>
  271.     </TH>
  272.     <TD>
  273.       <SPAN NAME="FieldValue" DATAFLD="FieldValue"></SPAN>
  274.     </TD>
  275.   </TR> 
  276. </TABLE>
  277.  
  278.   <% ' Show dependent coverage information as appropriate  
  279.   If m_DependentCovered = 1 Then %>
  280. <TABLE WIDTH=90%>
  281.   <TR>
  282.     <TD>
  283.        
  284.     </TD>
  285.   </TR>
  286.   <TR>
  287.     <TD>
  288.       <%= m_CoveredPrompt%>
  289.     </TD>
  290.   </TR>
  291.   <TR>
  292.     <TD>
  293.       <TABLE BORDER=1 WIDTH=100%>
  294.         <TR>
  295.           <TH COLSPAN=5>
  296.     <% If m_Change = 1 Then %>
  297.             Dependents
  298.     <% Else %>
  299.             Covered Persons
  300.     <% End If %>
  301.           </TH>
  302.         </TR>
  303.         <TR>
  304.     <% If m_Change = 1 Then %>
  305.             <TH>
  306.             Covered
  307.           </TH>
  308.     <% End If %>
  309.           <TH>
  310.             Relationship
  311.           </TH>
  312.           <TH>
  313.             Name
  314.           </TH>
  315.           <TH ID=PhysHead>
  316.             Physician
  317.           </TH>
  318.         </TR>
  319.     <% If m_Change = 1 Then 
  320.       ListDependents 
  321.     Else
  322.       ListCoveredPersons
  323.     End If
  324.     %>
  325.       </TABLE>
  326.     </TD>
  327.   </TR>
  328. <% ' End Show dependent coverage information as appropriate
  329.   End If 
  330. %>
  331.   <TR>
  332.     <TD>
  333.        
  334.     </TD>
  335.   </TR>
  336.   <TR>
  337.     <TD>
  338. <%  
  339.     If FindTaxChoice() Then
  340.       Response.Write m_TaxStatusPrompt
  341.     End If
  342. %>
  343.     </TD>
  344.   </TR>
  345.   <TR>
  346.     <TD>
  347.       <TABLE BORDER=1 WIDTH=100%>
  348.         <TR>
  349.           <TH>
  350.             Tax Status
  351.           </TH>
  352.           <TD>
  353.   <%
  354.   If m_Change = 1 Then
  355.     BuildTaxStatusList
  356.   Else
  357.     Response.Write m_TaxStatusLabel
  358.   End If
  359.   %>
  360.           </TD>
  361.         </TR>
  362.       </TABLE>
  363.     </TD>
  364.   </TR>
  365. </TABLE>
  366.  
  367. <!--End of hiding section-->
  368. </DIV>
  369.  
  370. <P>
  371.  
  372.   <%
  373.   If m_Change = 1 Then
  374.     Response.Write "<INPUT TYPE=Submit NAME=SubmitPlan VALUE=Save>"
  375.   Else
  376.     Response.Write "<INPUT TYPE=Submit NAME=SubmitPlan VALUE=Change>"
  377.   End If
  378.   %>
  379.  
  380. </FORM>
  381.  
  382. <% 'Conditional HTML code for RDS
  383. Else
  384. %>
  385.  
  386. <!-- BEGIN TABLE CONTAINING THE EMPLOYEE'S BENEFITS INFO -->
  387. <CENTER>
  388.       <BR>
  389.       <%= m_EnrollPrompt%>
  390.          
  391. <TABLE WIDTH=90%>
  392.   <TR>
  393.     <TD>
  394.       <TABLE BORDER=1 WIDTH=100%>
  395.         <TR>
  396.           <TH>
  397.             Plan
  398.           </TH>
  399.           <TD>
  400.  
  401. <!--BEGIN FORM-->
  402. <FORM NAME="formPlan" METHOD=POST 
  403.   ACTION="DetailInsurance.asp?BenefitId=<%= m_BenefitId %>&Review=<%= m_Review %>"> 
  404.  
  405.   <%
  406.   If m_Change = 1 Then
  407.     BuildPlanList
  408.   Else
  409.     Response.Write m_PlanLabel  
  410.   End If
  411.   %>
  412.           </TD>
  413.         </TR>
  414.  
  415.   <% 'Do not show the following if the benefit has "No Plan" selected 
  416.   If m_ShowPlanRank > 0 Then %>
  417.  
  418.         <TR>
  419.           <TH>
  420.             Description
  421.           </TH>
  422.           <TD>
  423.             <%= m_PlanDesc %>
  424.           </TD>
  425.         </TR>
  426.         <TR>
  427.           <TH>
  428.             Cost per Period
  429.           </TH>
  430.           <TD>
  431.             <% If IsNull(m_PlanCost) Then m_PlanCost = 0 %>
  432.             <% = FormatCurrency(m_PlanCost) %>   
  433.           </TD>
  434.         </TR>
  435.  
  436. <!--Generate the PlanField lines-->
  437. <% ListPlanField(m_ShowPlanId) %>
  438.  
  439.       </TABLE>
  440.     </TD>
  441.   </TR>
  442.   <TR>
  443.     <TD>
  444.        
  445.     </TD>
  446.   </TR>
  447.     <% ' Show dependent coverage information as appropriate
  448.     If m_DependentCovered = 1 Then %>
  449.   <TR>
  450.     <TD>
  451.       <%= m_CoveredPrompt%>
  452.     </TD>
  453.   </TR>
  454.   <TR>
  455.     <TD>
  456.       <TABLE BORDER=1 WIDTH=100%>
  457.         <TR>
  458.           <TH COLSPAN=5>
  459.       <% If m_Change = 1 Then %>
  460.             Dependents
  461.       <% Else %>
  462.             Covered Persons
  463.       <% End If %>
  464.           </TH>
  465.         </TR>
  466.         <TR>
  467.       <% If m_Change = 1 Then %>
  468.           <TH>
  469.             Covered
  470.           </TH>
  471.       <% End If %>
  472.           <TH>
  473.             Relationship
  474.           </TH>
  475.           <TH>
  476.             Name
  477.           </TH>
  478.       <% If m_PhysicianRequired = 1 Then %>
  479.           <TH>
  480.             Physician
  481.           </TH>
  482.       <% End If %>
  483.         </TR>
  484.       <% 
  485.       If m_Change = 1 Then 
  486.         ListDependents 
  487.       Else
  488.         ListCoveredPersons
  489.       End If 
  490.       %>
  491.       </TABLE>
  492.     </TD>
  493.   </TR>
  494.     <% ' End Show dependent coverage information as appropriate
  495.     End If %>
  496.   <TR>
  497.     <TD>
  498.        
  499.     </TD>
  500.   </TR>
  501.   <TR>
  502.     <TD>
  503. <%  
  504.     If FindTaxChoice() Then
  505.       Response.Write m_TaxStatusPrompt
  506.     End If
  507. %>
  508.     </TD>
  509.   </TR>
  510.   <TR>
  511.     <TD>
  512.       <TABLE BORDER=1 WIDTH=100%>
  513.         <TR>
  514.           <TH>
  515.             Tax Status
  516.           </TH>
  517.           <TD>
  518.     <%
  519.     If m_Change = 1 Then
  520.       BuildTaxStatusList
  521.     Else
  522.       Response.Write m_TaxStatusLabel
  523.     End If
  524.     %>
  525.           </TD>
  526.         </TR>
  527.  
  528.   <% ' End of conditional code for if the benefit has "No Plan" selected 
  529.   End If %>
  530.  
  531.       </TABLE>
  532.     </TD>
  533.   </TR>
  534. </TABLE>
  535.  
  536. <P>
  537.  
  538.   <%
  539.   If m_Change = 1 Then
  540.     Response.Write "<INPUT TYPE=Submit NAME=SubmitPlan VALUE=Save>"
  541.   Else
  542.     Response.Write "<INPUT TYPE=Submit NAME=SubmitPlan VALUE=Change>"
  543.   End If
  544.   %>
  545.  
  546. </FORM>
  547. </CENTER>
  548. <BR>
  549.  
  550. <% 'End of conditional HTML code for RDS
  551. End If
  552. %>
  553.   
  554. </CENTER>
  555. <BR>
  556.  
  557. <P> 
  558. <HR=400>
  559. <P>
  560.  
  561. <CENTER>
  562. <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1">
  563. <A HREF="../legal.htm" TITLE="Click to view Copyright and Legal Information">
  564.   ©1997 Microsoft Corporation. All rights reserved. Terms of Use.
  565. </A>
  566. </FONT>
  567. </CENTER>
  568.  
  569. <P>
  570.  
  571. <!--BEGIN COLOR BANNER-->
  572. <TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
  573.     <TR>
  574.       <TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
  575.       </TD>
  576.     </TR>
  577. </TABLE>
  578. <!--END COLOR BANNER-->
  579.  
  580. <% 'Conditional Script for RDS
  581. If Session("UseRDS") = "True" Then
  582. %>
  583.  
  584. <!-- Script to run the RDS -->
  585. <SCRIPT LANGUAGE="VBScript">
  586. Option Explicit
  587. '---- enum Values ----
  588. Const adcExecSync = 1
  589. Const adcExecAsync = 2
  590.  
  591. '---- enum Values ----
  592. Const adcFetchUpFront = 1
  593. Const adcFetchBackground = 2
  594.  
  595. Sub Window_OnLoad
  596.  
  597.   ' Get the Plan records
  598.   GetPlans
  599.  
  600.   ' Get the Field records corresponding to the Plan records
  601.   GetFields
  602.  
  603.   ' Show the Employee's current plan
  604.   ShowCurrentPlan
  605.  
  606. End Sub
  607.  
  608. Sub GetPlans
  609.  
  610.   ' Change the asynchronous options such that execution is synchronous
  611.   ' and Fetching can occur in the background
  612.   dsoPlan.ExecuteOptions = adcExecSync
  613.   dsoPlan.FetchOptions = adcFetchBackground
  614.  
  615.   dsoPlan.Server = "http://<%=Request.ServerVariables("SERVER_NAME")%>"
  616.   dsoPlan.Connect = "FILEDSN=<%= Application("DSNBenefits") %>"
  617.  
  618.   dsoPlan.SQL = "SELECT p.PlanId, p.PlanLabel, p.PlanDesc, p.PlanCost, " & _
  619.              "p.PhysicianRequired, bp.PlanRank " & _
  620.              "FROM Plans p " & _
  621.              "JOIN BenefitPlan bp ON bp.BenefitId = <%=m_BenefitId%> " & _
  622.              "AND bp.PlanId = p.PlanId " & _
  623.              "ORDER BY bp.PlanRank"
  624.  
  625.   'Get the data specified
  626.   dsoPlan.Refresh
  627.  
  628. End Sub
  629.  
  630. Sub GetFields
  631.  
  632.   ' Change the asynchronous options so that execution is synchronous
  633.   ' and Fetching can occur in the background
  634.   dsoField.ExecuteOptions = adcExecSync
  635.   dsoField.FetchOptions = adcFetchBackground
  636.  
  637.   dsoField.Server = "http://<%=Request.ServerVariables("SERVER_NAME")%>"
  638.   dsoField.Connect = "FILEDSN=<%= Application("DSNBenefits") %>"
  639.  
  640.   dsoField.SQL = "SELECT p.PlanId, f.FieldLabel, pf.FieldValue " & _
  641.              "FROM Plans p " & _
  642.              "JOIN PlanField pf ON pf.PlanId = p.PlanId " & _
  643.              "JOIN Field f ON pf.FieldId = f.FieldId " & _
  644.              "JOIN BenefitPlan bp ON bp.BenefitId = <%=m_BenefitId%> " & _
  645.              "AND bp.PlanId = p.PlanId " & _
  646.              "ORDER BY pf.FieldRank"
  647.  
  648.   'Get the data
  649.   dsoField.Refresh
  650.  
  651. End Sub
  652.  
  653. Sub ShowCurrentPlan
  654.  
  655.   Dim intCurrent
  656.  
  657.   On Error Resume Next
  658.  
  659.   ' Loop through recordset until get to the employee's current plan
  660.   intCurrent = 1
  661.   Do While dsoPlan.Recordset("PlanId") <> <%= m_CurrentPlanId %>
  662.     intCurrent = intCurrent + 1
  663.     dsoPlan.Recordset.MoveNext
  664.     ' Will error if already at last
  665.     If Err.Number <> 0 Then
  666.       dsoPlan.Recordset.MoveLast
  667.       Exit Do
  668.     End If
  669.   Loop
  670.  
  671.   SetRankZero
  672.  
  673.   SetNavigationButtons
  674.  
  675.   SetPhysInfo
  676.  
  677.   ' Show the Field records for this Plan
  678.   FilterPlanField(dsoPlan.Recordset("PlanId"))
  679.  
  680. End Sub
  681.  
  682. ' Display DIV called RankZero as needed
  683. Function SetRankZero
  684.   dim e
  685.   set e = document.all.RankZero
  686.   If dsoPlan.Recordset("PlanRank") > 0 Then
  687.     e.style.display = ""  
  688.   Else 
  689.     e.style.display = "none"  
  690.   End If
  691. End Function
  692.  
  693. ' Set Display of Physician info as needed
  694. Function SetPhysInfo
  695.  
  696.   ' Some plans will not have PhysHead in them
  697.   On Error Resume Next
  698.  
  699.   Dim e, i, PhysIdCol
  700.   Set e = document.all.PhysHead
  701.   If dsoPlan.Recordset("PhysicianRequired") = 1 Then
  702.     e.style.display = ""  
  703.   Else 
  704.     e.style.display = "none"  
  705.   End If
  706.  
  707.   Set e = document.all.PhysId
  708.   If dsoPlan.Recordset("PhysicianRequired") = 1 Then
  709.     e.style.display = ""  
  710.   Else 
  711.     e.style.display = "none" 
  712.   End If
  713.  
  714.   Set PhysIdCol =  document.all.item("PhysId")
  715.   For i = 0 to (PhysIdCol.length)
  716.     If dsoPlan.Recordset("PhysicianRequired") = 1 Then
  717.       PhysIdCol(i).style.display = ""  
  718.     Else 
  719.       PhysIdCol(i).style.display = "none"  
  720.     End If
  721.   Next
  722.  
  723. End Function
  724.  
  725. Sub MoveFirst_OnClick
  726.   
  727.   dsoPlan.Recordset.MoveFirst
  728.  
  729.   SetNavigationButtons
  730.  
  731.   SetRankZero
  732.  
  733.   SetPhysInfo
  734.  
  735.   ' Show the Field records for this Plan
  736.   FilterPlanField(dsoPlan.Recordset("PlanId"))
  737.  
  738. End Sub
  739.  
  740. Sub MovePrevious_OnClick
  741.  
  742.   dsoPlan.Recordset.MovePrevious
  743.  
  744.   SetNavigationButtons
  745.  
  746.   SetRankZero
  747.  
  748.   SetPhysInfo
  749.  
  750.   ' Show the Field records for this Plan
  751.   FilterPlanField(dsoPlan.Recordset("PlanId"))
  752.  
  753. End Sub
  754.  
  755. Sub MoveNext_OnClick
  756.  
  757.   dsoPlan.Recordset.MoveNext
  758.  
  759.   SetNavigationButtons
  760.  
  761.   SetRankZero
  762.  
  763.   SetPhysInfo
  764.  
  765.   ' Show the Field records for this Plan
  766.   FilterPlanField(dsoPlan.Recordset("PlanId"))
  767.  
  768. End Sub
  769.  
  770. Sub MoveLast_OnClick
  771.  
  772.   dsoPlan.Recordset.MoveLast
  773.  
  774.   SetNavigationButtons
  775.  
  776.   SetRankZero
  777.  
  778.   SetPhysInfo
  779.  
  780.   ' Show the Field records for this Plan
  781.   FilterPlanField(dsoPlan.Recordset("PlanId"))
  782.  
  783. End Sub
  784.  
  785. Sub SetNavigationButtons
  786.  
  787.   Dim intShowing, intNewShow
  788.  
  789.   On Error Resume Next
  790.  
  791.   'Save the record number we are about to show
  792.   intNewShow = dsoPlan.Recordset("PlanId")
  793.  
  794.   ' Loop through recordset until get to the currently displayed plan
  795.   dsoPlan.Recordset.MoveFirst
  796.   intShowing = 1
  797.   Do While dsoPlan.Recordset("PlanId") <> intNewShow
  798.     intShowing = intShowing + 1
  799.     dsoPlan.Recordset.MoveNext
  800.     ' Will error if already at last
  801.     If Err.Number <> 0 Then
  802.       dsoPlan.Recordset.MoveLast
  803.       Exit Do
  804.     End If
  805.   Loop
  806.  
  807.   ' Disable or Enable buttons as needed
  808.   If intShowing = 1 Then
  809.     MoveFirst.Disabled = True
  810.     MovePrevious.Disabled = True
  811.   Else
  812.     MoveFirst.Disabled = False
  813.     MovePrevious.Disabled = False
  814.   End If
  815.  
  816.   If intShowing = dsoPlan.Recordset.RecordCount Then
  817.     MoveLast.Disabled = True
  818.     MoveNext.Disabled = True
  819.   Else
  820.     MoveLast.Disabled = False
  821.     MoveNext.Disabled = False
  822.   End If
  823.  
  824. End Sub
  825.  
  826. ' Filter Field records to show those for the current Plan
  827. Sub FilterPlanField(byval PlanId)
  828.         
  829.   dsoField.FilterColumn = "PlanId"
  830.   dsoField.FilterCriterion = "="
  831.   dsoField.FilterValue = PlanId
  832.   dsoField.Reset(False)
  833.  
  834. End Sub
  835. </SCRIPT>
  836.  
  837. <% 'End of conditional Script for RDS
  838. End If
  839. %>
  840.  
  841. </BODY>
  842. </HTML>
  843. <!--END HTML-->
  844.  
  845. <%
  846.  
  847.   '
  848.   'Determine if employee has a qualifier in effect
  849.   '
  850.   
  851.   Sub CheckQualifier
  852.     Dim Benefit, rstActiveQualifier
  853.     Set Benefit = Server.CreateObject("Benefit.BenefitList")
  854.     Set rstActiveQualifier = Benefit.CheckQualifier(Application("DSNBenefits"), _
  855.       Session("EmployeeId"), m_BenefitId)
  856.     If Not rstActiveQualifier.EOF Then
  857.       m_ActiveQualifier = 1
  858.     End If
  859.  End Sub
  860.  
  861.   '
  862.   ' Get Current Plan
  863.   '
  864.   Sub GetCurrentPlan
  865.     Dim BenefitList, rstCurrentPlan
  866.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  867.     Set rstCurrentPlan = BenefitList.CurrentPlan(Application("DSNBenefits"), Session("EmployeeID"), _
  868.       m_BenefitId)
  869.     If Not rstCurrentPlan.EOF Then
  870.       m_BenefitLabel = rstCurrentPlan("BenefitLabel")
  871.       m_CurrentPlanId = rstCurrentPlan("PlanId")
  872.       m_DependentCovered = rstCurrentPlan("DependentCovered")
  873.       m_TaxStatusId = rstCurrentPlan("TaxStatusId")
  874.       m_TaxStatusLabel = rstCurrentPlan("TaxStatusLabel")
  875.     End If
  876.   End Sub
  877.  
  878.   '
  879.   ' Get Plan info
  880.   '
  881.   Sub GetPlanInfo(byval PlanId)
  882.     Dim BenefitList, rstPlanInfo
  883.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  884.     Set rstPlanInfo = BenefitList.PlanInfo(Application("DSNBenefits"), _
  885.       m_BenefitId, PlanId)
  886.     If Not rstPlanInfo.EOF Then
  887.       m_PlanLabel = rstPlanInfo("PlanLabel")
  888.       m_PlanDesc = rstPlanInfo("PlanDesc")
  889.       m_PlanCost = rstPlanInfo("PlanCost")
  890.       m_PhysicianRequired = rstPlanInfo("PhysicianRequired")
  891.       m_ShowPlanRank = rstPlanInfo("PlanRank")
  892.     End If
  893.   End Sub
  894.  
  895.   '
  896.   ' Create Select list of available Plans
  897.   '
  898.   Sub BuildPlanList
  899.     Dim BenefitList, rstPlanList
  900.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  901.     Set rstPlanList = BenefitList.PlanList(Application("DSNBenefits"), m_BenefitId)
  902.     Response.Write "<SELECT NAME=RequestPlanId onChange=formPlan.submit() >" & Chr(13)
  903.     Do Until rstPlanList.EOF
  904.       Response.Write "<OPTION VALUE= "
  905.       Response.Write rstPlanList("PlanId")
  906.       If rstPlanList("PlanId") = m_ShowPlanId Then
  907.         Response.Write " SELECTED "
  908.       End If
  909.       Response.Write ">" & rstPlanList("PlanLabel") & Chr(13)
  910.       rstPlanList.MoveNext
  911.     Loop
  912.     Response.Write "</SELECT>" & Chr(13)
  913.   End Sub
  914.  
  915.   '
  916.   ' Generate the rows of the Fields for the current Plan.
  917.   '
  918.   Sub ListPlanField(byval PlanId)
  919.     Dim BenefitList, rstPlanField
  920.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  921.     Set rstPlanField = BenefitList.PlanField(Application("DSNBenefits"), PlanId)
  922.     Do Until rstPlanField.EOF
  923.       Response.Write "<TR>" & Chr(13)
  924.       Response.Write "<TH>" & rstPlanField("FieldLabel") & "</TH>" & Chr(13)
  925.       Response.Write "<TD> " & rstPlanField("FieldValue") & "</TD>" & Chr(13)
  926.       Response.Write "</TR>" & Chr(13)
  927.       rstPlanField.MoveNext
  928.     Loop
  929.   End Sub
  930.  
  931.   '
  932.   ' Generate the rows for a table consisting of the Dependent info for the current Benefit.
  933.   '
  934.   Sub ListDependents
  935.     Dim BenefitList, rstDependents
  936.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  937.     Set rstDependents = BenefitList.ListDependents(Application("DSNBenefits"), Session("EmployeeId"), _
  938.       m_BenefitId) 
  939.     Do Until rstDependents.EOF
  940.       Response.Write "<TR>" & Chr(13)
  941.       
  942.       Response.Write "<TD ALIGN=CENTER> <INPUT TYPE=CHECKBOX NAME=DepCovered " & _
  943.       "VALUE=" & rstDependents("DependentId")
  944.       If rstDependents("EBDStatusId") = 1 Then
  945.         Response.Write " CHECKED ></TD>" & Chr(13)
  946.       Else
  947.         Response.Write "></TD>" & Chr(13)
  948.       End If
  949.       
  950.       Response.Write "<TD>" & rstDependents("DependentTypeLabel") & "</TD>" & Chr(13)
  951.       Response.Write "<TD>" & rstDependents("FirstName") & " " & rstDependents("LastName") & " " & "</TD>" & Chr(13)
  952.       
  953.       If (m_PhysicianRequired = 1) OR (Session("UseRDS") = "True") Then
  954.         Response.Write "<TD ID=PhysId>" 
  955.         BuildPhysicianList rstDependents("PhysicianId")
  956.         Response.Write "</TD>" & Chr(13)
  957.       End If
  958.       
  959.       Response.Write "</TR>" & Chr(13)
  960.       rstDependents.MoveNext
  961.     Loop
  962.   End Sub
  963.  
  964.   '
  965.   ' Generate the rows for a table consisting of the Covered Persons for the current Benefit.
  966.   '
  967.   Sub ListCoveredPersons
  968.     Dim BenefitList, rstCovered
  969.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  970.     Set rstCovered = BenefitList.ListCoveredPersons(Application("DSNBenefits"), _
  971.       Session("EmployeeId"), m_BenefitId)
  972.     Do Until rstCovered.EOF
  973.       Response.Write "<TR>" & Chr(13)      
  974.       Response.Write "<TD>" & rstCovered("DependentTypeLabel") & "</TD>" & Chr(13)
  975.       Response.Write "<TD>" & rstCovered("FirstName") & " " & rstCovered("LastName") & " " & "</TD>" & Chr(13)
  976.       
  977.       If (m_PhysicianRequired = 1) OR (Session("IEVersion") >= 4) Then
  978.         Response.Write "<TD ID=PhysId> " 
  979.         Response.Write rstCovered("PhysicianLabel")
  980.         Response.Write " </TD>" & Chr(13)
  981.       End If
  982.       
  983.       Response.Write "</TR>" & Chr(13)
  984.       rstCovered.MoveNext
  985.     Loop
  986.   End Sub
  987.  
  988.   '
  989.   ' Create Select list of Physicians
  990.   '
  991.   Sub BuildPhysicianList (ByVal DependentPhysicianId)
  992.     Dim BenefitList, rstPhysicianList
  993.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  994.     Set rstPhysicianList = BenefitList.PhysicianList(Application("DSNBenefits"))
  995.     Response.Write "<SELECT NAME=PhysicianId >" & Chr(13)
  996.     Do Until rstPhysicianList.EOF
  997.       Response.Write "<OPTION VALUE=" & rstPhysicianList("PhysicianId")
  998.       If rstPhysicianList("PhysicianId") = DependentPhysicianId Then
  999.         Response.Write " SELECTED "
  1000.       End If
  1001.       Response.Write ">" & rstPhysicianList("PhysicianLabel") & Chr(13)
  1002.       rstPhysicianList.MoveNext
  1003.     Loop
  1004.     Response.Write "</SELECT>" & Chr(13)
  1005.   End Sub
  1006.  
  1007.   '
  1008.   ' Determine count of available Tax Statuses
  1009.   '
  1010.   Function FindTaxChoice()
  1011.     FindTaxChoice = True
  1012.     Dim BenefitList, rstTaxStatusList
  1013.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  1014.     Set rstTaxStatusList = BenefitList.TaxStatusList(Application("DSNBenefits"), m_BenefitId)
  1015.     If rstTaxStatusList.RecordCount <2 And Not rstTaxStatusList.EOF Then
  1016.       FindTaxChoice = False
  1017.     End If
  1018.   End Function
  1019.  
  1020.   '
  1021.   ' Create Radio buttons of available Tax Statuses (or just output the only available status)
  1022.   '
  1023.   Sub BuildTaxStatusList
  1024.     Dim BenefitList, rstTaxStatusList
  1025.     Set BenefitList = Server.CreateObject("Benefit.BenefitList")
  1026.     Set rstTaxStatusList = BenefitList.TaxStatusList(Application("DSNBenefits"), m_BenefitId)
  1027.     If rstTaxStatusList.RecordCount <2 And Not rstTaxStatusList.EOF Then
  1028.       Response.Write rstTaxStatusList("TaxStatusLabel")
  1029.     Else
  1030.       Do Until rstTaxStatusList.EOF
  1031.         Response.Write "<INPUT TYPE=RADIO NAME=TaxStatus"
  1032.         If Not IsNull(m_TaxStatusId) Then
  1033.           If rstTaxStatusList("TaxStatusId") = m_TaxStatusId Then
  1034.             Response.Write " CHECKED "
  1035.           End If
  1036.         Else
  1037.           If rstTaxStatusList("TaxDefault") = 1 Then
  1038.             Response.Write " CHECKED "
  1039.           End If
  1040.         End If
  1041.         Response.Write " VALUE=" & rstTaxStatusList("TaxStatusId")
  1042.         Response.Write ">" & rstTaxStatusList("TaxStatusLabel") & Chr(13)
  1043.         rstTaxStatusList.MoveNext
  1044.       Loop
  1045.     End If
  1046.   End Sub
  1047.  
  1048.   '
  1049.   ' Take values from the submitted form and assign to page level variables.
  1050.   '
  1051.   Sub GetValuesFromForm
  1052.     m_intRequestPlanId = Trim(Request.Form("RequestPlanId"))
  1053.     'If "No Plan Selected" then Tax Status will not be on form
  1054.     If Trim(Request.Form("TaxStatus")) <> "" Then
  1055.       m_intTaxStatus = Trim(Request.Form("TaxStatus"))
  1056.     Else
  1057.       m_intTaxStatus = 1
  1058.     End If
  1059.   End Sub
  1060.  
  1061.   ' 
  1062.   ' Update the database. Return 0 if successful or 1 if an error is encountered.
  1063.   '
  1064.   Function UpdateBenefit
  1065.     On Error Resume Next
  1066.     GetValuesFromForm
  1067.     Dim Benefit, i
  1068.     Set Benefit = Server.CreateObject("Benefit.BenefitList")
  1069.     Benefit.Update Application("DSNBenefits"), Session("EmployeeId"), m_BenefitId, _
  1070.       m_intRequestPlanId, m_intTaxStatus
  1071.     
  1072.     ' Mark all Dependents as Not Covered (Change status to 2 for InActive )
  1073.     Benefit.InactivateDependents Application("DSNBenefits"), Session("EmployeeId"), _
  1074.       m_BenefitId
  1075.     
  1076.     ' Process any Dependents marked as Covered (Change status to 1 for Active )
  1077.     For i = 1 to Request.Form("DepCovered").Count
  1078.       ' PhysicianId is not included with some plans. If not bound, Count will be 0.
  1079.       If Request.Form("PhysicianId").Count > 0 Then
  1080.         Benefit.SaveDependents Application("DSNBenefits"), Session("EmployeeId"), _
  1081.           m_BenefitId, Request.Form("DepCovered")(i), Request.Form("PhysicianId")(i)
  1082.       Else
  1083.         Benefit.SaveDependents Application("DSNBenefits"), Session("EmployeeId"), _
  1084.           m_BenefitId, Request.Form("DepCovered")(i), m_NoPhysician
  1085.       End If
  1086.     Next
  1087.     
  1088.     If Err.Number = 0 Then
  1089.       UpdateBenefit = 0
  1090.     Else
  1091.       ContextObject.SetAbort
  1092.       UpdateBenefit = 1
  1093.     End If
  1094.   End Function
  1095.  
  1096.   Sub OnTransactionCommit
  1097.   
  1098.   End Sub
  1099.  
  1100.   Sub OnTransactionAbort    
  1101.         m_strMainPrompt = "A problem occurred while trying to update the database. Please try again later. "
  1102.   End Sub
  1103.  
  1104. %>