[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Format Variable As 2 Decimal Places - URGENT 500 Points

Posted on 2006-04-29
7
Medium Priority
?
407 Views
Last Modified: 2010-05-18
Hello i have this code..

                  <% Response.Write strCurrencySymbol %>
                  <% intVatAmount = ((intSubTotal/100) * strVatRate) %>
                  <% IF intVatAmount = 0 THEN Response.Write "0.00" ELSE Response.Write intVatAmount %>

and would like to know how to response.write intVatAmount as 2 decimal places (as in a currency)

Regards,
Carl
0
Comment
Question by:net-workx
  • 5
  • 2
7 Comments
 
LVL 1

Expert Comment

by:gyra
ID: 16570206
response.write(formatCurrency(intVatAmount))
0
 
LVL 1

Expert Comment

by:gyra
ID: 16570208
hello, sorry i didn't say hi, here's your new code:

               <% Response.Write strCurrencySymbol %>
               <% intVatAmount = ((intSubTotal/100) * strVatRate) %>
               <% IF intVatAmount = 0 THEN Response.Write "0.00" ELSE Response.Write formatCurrency(intVatAmount )%>
0
 

Author Comment

by:net-workx
ID: 16571891
This is not what i want to do as the format currency uses the servers local variable - i want this system to be currenty independant from the server.

the Response.Write strCurrencySymbol comes from a personalisation table which has VAT rates, currency symbols, currency types for integration into the payment processing gateway.

I just need to know how to format the figure as 13.65 rather than 13.65665454 for example.

Regards,
Carl
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
gyra earned 2000 total points
ID: 16572748
how about this...

               <% Response.Write strCurrencySymbol %>
               <% intVatAmount = ((intSubTotal/100) * strVatRate) %>
               <% IF intVatAmount = 0 THEN Response.Write "0.00" ELSE Response.Write formatNumber(intVatAmount,2 )%>

that should do it for you
0
 
LVL 1

Expert Comment

by:gyra
ID: 16572751
the 2 in the formatNumber represents how many numbers after the decimal you want to show.
0
 

Author Comment

by:net-workx
ID: 16573137
Thanks for your help - worked perfectly!!

Regards,
Carl
0
 
LVL 1

Expert Comment

by:gyra
ID: 16573974
glad to help!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question