formatnumber is not taking thousands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ozkarlav
    New Member
    • Sep 2007
    • 1

    formatnumber is not taking thousands

    I'm working on a proyect for a shopping cart, the problem is the coding is not taking the thousands in the sum for the grand total e.g.:

    Sub total: 4,175.50
    G.S.T.: 250.53
    P.S.T: 334.04
    Shipping: 8.95
    Handling: 4.00
    Grand Total:601.52
    and it should be: 4,760.07

    I've tried everything with the formatnumber, I want to know if there is a way to remove the comma for the thousands, or make the grand total to get the thousands format.

    This is the parseFloat I have:

    }

    document.frmCar t.shipping_cost .value = sngCurrShip.toF ixed(2)
    document.frmCar t.shipping_show .value = (sngCurrShip - 4).toFixed(2)
    document.frmCar t.handling_show .value = (handleFee).toF ixed(2)
    sngGrandTot = parseFloat(docu ment.frmCart.sn gSubTotal.value ) + parseFloat(docu ment.frmCart.ps t.value) + parseFloat(docu ment.frmCart.gs t.value) + parseFloat(docu ment.frmCart.sh ipping_cost.val ue)
    document.frmCar t.GrandTotal.va lue = sngGrandTot.toF ixed(2)
    document.frmCar t.charge_total. value = sngGrandTot.toF ixed(2)
    return ;
    }

    THANK YOU
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    moved to .NET forum

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      You are talking about when you do myfloat.ToStrin g()?
      There are overloads for .ToString() that will print it out with a thousands specifier.

      If your trouble is with parsing a string into a float, float.Parse() has overloads as well that will allow a thousands specifier to be present.

      Comment

      Working...