Skip to main content
Inspiring
January 22, 2007
Question

currency calculation and formatting

  • January 22, 2007
  • 1 reply
  • 192 views
Can anyone see whats wrong with this code?
I'm trying to do a calculation on a shopping cart price.

My table includes two fields, price and percentage.

I want to display the discount price based on the percentage field.
I'm getting the correct result but the format is like 107.0575 instead of
£107.05

I'm close :-)

Andy


<%=
FormatCurrency((RSDetails.Fields.Item("Price").Value), -1, -2, -2, -2)-FormatCurrency((RSDetails.Fields.Item("Price").Value),
-1, -2, -2, -2)/100*FormatNumber((RSDetails.Fields.Item("percentage").Value),
2, -2, -2, -2) %>


This topic has been closed for replies.

1 reply

Inspiring
January 23, 2007
You need only one FormatCurrency declaration, and then wrap the calculation
in that

<% =
FormatCurrency(((RSDetails.Fields.Item("Price").Value)-((RSDetails.Fields.Item("Price").Value*RSDetails.Fields.Item("percentage").Value),
-1, -2, -2, -2 %>

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Andy" <me@work.com> wrote in message
news:ep2a3r$8gk$1@forums.macromedia.com...
> Can anyone see whats wrong with this code?
> I'm trying to do a calculation on a shopping cart price.
>
> My table includes two fields, price and percentage.
>
> I want to display the discount price based on the percentage field.
> I'm getting the correct result but the format is like 107.0575 instead of
> £107.05
>
> I'm close :-)
>
> Andy
>
>
> <%=
> FormatCurrency((RSDetails.Fields.Item("Price").Value), -1, -2, -2, -2)-FormatCurrency((RSDetails.Fields.Item("Price").Value),
> -1, -2, -2, -2)/100*FormatNumber((RSDetails.Fields.Item("percentage").Value),
> 2, -2, -2, -2) %>
>