shipping, taxes, grand total, (help with script) - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

shipping, taxes, grand total, (help with script)

Posts: 1Member
Hi,

I am trying to use this script on a confirmation page
to show: shipping, taxes, grand total.

The problem i am having is: the shipping is the only part that displays
correctly, the salesTax only returns a value of \$0.00 and the grandTotal
subtotal and shipping on the same line. example: subtotal=\$80.00+Shipping
=\$7.95 It displays as \$807.95 Can any one help me out on this?
<%
var UCCart1_subTotal = UCCart1.GetColumnTotal("Total");
var UCCart1_salesTax = 0;
var UCCart1_salesTaxRate = 0;
var TaxState = Request.Form("BillState")
if (TaxState == "NY")
{
UCCart1_salesTaxRate = 0.45;
UCCart1_salesTax=UCCart1_salesTaxRate*UCCart1_subTotal;
}
var UCCart1_grandTotal=UCCart1_subTotal+UCCart1_salesTax+UCCart1_ShipCost;
Session("grandTotal") = UCCart1_grandTotal
%>

Nelson.

• Posts: 5Member
You need to convert your values from string to numeric, and then add them:
UCCart1_subTotal = UCCart1_subTotal - 0;
UCCart1_salesTax = UCCart1_salesTax - 0;
UCCart1_ShipCost = UCCart1_ShipCost - 0;
UCCart1_grandTotal=UCCart1_subTotal+UCCart1_salesTax+UCCart1_ShipCost;

Otherwise it will treat the values as string and concatenate the characters. To convert from numeric to string do this:
UCCart1_subTotal = UCCart1_subTotal + "";

: Hi,
:
: I am trying to use this script on a confirmation page
: to show: shipping, taxes, grand total.
:
: The problem i am having is: the shipping is the only part that displays
: correctly, the salesTax only returns a value of \$0.00 and the grandTotal
: subtotal and shipping on the same line. example: subtotal=\$80.00+Shipping
: =\$7.95 It displays as \$807.95 Can any one help me out on this?
: <%
: var UCCart1_subTotal = UCCart1.GetColumnTotal("Total");
: var UCCart1_salesTax = 0;
: var UCCart1_salesTaxRate = 0;
: var TaxState = Request.Form("BillState")
: if (TaxState == "NY")
: {
: UCCart1_salesTaxRate = 0.45;
: UCCart1_salesTax=UCCart1_salesTaxRate*UCCart1_subTotal;
: }
: var UCCart1_grandTotal=UCCart1_subTotal+UCCart1_salesTax+UCCart1_ShipCost;
: Session("grandTotal") = UCCart1_grandTotal
: %>
:
: Nelson.
:
: