Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

currency calculation and formatting

LEGEND ,
Jan 22, 2007 Jan 22, 2007

Copy link to clipboard

Copied

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) %>


TOPICS
Server side applications

Views

175
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2007 Jan 22, 2007

Copy link to clipboard

Copied

LATEST
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) %>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines