home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_05.cab / financej.asp < prev    next >
Text File  |  1998-04-27  |  3KB  |  134 lines

  1. <%@ LANGUAGE = JScript %>
  2. <HTML><HEAD><TITLE>Future Value Calculation</TITLE>
  3.  
  4. <META NAME="ROBOTS" CONTENT="NOINDEX"></HEAD>
  5. <SCRIPT LANGUAGE="JavaScript">
  6.     TempString = navigator.appVersion
  7.     if (navigator.appName == "Microsoft Internet Explorer"){    
  8. // Check to see if browser is Microsoft
  9.         if (TempString.indexOf ("4.") >= 0){
  10. // Check to see if it is IE 4
  11.             document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
  12.         }
  13.         else {
  14.             document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
  15.         }
  16.     }
  17.     else if (navigator.appName == "Netscape") {                        
  18. // Check to see if browser is Netscape
  19.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
  20.     }
  21.     else
  22.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
  23. </script>
  24.  
  25.  
  26.  
  27.  
  28.  
  29. <body bgcolor="#FFFFFF" text="#000000"><font face="Verdana,Arial,Helvetica">
  30.  
  31.  
  32. <% 
  33. // Check to see if an Annual Percentage Rate 
  34. // was entered 
  35.  
  36. var rate = Request("APR")(1);
  37. if (rate.substring(0,1) == "." )
  38.   rate = "0" + rate;
  39. var v = IsNumeric(rate);
  40. if  (v == true)
  41.    {
  42.     if (rate > 1) 
  43.     {
  44.     var APR = rate / 100; 
  45.      }
  46.   else 
  47.     var APR = rate;    
  48.   }
  49. else 
  50.   var APR = 0; 
  51.  
  52. // Check whether a value for Total Payments 
  53. // was entered 
  54. var totpmnt = Request("TotPmts")(1);
  55. var tp = IsNumeric(totpmnt);
  56. if (tp == true) 
  57.    {
  58.   var TotPmts = totpmnt;
  59.     }
  60. else 
  61.   var TotPmts = 0; 
  62.  
  63.  
  64. // Check whether a value for Payment Amount 
  65. // was entered 
  66. var pymnt = Request("Payment")(1);
  67. var ts = IsNumeric(pymnt);
  68. if (ts == true) 
  69.    {
  70.   var Payment = pymnt; 
  71.    }
  72. else 
  73. var Payment = 0; 
  74.  
  75.  
  76. // Check whether a value for Account Present Value 
  77. // was entered 
  78. var payval = Request("PVal")(1);
  79. var tx = IsNumeric(payval);
  80. if (tx== true) {
  81. var PVal = payval;  
  82. }
  83. else 
  84. var PVal = 0;
  85.  
  86. //Check whether user wants to make payments at the beginning or end of month.
  87. var ptype = Request("PayType")(1);
  88. if (ptype == "Beginning") 
  89.   {
  90.   var PayType = 1;  
  91.   }
  92. else 
  93.   var PayType = 0;
  94.  
  95. // Create an instance of the Finance object 
  96. Finance = Server.CreateObject("MS.Finance.Java");   
  97.  
  98.     
  99. //Use your instance of the Finance object to 
  100. // calculate the future value of the submitted 
  101. // savings plan using the HTML form and the 
  102. // CalcFV method 
  103. FVal = Finance.CalcFV(APR / 12, TotPmts, -Payment, -PVal, PayType) 
  104.  
  105. var Savings = NumFormat(FVal);
  106.  
  107. //Function for determining is form value is a number    
  108. function IsNumeric(str) {
  109. for (var i=0; i<str.length; i++){
  110.   var ch=str.substring(i, i+1)
  111.   if( ch<"0" || ch>"9"){
  112.       return false;
  113.   }
  114.   return true;
  115.  }
  116. }
  117.  
  118. //Function for limiting return values to two places after decimal point.
  119. function NumFormat(str) {
  120.         str = "" + str + "00";      
  121.         return (str.substring (0, str.indexOf (".") + 3));
  122.     }
  123.  
  124.  
  125. %>
  126.  
  127. <h3><A NAME="H3_37662227"></A>Your savings will be worth $ <%= Savings%>.</h3>
  128.  
  129.  
  130.  
  131. </FONT>
  132.  
  133. </BODY> 
  134. </HTML>