Forums
This topic is locked
decimals problem...
Posted 29 Jan 2004 12:18:39
1
has voted
29 Jan 2004 12:18:39 sander kerstens posted:
hi there i have a script that calculates a value but when thevalue is for example 5.40 the textbox displays it as 5.4
because this is a money value it has to have the "0" at the end
how can i make the script so that it always has 2 decimals behind the comma or point....
here is the script
<%
Dim strfoto1
if (orders.Fields.Item("aantal".Value) = 1 then
strfoto1 = (kostprijs.Fields.Item("kosten".Value) * (orders.Fields.Item("aantal".Value) + 1.80
ElseIf (orders.Fields.Item("aantal".Value) Mod 2 = 1 then
strfoto1 = ((kostprijs.Fields.Item("kosten".Value) + 0.25) * (orders.Fields.Item("aantal".Value) + 0.10 + 1.80
else
strfoto1 = ((kostprijs.Fields.Item("kosten".Value) + 0.25) * (orders.Fields.Item("aantal".Value) + 1.80
end if
%>
<input type="text" name="textfield2" value="<%=strfoto1%>" readonly>
thanks for youre help
greetz Sander
Replies
Replied 30 Jan 2004 16:39:34
30 Jan 2004 16:39:34 Lee Diggins replied:
Hi Sander
Try something like this:
FormatNumber((kostprijs.Fields.Item("kosten".Value) * (orders.Fields.Item("aantal".Value) + 1.80,2)
You can also use the RND() function fro calculation that end up with more decimal places that you require.
Digga
Sharing Knowledge Saves Valuable Time!!!
Try something like this:
FormatNumber((kostprijs.Fields.Item("kosten".Value) * (orders.Fields.Item("aantal".Value) + 1.80,2)
You can also use the RND() function fro calculation that end up with more decimal places that you require.
Digga
Sharing Knowledge Saves Valuable Time!!!