Getting an accurate Tax percentage

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Getting an accurate Tax percentage

    Hi Guys

    Wonder if you can help with my problem that seemed simple enough at first,
    but now appears to be a real pain.

    Basically I have created a few ASP web pages which have the following form
    fields on them:

    Net Amount (standard textbox)
    Tax Amount (standard textbox)
    Tax Rate (drop-down field)
    Total Amount (standard textbox)

    Allowing the user to populate these fields doesn't prove a problem, my
    problem is that when I retrieve the data that they have previously posted, I
    need to work out what rate to show (SELECTED) in the Tax Rate drop-down menu
    field. This is where the math part comes in.

    My plan was to take the Tax Amount divide it by the Net Amount and then
    times the result by 100. As an example, please not the following:

    a) My Tax Rate drop-down menu will have a rate of 17.5.

    b) My Net Amount is 200.00

    c) My Tax Amount is 35.00

    d) 35.00 / 200.00 * 100 = 17.5 <<< bingo I say, however:


    Lets say my Net Amount is 5.00 and my Tax Amount is 0.88 I get 17.6 and if I
    go for a Tax Amount of 0.87 I get 17.4.

    How can I get round this?

    For your ref, I'm using a MySQL DB that has the Net Amount and Tax Amount
    set to a decimal data type with 3 decimal places.

    Can you give me an idea of what calc I can use (ASP friendly would be really
    nice) to get a more accurate output.

    Thanks

    Laphan




    Laphan Guest

  2. Similar Questions and Discussions

    1. How accurate is the overprint preview?
      I am looking for a bright red PMS to be overprinted on tan paper (Desert Storm which is close to PMS 7503.) When I simulate the tan paper color using...
    2. Displaying as a percentage
      In my SQL Query I am selecting two fields from an Access database, both of which are numbers. I am then dividing the two together and using AS to...
    3. Accurate PMS on Epson 1290? Mac OSX.3.3
      Hello everyone.. I've been having colour problems with getting accurate PMS colours out of the Epson 1290 and freehand 11/illustrator v10 Does...
    4. Co-odinates not accurate!!!!
      0S.9.2 I have a page in QuarkXpress 4.1which has a flat colour (PMS288) in a picture box. Another picture box sits on top of this whose...
    5. Clipping Path Is Not Accurate
      When I create a clipping path in Photoshop then bring it into Illustrator, the path is not as accurate as the one i crreated in Photoshop. How can I...
  3. #2

    Default Re: Getting an accurate Tax percentage

    My suggestion would be not to do the calculation in the database, but in the
    ASP script. The FormatNumber function can format your output to decimal
    places as needed:

    FormatNumber(TaxAmount/NetAmount * 100, 3)

    --
    Manohar Kamath
    Editor, .netWire
    [url]www.dotnetwire.com[/url]


    "Laphan" <news@DoNotEmailMe.co.uk> wrote in message
    news:4106c7c2_3@127.0.0.1...
    > Hi Guys
    >
    > Wonder if you can help with my problem that seemed simple enough at first,
    > but now appears to be a real pain.
    >
    > Basically I have created a few ASP web pages which have the following form
    > fields on them:
    >
    > Net Amount (standard textbox)
    > Tax Amount (standard textbox)
    > Tax Rate (drop-down field)
    > Total Amount (standard textbox)
    >
    > Allowing the user to populate these fields doesn't prove a problem, my
    > problem is that when I retrieve the data that they have previously posted,
    I
    > need to work out what rate to show (SELECTED) in the Tax Rate drop-down
    menu
    > field. This is where the math part comes in.
    >
    > My plan was to take the Tax Amount divide it by the Net Amount and then
    > times the result by 100. As an example, please not the following:
    >
    > a) My Tax Rate drop-down menu will have a rate of 17.5.
    >
    > b) My Net Amount is 200.00
    >
    > c) My Tax Amount is 35.00
    >
    > d) 35.00 / 200.00 * 100 = 17.5 <<< bingo I say, however:
    >
    >
    > Lets say my Net Amount is 5.00 and my Tax Amount is 0.88 I get 17.6 and if
    I
    > go for a Tax Amount of 0.87 I get 17.4.
    >
    > How can I get round this?
    >
    > For your ref, I'm using a MySQL DB that has the Net Amount and Tax Amount
    > set to a decimal data type with 3 decimal places.
    >
    > Can you give me an idea of what calc I can use (ASP friendly would be
    really
    > nice) to get a more accurate output.
    >
    > Thanks
    >
    > Laphan
    >
    >
    >
    >

    Manohar Kamath [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139