Source Code for http://www.alphasierrapapa.com/componentcenter/euro/samples/eurocalculator.asp
COLOR LEGEND
| | Server Side Script |
| | Client Side Script |
| | Hyperlink |
| | Include |
| | Frames |
| | Comments |
| | Object Code Link |
| | Standard HTML and Text |
<% @ Language=VBScript %>
<!--#INCLUDE file="currencies.asp"-->
<%
Sub WriteSelect(strName)
Response.Write "<SELECT NAME=""" & strName & """>" & vbCRLF
For i=0 to UBound(arrEMUCurrencies)
Response.Write "<OPTION>" & arrEMUCurrencies(i) & vbCRLF
Next
Response.Write "</SELECT>" & vbCRLF
End Sub
%>
<%
Const cstrPagetitle = "EURO Conversion Calculator"
%>
<!--#INCLUDE virtual="/includes/componentcenter/ccheadstart.asp"-->
<!-- here the custom META tags need to be inserted -->
<META NAME="DESCRIPTION" CONTENT="Euro Conversion Calculator based on the Euro Conversion Component by Christoph Wille.">
<!--#INCLUDE virtual="/componentcenter/euro/includes/euroheadend.asp"-->
<!--#INCLUDE virtual="/componentcenter/euro/includes/euronavigation.asp"-->
<H1><%=cstrPagetitle%></H1>
<%
' conversion results are presented first
strAction = Trim(Request.Form("ConvAction"))
if (len(strAction) > 0) then
nValue = Trim(Request.Form("Value"))
if (Len(nValue) > 0 and IsNumeric(nValue)) Then
set convObj = Server.CreateObject("Softwing.EDConverter")
select case strAction
case "2EuroSymbol"
strConverted = convObj.ConvertToEuro(CDbl(nValue), Trim(Request.Form("Currency")))
strConverted = nValue & " " & Trim(Request.Form("Currency")) & " equal " & _
strConverted & " Euro"
case "2EuroRate"
nRate = Trim(Request.Form("Rate"))
If (Len(nRate) > 0 and IsNumeric(nRate)) Then
strConverted = convObj.ConvertToEuro(CDbl(nValue), CDbl(nRate))
strConverted = nValue & " converted with " & nRate & " equal " & strConverted & " Euro"
End If
case "EMUTriangulate"
strConverted = convObj.Triangulate(CDbl(nValue), Trim(Request.Form("CurrencyFrom")),Trim(Request.Form("CurrencyTo")))
strConverted = nValue & " " & Trim(Request.Form("CurrencyFrom")) & " equal " & _
strConverted & " " & Trim(Request.Form("CurrencyTo"))
case "EMUTriangulateRates"
nRateFrom = Trim(Request.Form("RateFrom"))
nRateTo = Trim(Request.Form("RateTo"))
If (Len(nRateFrom) > 0 and IsNumeric(nRateFrom) and Len(nRateTo) > 0 and IsNumeric(nRateTo)) Then
strConverted = convObj.Triangulate(CDbl(nValue), CDbl(nRateFrom),CDbl(nRateTo))
strConverted = nValue & " converted with rates " & nRateFrom & ", " & nRateTo & " equals " & strConverted & " Euro"
end if
end select
Response.Write "<B>" & strConverted & "</B><BR>"
end if ' check of value
end if
%>
<form method=post action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
Conversion of EMU currency to Euro with currency symbol:<BR>
<input type=text name="Value" size=10>
<input type=hidden name="ConvAction" value="2EuroSymbol">
<% WriteSelect "Currency" %>
<input type=submit value="Calculate">
</form>
<form method=post action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
Conversion of monetarian value to Euro with exchange rate:<BR>
<input type=text name="Value" size=10>
<input type=hidden name="ConvAction" value="2EuroRate">
<input type=text name="Rate" size=10>
<input type=submit value="Calculate">
</form>
<form method=post action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
Triangulation of EMU currencies with symbols:<BR>
<input type=text name="Value" size=10>
<input type=hidden name="ConvAction" value="EMUTriangulate">
<% WriteSelect "CurrencyFrom" %>
<% WriteSelect "CurrencyTo" %>
<input type=submit value="Calculate">
</form>
<form method=post action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
Triangulation of monetarion values with rates:<BR>
<input type=text name="Value" size=10>
<input type=hidden name="ConvAction" value="EMUTriangulateRates">
<input type=text name="RateFrom" size=10>
<input type=text name="RateTo" size=10>
<input type=submit value="Calculate">
</form>
<P>If you need more information on when you have to use Triangulation, then please see the <A HREF="/componentcenter/euro/help/" TARGET="_new">documentation</A> of
the EDConverter component.</p>
<!--#INCLUDE file="sourceinclude.asp"-->
<!--#INCLUDE virtual="/includes/componentcenter/cctextend.asp"-->
<!--#INCLUDE virtual="/includes/componentcenter/ccfooter.asp"-->